@almyty/client 1.5.8 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials.d.ts +8 -0
- package/dist/credentials.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/credentials.d.ts
CHANGED
|
@@ -48,3 +48,11 @@ export declare function resolveCredentialsOrExit(): StoredCredentials;
|
|
|
48
48
|
* Returns null if the token isn't a JWT or has no orgs.
|
|
49
49
|
*/
|
|
50
50
|
export declare function getOrgSlugFromToken(token: string): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* The organization a bare agent name belongs to: the one `almyty login`
|
|
53
|
+
* chose (stored as organizationId; the login stores an almyty_ API key,
|
|
54
|
+
* which is no JWT and names no organization), else the first one an old
|
|
55
|
+
* JWT login carried. The unified endpoint takes an organization id
|
|
56
|
+
* wherever it takes a slug. Null when neither says.
|
|
57
|
+
*/
|
|
58
|
+
export declare function defaultOrganization(creds: Pick<StoredCredentials, 'token' | 'organizationId'>): string | null;
|
package/dist/credentials.js
CHANGED
|
@@ -94,3 +94,15 @@ export function getOrgSlugFromToken(token) {
|
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* The organization a bare agent name belongs to: the one `almyty login`
|
|
99
|
+
* chose (stored as organizationId; the login stores an almyty_ API key,
|
|
100
|
+
* which is no JWT and names no organization), else the first one an old
|
|
101
|
+
* JWT login carried. The unified endpoint takes an organization id
|
|
102
|
+
* wherever it takes a slug. Null when neither says.
|
|
103
|
+
*/
|
|
104
|
+
export function defaultOrganization(creds) {
|
|
105
|
+
if (creds.organizationId)
|
|
106
|
+
return creds.organizationId;
|
|
107
|
+
return getOrgSlugFromToken(creds.token);
|
|
108
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AlmytyClient, GatewayClient, parseSseFrame, isAbortError, isPermanentStreamError, PERMANENT_STREAM_STATUSES, RUN_STREAM_RETRY_DELAYS_MS, } from './client.js';
|
|
2
2
|
export type { AgentInfo, AgentTool, AgentRun, PipelineNode, RunLimits, StreamEvent, StreamEventHandler, RunnerSummary, RunnerCodingAgent, CodingSession, RunLogEvent, RunStreamOptions, RunStreamPosition, } from './client.js';
|
|
3
|
-
export { loadCredentials, resolveCredentials, resolveCredentialsOrExit, getOrgSlugFromToken, credentialsExpired, CREDENTIALS_FILE, } from './credentials.js';
|
|
3
|
+
export { loadCredentials, resolveCredentials, resolveCredentialsOrExit, getOrgSlugFromToken, defaultOrganization, credentialsExpired, CREDENTIALS_FILE, } from './credentials.js';
|
|
4
4
|
export type { StoredCredentials } from './credentials.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AlmytyClient, GatewayClient, parseSseFrame, isAbortError, isPermanentStreamError, PERMANENT_STREAM_STATUSES, RUN_STREAM_RETRY_DELAYS_MS, } from './client.js';
|
|
2
|
-
export { loadCredentials, resolveCredentials, resolveCredentialsOrExit, getOrgSlugFromToken, credentialsExpired, CREDENTIALS_FILE, } from './credentials.js';
|
|
2
|
+
export { loadCredentials, resolveCredentials, resolveCredentialsOrExit, getOrgSlugFromToken, defaultOrganization, credentialsExpired, CREDENTIALS_FILE, } from './credentials.js';
|