You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit faeed0b
Browse filesBrowse the repository at this point in the historyBrowse files
Match the Python SDK (stackone-ai-python#23): the account id must be
passed as accountId/accountIds, and STACKONE_API_KEY stays the only
credential read from the environment. In 3.0 an unset account means
every active account, so an environment variable silently setting it
changed a toolset's scope without the code saying so.
The README and examples now read STACKONE_ACCOUNT_ID themselves and pass
it as accountId; unset, it is undefined and the toolset discovers the
key's accounts. MIGRATION.md shows the before and after.
BREAKING CHANGE: STACKONE_ACCOUNT_ID is no longer read. Pass the account
id as accountId or accountIds; without one, the toolset discovers every
active account linked to the API key.
**With no account id, the SDK discovers your accounts.** In 2.x, calling `fetchTools()` with no account listed tools without an `x-account-id`, which the API refuses. In 3.0 it asks `GET /accounts` (also available as `toolset.fetchAccounts()`) and lists the catalog of every active account. If you have many accounts, pass `accountId`, `accountIds` or call `setAccounts()` so the SDK does not fetch every catalog.
181
181
182
+
**`STACKONE_ACCOUNT_ID` is no longer read.** Pass the account id as `accountId` or `accountIds`. Since an unset account now means every active account, an environment variable that set it implicitly could widen or narrow a toolset's scope without the code saying so. `STACKONE_API_KEY` is still read. To keep the variable, read it yourself; unset, it is `undefined` and the toolset discovers your accounts:
**Listings are merged in sorted account order.** When two accounts serve the same tool name, `getTool()` returns the first one listed — now the one on the lowest account id, where 2.x followed the order you passed. A warning names the clashing tools. Pass `accountIds` to choose the account yourself.
183
193
184
194
**`fetchTools()` returns fresh tool instances on every call**, never the cached `Tools`, so `setAccountId()` on one tool no longer changes what later callers get. An account whose listing fails is skipped with a warning, unless every account fails.
Copy file name to clipboardExpand all lines: README.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,13 +77,13 @@ for (const account of await toolset.fetchAccounts()) {
77
77
78
78
### Account IDs
79
79
80
-
StackOne uses account IDs to identify different integrations. You can specify the account ID at different levels (a per-call `accountIds` wins, then `setAccounts()`, then the constructor's `accountIds`, then `accountId` or `STACKONE_ACCOUNT_ID`, then discovery):
80
+
StackOne uses account IDs to identify different integrations. You can specify the account ID at different levels (a per-call `accountIds` wins, then `setAccounts()`, then the constructor's `accountIds`, then `accountId`, then discovery). The SDK never reads an account id from the environment, so an environment variable cannot silently change which accounts a toolset reaches. To keep yours in `STACKONE_ACCOUNT_ID`, read it yourself:
81
81
82
82
```typescript
83
83
import { StackOneToolSet } from'@stackone/ai';
84
84
85
-
//Simplest: set STACKONE_ACCOUNT_ID environment variable
86
-
const toolset =newStackOneToolSet();
85
+
//Single account, read from your own environment variable. Unset means discovery
0 commit comments