@crewx/sdk 0.9.0-rc.161 → 0.9.0-rc.163
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/agent-interceptor/chain.d.ts +25 -0
- package/dist/agent-interceptor/index.d.ts +6 -0
- package/dist/agent-interceptor/model-runner.d.ts +19 -0
- package/dist/agent-interceptor/program-runner.d.ts +13 -0
- package/dist/agent-interceptor/protocol.d.ts +68 -0
- package/dist/agent-interceptor/run-stop.d.ts +3 -0
- package/dist/agent-interceptor/schema.d.ts +267 -0
- package/dist/agent-interceptor/types.d.ts +88 -0
- package/dist/esm/index.js +305 -297
- package/dist/esm/plugins/index.js +86 -81
- package/dist/esm/publish/index.js +1 -1
- package/dist/esm/repository/index.js +98 -93
- package/dist/esm/skills/index.js +1 -1
- package/dist/events/types.d.ts +12 -0
- package/dist/facade/Crewx.d.ts +9 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +307 -299
- package/dist/plugins/index.js +83 -78
- package/dist/provider/bridge.d.ts +5 -1
- package/dist/provider/cli/adapter.types.d.ts +9 -0
- package/dist/provider-account/accounts.d.ts +15 -0
- package/dist/provider-account/index.d.ts +5 -0
- package/dist/provider-account/registry.d.ts +30 -0
- package/dist/provider-account/types.d.ts +40 -0
- package/dist/publish/index.js +1 -1
- package/dist/repository/index.js +99 -94
- package/dist/repository/task.repository.d.ts +7 -0
- package/dist/repository/thread.repository.d.ts +1 -0
- package/dist/skills/index.js +1 -1
- package/dist/types/index.d.ts +33 -0
- package/dist/types/task-log.types.d.ts +3 -1
- package/dist/utils/id.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliProviderAdapter } from './cli/adapter.types.js';
|
|
1
|
+
import type { CliProviderAdapter, ProviderRateLimitWindows } from './cli/adapter.types.js';
|
|
2
2
|
export declare function parseStreamJsonOutput(raw: string): string;
|
|
3
3
|
export declare function parseResultEventUsage(raw: string): ProviderUsage | null;
|
|
4
4
|
export { ProviderError, IdleTimeoutError, TotalTimeoutError, type ProviderErrorCode, type ProviderErrorKind, type ProviderErrorOptions, ResumeTimeoutError, } from './errors.js';
|
|
@@ -9,8 +9,10 @@ export interface RunCliProcessOptions {
|
|
|
9
9
|
idleMs?: number;
|
|
10
10
|
resumeSessionId?: string;
|
|
11
11
|
env?: Record<string, string>;
|
|
12
|
+
unsetEnv?: readonly string[];
|
|
12
13
|
cwd?: string;
|
|
13
14
|
onOutput?: (line: string, level: 'stdout' | 'stderr') => void;
|
|
15
|
+
onRateLimitObserved?: (windows: ProviderRateLimitWindows) => void;
|
|
14
16
|
onPid?: (pid: number) => void;
|
|
15
17
|
onExitCode?: (code: number) => void;
|
|
16
18
|
onUsage?: (usage: ProviderUsage) => void;
|
|
@@ -71,6 +73,8 @@ export interface ProviderQueryOptions {
|
|
|
71
73
|
onModel?: (model: string) => void;
|
|
72
74
|
onTaskLog?: (entries: import('../types/task-log.types').TaskLogEntry[]) => void;
|
|
73
75
|
env?: Record<string, string>;
|
|
76
|
+
unsetEnv?: readonly string[];
|
|
77
|
+
onRateLimitObserved?: (windows: ProviderRateLimitWindows) => void;
|
|
74
78
|
cwd?: string;
|
|
75
79
|
timeoutMs?: number;
|
|
76
80
|
idleMs?: number;
|
|
@@ -47,6 +47,15 @@ export interface CliProviderAdapter {
|
|
|
47
47
|
};
|
|
48
48
|
parseEvent?(line: string, timestamp?: string, context?: ParseEventContext): TaskLogEntry[];
|
|
49
49
|
suppressOutputLine?(line: string): boolean;
|
|
50
|
+
observeRateLimit?(line: string): ProviderRateLimitWindows | undefined;
|
|
51
|
+
}
|
|
52
|
+
export interface ProviderRateLimitWindow {
|
|
53
|
+
utilization: number;
|
|
54
|
+
resetsAt: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ProviderRateLimitWindows {
|
|
57
|
+
five_hour?: ProviderRateLimitWindow;
|
|
58
|
+
seven_day?: ProviderRateLimitWindow;
|
|
50
59
|
}
|
|
51
60
|
export declare class RateLimitError extends ProviderError {
|
|
52
61
|
readonly name = "RateLimitError";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AddedAiAccount, type AiAccountEnvPlan, type AiAccountInvocation, type AiAccountProvider, type AiAccountSummary, type ResolvedAiAccount, type ResolveAiAccountInput } from './types';
|
|
2
|
+
export declare function aiAccountEnvPlan(provider: AiAccountProvider, namedDir?: string): AiAccountEnvPlan;
|
|
3
|
+
export declare function applyAiAccountEnv(base: NodeJS.ProcessEnv, plan: AiAccountEnvPlan): NodeJS.ProcessEnv;
|
|
4
|
+
export declare function listAiAccounts(provider: string): AiAccountSummary[];
|
|
5
|
+
export declare function addAiAccount(provider: string, label: string): AddedAiAccount;
|
|
6
|
+
export declare function removeAiAccount(id: string): {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
provider: AiAccountProvider;
|
|
10
|
+
removedAt: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function setActiveAiAccount(provider: string, id: string): void;
|
|
13
|
+
export declare function getLoginInvocation(id: string, provider?: string): AiAccountInvocation;
|
|
14
|
+
export declare function getStatusInvocation(id: string, provider?: string): AiAccountInvocation;
|
|
15
|
+
export declare function resolveAiAccountForRun(input: ResolveAiAccountInput): ResolvedAiAccount | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { addAiAccount, applyAiAccountEnv, aiAccountEnvPlan, getLoginInvocation, getStatusInvocation, listAiAccounts, removeAiAccount, resolveAiAccountForRun, setActiveAiAccount, } from './accounts';
|
|
2
|
+
export { defaultAiAccountDir, loadProviderAccountsRegistry, providerAccountsRegistryPath, providerAccountsRoot, } from './registry';
|
|
3
|
+
export type { ProviderAccountsRegistry, RemovedAiAccount, StoredAiAccount, } from './registry';
|
|
4
|
+
export { AI_ACCOUNT_PROVIDERS, AiAccountError, CLAUDE_ACCOUNT_STRIPPED_ENV, DEFAULT_AI_ACCOUNT_ID, } from './types';
|
|
5
|
+
export type { AddedAiAccount, AiAccountEnvPlan, AiAccountErrorCode, AiAccountInvocation, AiAccountProvider, AiAccountSummary, ResolveAiAccountInput, ResolvedAiAccount, } from './types';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AiAccountProvider } from './types';
|
|
2
|
+
export interface StoredAiAccount {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
dir: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RemovedAiAccount {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
provider: AiAccountProvider;
|
|
12
|
+
removedAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ProviderAccountSlot {
|
|
15
|
+
active: string;
|
|
16
|
+
accounts: StoredAiAccount[];
|
|
17
|
+
}
|
|
18
|
+
export interface ProviderAccountsRegistry {
|
|
19
|
+
version: 1;
|
|
20
|
+
providers: Record<AiAccountProvider, ProviderAccountSlot>;
|
|
21
|
+
removed: RemovedAiAccount[];
|
|
22
|
+
}
|
|
23
|
+
export declare function providerAccountsRegistryPath(): string;
|
|
24
|
+
export declare function providerAccountsRoot(): string;
|
|
25
|
+
export declare function defaultAiAccountDir(provider: AiAccountProvider): string;
|
|
26
|
+
export declare function isAiAccountProvider(value: string): value is AiAccountProvider;
|
|
27
|
+
export declare function emptyProviderAccountsRegistry(): ProviderAccountsRegistry;
|
|
28
|
+
export declare function loadProviderAccountsRegistry(): ProviderAccountsRegistry;
|
|
29
|
+
export declare function saveProviderAccountsRegistry(registry: ProviderAccountsRegistry): void;
|
|
30
|
+
export declare function allocatedAiAccountIds(registry: ProviderAccountsRegistry): Set<string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const AI_ACCOUNT_PROVIDERS: readonly ["cli/claude", "cli/codex"];
|
|
2
|
+
export type AiAccountProvider = (typeof AI_ACCOUNT_PROVIDERS)[number];
|
|
3
|
+
export declare const DEFAULT_AI_ACCOUNT_ID = "default";
|
|
4
|
+
export declare const CLAUDE_ACCOUNT_STRIPPED_ENV: readonly ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "CLAUDE_CODE_OAUTH_TOKEN"];
|
|
5
|
+
export type AiAccountErrorCode = 'ACCOUNT_LABEL_INVALID' | 'ACCOUNT_PROVIDER_INVALID' | 'ACCOUNT_PROVIDER_UNSUPPORTED' | 'ACCOUNT_NOT_FOUND' | 'ACCOUNT_UNKNOWN' | 'ACCOUNT_DEFAULT_PROTECTED' | 'ACCOUNT_ACTIVE_PROTECTED' | 'ACCOUNT_RESUME_REMOVED' | 'ACCOUNT_REGISTRY_INVALID';
|
|
6
|
+
export declare class AiAccountError extends Error {
|
|
7
|
+
readonly code: AiAccountErrorCode;
|
|
8
|
+
constructor(code: AiAccountErrorCode, message: string);
|
|
9
|
+
}
|
|
10
|
+
export interface AiAccountSummary {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
provider: AiAccountProvider;
|
|
14
|
+
dir: string;
|
|
15
|
+
builtIn: boolean;
|
|
16
|
+
active: boolean;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AddedAiAccount {
|
|
20
|
+
id: string;
|
|
21
|
+
dir: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AiAccountEnvPlan {
|
|
24
|
+
env: Record<string, string>;
|
|
25
|
+
unsetEnv: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface AiAccountInvocation extends AiAccountEnvPlan {
|
|
28
|
+
command: string;
|
|
29
|
+
argv: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ResolvedAiAccount extends AiAccountEnvPlan {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
fallback?: 'removed';
|
|
35
|
+
}
|
|
36
|
+
export interface ResolveAiAccountInput {
|
|
37
|
+
provider: string;
|
|
38
|
+
agentField?: string;
|
|
39
|
+
pinnedId?: string;
|
|
40
|
+
}
|