@qoder-ai/qoder-agent-sdk 1.0.16 → 1.0.19
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/README.md +48 -44
- package/dist/auth.d.ts +5 -2
- package/dist/core/brand.d.ts +22 -0
- package/dist/core/constants.d.ts +16 -6
- package/dist/core/runtime-launch-options.d.ts +7 -0
- package/dist/core/runtime-selection.d.ts +24 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +26 -26
- package/dist/protocol/common.d.ts +27 -0
- package/dist/protocol/control.d.ts +5 -1
- package/dist/protocol/hooks.d.ts +2 -1
- package/dist/protocol/index.d.ts +1 -1
- package/dist/protocol/index.js +1 -1
- package/dist/protocol/messages.d.ts +6 -0
- package/dist/query/query-runner.d.ts +4 -2
- package/dist/runtime-manifest.json +10 -2
- package/dist/session/transcript-paths.d.ts +3 -3
- package/dist/types/auth.d.ts +27 -2
- package/dist/types/common.d.ts +1 -1
- package/dist/types/control.d.ts +12 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/options.d.ts +14 -1
- package/dist/types/tools.d.ts +58 -2
- package/package.json +4 -55
- package/scripts/postinstall.cjs +127 -135
|
@@ -43,6 +43,12 @@ export type BetaUsage = {
|
|
|
43
43
|
} | null;
|
|
44
44
|
service_tier?: string | null;
|
|
45
45
|
speed?: string | null;
|
|
46
|
+
/** Qoder request-level metering value after discounts. */
|
|
47
|
+
credits?: number;
|
|
48
|
+
/** Qoder request-level metering value before discounts. */
|
|
49
|
+
original_credits?: number;
|
|
50
|
+
/** Whether the request contributes to the user's billed usage. */
|
|
51
|
+
billable?: boolean;
|
|
46
52
|
};
|
|
47
53
|
export type BetaMessage = {
|
|
48
54
|
id?: string;
|
|
@@ -102,6 +108,12 @@ export type NonNullableUsage = {
|
|
|
102
108
|
request_id?: string;
|
|
103
109
|
/** Context window usage ratio for the completed turn (0~1). */
|
|
104
110
|
context_usage_ratio?: number;
|
|
111
|
+
/** Qoder request-level metering value after discounts. */
|
|
112
|
+
credits?: number;
|
|
113
|
+
/** Qoder request-level metering value before discounts. */
|
|
114
|
+
original_credits?: number;
|
|
115
|
+
/** Whether the request contributes to the user's billed usage. */
|
|
116
|
+
billable?: boolean;
|
|
105
117
|
};
|
|
106
118
|
export type AccountInfo = {
|
|
107
119
|
userId?: string;
|
|
@@ -132,6 +144,12 @@ export type UsageOrgResourcePackage = {
|
|
|
132
144
|
available?: boolean;
|
|
133
145
|
unit?: string;
|
|
134
146
|
};
|
|
147
|
+
export type SessionCreditsUsage = {
|
|
148
|
+
total_credits: number;
|
|
149
|
+
model_usage: Record<string, {
|
|
150
|
+
credits: number;
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
135
153
|
export type UsageInfo = {
|
|
136
154
|
userId?: string;
|
|
137
155
|
userType?: string;
|
|
@@ -144,6 +162,13 @@ export type UsageInfo = {
|
|
|
144
162
|
isQuotaExceeded?: boolean;
|
|
145
163
|
isPlanQuotaProrated?: boolean;
|
|
146
164
|
orgResourcePackage?: UsageOrgResourcePackage;
|
|
165
|
+
/**
|
|
166
|
+
* Credits consumed by the current CLI session.
|
|
167
|
+
*
|
|
168
|
+
* This is independent from the account quota fields above and may be present
|
|
169
|
+
* even when the account quota endpoint is unavailable.
|
|
170
|
+
*/
|
|
171
|
+
session?: SessionCreditsUsage;
|
|
147
172
|
};
|
|
148
173
|
export type ApiKeySource = 'none' | 'user' | 'project' | 'org' | 'temporary' | 'oauth';
|
|
149
174
|
export type ExitReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other' | 'bypass_permissions_disabled';
|
|
@@ -336,6 +361,8 @@ export type ModelUsage = {
|
|
|
336
361
|
cacheCreationInputTokens: number;
|
|
337
362
|
webSearchRequests: number;
|
|
338
363
|
costUSD: number;
|
|
364
|
+
/** Session-cumulative Qoder credits attributed to this model. */
|
|
365
|
+
credits?: number;
|
|
339
366
|
contextWindow: number;
|
|
340
367
|
maxOutputTokens: number;
|
|
341
368
|
};
|
|
@@ -17,7 +17,7 @@ import type { McpServerStatus, McpSetServersResult, McpServerConfigForCliTranspo
|
|
|
17
17
|
import type { PermissionMode, PermissionUpdate } from './permissions.js';
|
|
18
18
|
import type { SDKMessage } from './messages.js';
|
|
19
19
|
import type { AgentDefinition, AgentInfo } from './agents.js';
|
|
20
|
-
import type { AccountInfo, FastModeState, ModelInfo, SlashCommand, SdkPluginConfig, UsageInfo } from './common.js';
|
|
20
|
+
import type { AccountInfo, FastModeState, ModelInfo, SessionCreditsUsage, SlashCommand, SdkPluginConfig, UsageInfo } from './common.js';
|
|
21
21
|
import type { PluginDetails } from '../types/plugins.js';
|
|
22
22
|
import type { ModelPromptPatches } from './model-prompt-patches.js';
|
|
23
23
|
export type SDKControlRequest = {
|
|
@@ -247,6 +247,10 @@ export type SDKControlGetUsageInfoRequest = {
|
|
|
247
247
|
};
|
|
248
248
|
export type SDKControlGetUsageInfoResponse = {
|
|
249
249
|
usage: UsageInfo | null;
|
|
250
|
+
/** Session-local credits, independent from account quota availability. */
|
|
251
|
+
session?: SessionCreditsUsage;
|
|
252
|
+
/** Account quota lookup failure; session credits may still be available. */
|
|
253
|
+
usage_error?: string;
|
|
250
254
|
};
|
|
251
255
|
export type SDKControlAccountInfoRequest = {
|
|
252
256
|
type: 'account_info';
|
package/dist/protocol/hooks.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type BaseHookInput = {
|
|
|
15
15
|
session_id: string;
|
|
16
16
|
transcript_path: string;
|
|
17
17
|
cwd: string;
|
|
18
|
+
/** Human-readable display name of the model responsible for this event. */
|
|
19
|
+
model?: string;
|
|
18
20
|
permission_mode?: string;
|
|
19
21
|
agent_id?: string;
|
|
20
22
|
agent_type?: string;
|
|
@@ -48,7 +50,6 @@ export type SessionStartHookInput = BaseHookInput & {
|
|
|
48
50
|
hook_event_name: 'SessionStart';
|
|
49
51
|
source: 'startup' | 'resume' | 'clear' | 'compact';
|
|
50
52
|
agent_type?: string;
|
|
51
|
-
model?: string;
|
|
52
53
|
};
|
|
53
54
|
export type SessionEndHookInput = BaseHookInput & {
|
|
54
55
|
hook_event_name: 'SessionEnd';
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export { WIRE_PROTOCOL_VERSION, type WireProtocolVersion } from './version.js';
|
|
16
16
|
export type { ModelPromptPatch, ModelPromptPatches, } from './model-prompt-patches.js';
|
|
17
|
-
export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from './common.js';
|
|
17
|
+
export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, SessionCreditsUsage, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from './common.js';
|
|
18
18
|
export type { AICodeTrackingLaunchOptions, QoderAgentLaunchOptions, QoderCliFlagSettings, } from './launch.js';
|
|
19
19
|
export { buildQoderCliFlagSettings, buildQoderCliFlagSettingsArgs, } from './launch.js';
|
|
20
20
|
export type { PermissionMode, PermissionBehavior, PermissionDecisionClassification, PermissionUpdateDestination, PermissionRuleValue, PermissionUpdate, PermissionResult, } from './permissions.js';
|
package/dist/protocol/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var r="1.1.0";function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function
|
|
1
|
+
var r="1.1.0";function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function n(e={}){let t={...e.settings??{}},o=e.aiCodeTracking?.installGitCommitHook;if(o!==void 0){let s=t.aiCodeTracking;t.aiCodeTracking={...i(s)?s:{},installGitCommitHook:o}}return t}function l(e={}){let t=n(e);return Object.keys(t).length===0?[]:["--settings",JSON.stringify(t)]}var p={Main:"main",Plan:"plan",Task:"task",Compact:"compact",Title:"title",Suggestion:"suggestion",Generate:"generate",HookPrompt:"hook_prompt",Subagent:"subagent",WebFetch:"web_fetch",ImageGen:"image_gen",Compression:"compression",Utility:"utility"};export{p as QoderModelPurpose,r as WIRE_PROTOCOL_VERSION,n as buildQoderCliFlagSettings,l as buildQoderCliFlagSettingsArgs};
|
|
@@ -17,6 +17,8 @@ export type SDKAssistantMessage = {
|
|
|
17
17
|
type: 'assistant';
|
|
18
18
|
message: BetaMessage;
|
|
19
19
|
parent_tool_use_id: string | null;
|
|
20
|
+
/** Qoder model request ID, present only when explicitly enabled in the CLI. */
|
|
21
|
+
request_id?: string;
|
|
20
22
|
error?: SDKAssistantMessageError;
|
|
21
23
|
/**
|
|
22
24
|
* Present when an interrupt truncated the model stream before a stop reason
|
|
@@ -81,6 +83,8 @@ export type SDKResultSuccess = {
|
|
|
81
83
|
result: string;
|
|
82
84
|
stop_reason: string | null;
|
|
83
85
|
total_cost_usd: number;
|
|
86
|
+
/** Session-cumulative Qoder credits. Added by newer CLI versions. */
|
|
87
|
+
total_credits?: number;
|
|
84
88
|
usage: NonNullableUsage;
|
|
85
89
|
modelUsage: Record<string, ModelUsage>;
|
|
86
90
|
permission_denials: SDKPermissionDenial[];
|
|
@@ -100,6 +104,8 @@ export type SDKResultError = {
|
|
|
100
104
|
num_turns: number;
|
|
101
105
|
stop_reason: string | null;
|
|
102
106
|
total_cost_usd: number;
|
|
107
|
+
/** Session-cumulative Qoder credits. Added by newer CLI versions. */
|
|
108
|
+
total_credits?: number;
|
|
103
109
|
usage: NonNullableUsage;
|
|
104
110
|
modelUsage: Record<string, ModelUsage>;
|
|
105
111
|
permission_denials: SDKPermissionDenial[];
|
|
@@ -25,7 +25,7 @@ import type { ModelPromptPatches } from '../protocol/model-prompt-patches.js';
|
|
|
25
25
|
import type { Transport } from '../core/transport.js';
|
|
26
26
|
import type { SDKMessage, SDKUserMessage } from '../types/messages.js';
|
|
27
27
|
import type { InternalQuery, OnElicitation } from '../types/options.js';
|
|
28
|
-
import type { FetchJobToken } from '../types/auth.js';
|
|
28
|
+
import type { FetchJobToken, FetchServiceAccountToken } from '../types/auth.js';
|
|
29
29
|
import type { SDKControlInterruptResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse } from '../types/control.js';
|
|
30
30
|
import type { PermissionMode, CanUseTool } from '../types/permissions.js';
|
|
31
31
|
import type { HookCallbackMatcher } from '../types/hooks.js';
|
|
@@ -71,6 +71,7 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
71
71
|
private readonly onElicitation?;
|
|
72
72
|
private readonly onAuthExpired?;
|
|
73
73
|
private readonly fetchJobToken?;
|
|
74
|
+
private readonly fetchServiceAccountToken?;
|
|
74
75
|
private readonly diagnostics?;
|
|
75
76
|
private readonly controlRequestTimeoutMs;
|
|
76
77
|
private readonly resolveModel?;
|
|
@@ -85,7 +86,7 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
85
86
|
private protocolHandshakeValidated;
|
|
86
87
|
private firstResultReceived;
|
|
87
88
|
private firstResultReceivedResolve?;
|
|
88
|
-
constructor(transport: Transport, isSingleTurn: boolean, canUseTool?: CanUseTool, hooks?: Partial<Record<InternalHookEvent, HookCallbackMatcher[]>>, abortController?: AbortController, sdkMcpServers?: Map<string, McpServer>, initConfig?: InitConfig, onElicitation?: OnElicitation, diagnostics?: DiagnosticsSink, onAuthExpired?: () => void, controlRequestTimeoutMs?: number, sdkMcpTransports?: Map<string, SdkMcpTransport>, pendingMcpResponses?: Map<string, PendingMcpResponse>, fetchJobToken?: FetchJobToken, resolveModel?: ModelPolicyProvider, resolveModelTimeoutMs?: number, sessionStore?: SessionStore, sessionStoreFlush?: SessionStoreFlush, sdkMcpToolOverrides?: Record<string, Record<string, McpToolRuntimeOverride
|
|
89
|
+
constructor(transport: Transport, isSingleTurn: boolean, canUseTool?: CanUseTool, hooks?: Partial<Record<InternalHookEvent, HookCallbackMatcher[]>>, abortController?: AbortController, sdkMcpServers?: Map<string, McpServer>, initConfig?: InitConfig, onElicitation?: OnElicitation, diagnostics?: DiagnosticsSink, onAuthExpired?: () => void, controlRequestTimeoutMs?: number, sdkMcpTransports?: Map<string, SdkMcpTransport>, pendingMcpResponses?: Map<string, PendingMcpResponse>, fetchJobToken?: FetchJobToken, resolveModel?: ModelPolicyProvider, resolveModelTimeoutMs?: number, sessionStore?: SessionStore, sessionStoreFlush?: SessionStoreFlush, sdkMcpToolOverrides?: Record<string, Record<string, McpToolRuntimeOverride>>, fetchServiceAccountToken?: FetchServiceAccountToken);
|
|
89
90
|
private getRecord;
|
|
90
91
|
private normalizeLogPreview;
|
|
91
92
|
private extractMessagePreview;
|
|
@@ -107,6 +108,7 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
107
108
|
* this method finishes and signals the consumer queue.
|
|
108
109
|
*/
|
|
109
110
|
private readMessages;
|
|
111
|
+
private notifyAuthExpiredIfNeeded;
|
|
110
112
|
/**
|
|
111
113
|
* Send a control request to the CLI and wait for the response.
|
|
112
114
|
*
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"
|
|
3
|
+
"brand": "global",
|
|
4
|
+
"sdkVersion": "1.0.19",
|
|
5
|
+
"qoderCliVersion": "1.1.16",
|
|
6
|
+
"defaultTransport": "worker",
|
|
4
7
|
"workerRuntime": {
|
|
5
8
|
"packaged": false,
|
|
6
|
-
"delivery": "
|
|
9
|
+
"delivery": "install",
|
|
10
|
+
"source": "qodercli-worker-runtime",
|
|
11
|
+
"url": "https://download.qoder.com/qodercli/releases/1.1.16/qodercli-worker-runtime-universal.tgz",
|
|
12
|
+
"artifactName": "qodercli-worker-runtime-universal.tgz",
|
|
13
|
+
"sdkVersion": "1.0.19",
|
|
14
|
+
"qoderCliVersion": "1.1.16"
|
|
7
15
|
}
|
|
8
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const BRAND_CONFIG_DIR_INTERNAL
|
|
2
|
-
export declare const ENV_HOME
|
|
3
|
-
export declare const ENV_CONFIG_DIR
|
|
1
|
+
export declare const BRAND_CONFIG_DIR_INTERNAL: string;
|
|
2
|
+
export declare const ENV_HOME: string;
|
|
3
|
+
export declare const ENV_CONFIG_DIR: string;
|
|
4
4
|
export declare const MAX_SANITIZED_LENGTH = 200;
|
|
5
5
|
export declare function homedir(): string;
|
|
6
6
|
/**
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -9,12 +9,31 @@
|
|
|
9
9
|
export type AccessTokenInput = string | {
|
|
10
10
|
envVar: string;
|
|
11
11
|
};
|
|
12
|
+
export type ServiceAccountKeyInput = string | {
|
|
13
|
+
envVar: string;
|
|
14
|
+
};
|
|
15
|
+
export type ServiceAccountTokenResult = {
|
|
16
|
+
token: string;
|
|
17
|
+
/** Absolute expiration time as a Unix timestamp in milliseconds. */
|
|
18
|
+
expiresAt?: number;
|
|
19
|
+
};
|
|
20
|
+
export type FetchServiceAccountToken = () => Promise<ServiceAccountTokenResult | null>;
|
|
21
|
+
export type ServiceAccountCredentials = {
|
|
22
|
+
serviceAccountKey: ServiceAccountKeyInput;
|
|
23
|
+
fetchServiceAccountToken?: never;
|
|
24
|
+
} | {
|
|
25
|
+
serviceAccountKey?: never;
|
|
26
|
+
fetchServiceAccountToken: FetchServiceAccountToken;
|
|
27
|
+
};
|
|
28
|
+
export type ServiceAccountAuthOptions = {
|
|
29
|
+
type: 'serviceAccount';
|
|
30
|
+
} & ServiceAccountCredentials;
|
|
12
31
|
export type AuthOptions = {
|
|
13
32
|
type: 'accessToken';
|
|
14
33
|
accessToken: AccessTokenInput;
|
|
15
34
|
} | {
|
|
16
35
|
type: 'qodercli';
|
|
17
|
-
};
|
|
36
|
+
} | ServiceAccountAuthOptions;
|
|
18
37
|
export type JobTokenRequest = {
|
|
19
38
|
requestId: string;
|
|
20
39
|
reason: 'initial' | 'unauthorized';
|
|
@@ -47,5 +66,11 @@ export type SdkAuthPayload = {
|
|
|
47
66
|
type: 'qodercli';
|
|
48
67
|
} | {
|
|
49
68
|
type: 'jobToken';
|
|
50
|
-
|
|
69
|
+
jobTokenProvider: 'host';
|
|
70
|
+
} | {
|
|
71
|
+
type: 'serviceAccount';
|
|
72
|
+
serviceAccountKey: string;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'serviceAccount';
|
|
75
|
+
serviceAccountTokenProvider: 'host';
|
|
51
76
|
};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* shim so existing SDK consumer imports (`'./types/common.js'` paths)
|
|
6
6
|
* keep working.
|
|
7
7
|
*/
|
|
8
|
-
export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from '../protocol/index.js';
|
|
8
|
+
export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, SessionCreditsUsage, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from '../protocol/index.js';
|
package/dist/types/control.d.ts
CHANGED
|
@@ -15,4 +15,16 @@ export type FetchJobTokenWireRequest = {
|
|
|
15
15
|
/** Wire format for fetch_job_token success response. */
|
|
16
16
|
export type FetchJobTokenWireResponse = {
|
|
17
17
|
token: string;
|
|
18
|
+
};
|
|
19
|
+
/** Wire format for Service Account token requests sent by qodercli. */
|
|
20
|
+
export type FetchServiceAccountTokenWireRequest = {
|
|
21
|
+
subtype: 'fetch_service_account_token';
|
|
22
|
+
reason: 'initial' | 'expiring' | 'unauthorized';
|
|
23
|
+
required_scopes: string[];
|
|
24
|
+
session_id?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Wire format for successful Service Account token responses. */
|
|
27
|
+
export type FetchServiceAccountTokenWireResponse = {
|
|
28
|
+
token: string;
|
|
29
|
+
expires_at?: number;
|
|
18
30
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export * from './cloud-agent.js';
|
|
|
21
21
|
export * from './control.js';
|
|
22
22
|
export * from './model-policy-provider.js';
|
|
23
23
|
export * from './tools.js';
|
|
24
|
-
export type { AccessTokenInput, AuthOptions, FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResult, } from './auth.js';
|
|
24
|
+
export type { AccessTokenInput, AuthOptions, FetchServiceAccountToken, FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResult, ServiceAccountAuthOptions, ServiceAccountCredentials, ServiceAccountKeyInput, ServiceAccountTokenResult, } from './auth.js';
|
package/dist/types/options.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export type Options = {
|
|
|
66
66
|
* Prefer the `accessTokenFromEnv()` helper in host code.
|
|
67
67
|
* - `{ type: 'qodercli' }` - Read-only reuse of local `qodercli login`
|
|
68
68
|
* state. Prefer the `qodercliAuth()` helper in host code.
|
|
69
|
+
* - `{ type: 'serviceAccount', serviceAccountKey }` - Exchange a Service
|
|
70
|
+
* Account key for short-lived model access. Prefer `serviceAccount()` or
|
|
71
|
+
* `serviceAccountFromEnv()`.
|
|
72
|
+
* - `{ type: 'serviceAccount', fetchServiceAccountToken }` - Let the host
|
|
73
|
+
* supply and refresh short-lived Service Account tokens through
|
|
74
|
+
* `serviceAccount()`.
|
|
69
75
|
* - `{ type: 'jobToken', fetchJobToken }` - Internal first-party host
|
|
70
76
|
* integration. Prefer the `jobToken(fetchJobToken)` helper in host code.
|
|
71
77
|
*
|
|
@@ -83,7 +89,7 @@ export type Options = {
|
|
|
83
89
|
/**
|
|
84
90
|
* Selects the local query transport.
|
|
85
91
|
*
|
|
86
|
-
* - omitted: use
|
|
92
|
+
* - omitted: use the transport baked into the installed SDK package.
|
|
87
93
|
* - `ProcessTransport.default`: spawn qodercli as a child process.
|
|
88
94
|
* - `WorkerTransport.default`: run qoder-worker-runtime in a Node worker thread.
|
|
89
95
|
* - `new WorkerTransport({ ... })`: run worker runtime with provider options.
|
|
@@ -167,6 +173,13 @@ export type Options = {
|
|
|
167
173
|
mcpServers?: Record<string, McpServerConfig>;
|
|
168
174
|
allowedMcpServerNames?: string[];
|
|
169
175
|
model?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Path to a local Qoder runtime.
|
|
178
|
+
*
|
|
179
|
+
* Native binaries and ordinary JavaScript CLI entries use ProcessTransport.
|
|
180
|
+
* Recognized `qoder-worker-runtime*.mjs` entries use WorkerTransport. An
|
|
181
|
+
* explicit `transport` provider takes precedence over this automatic choice.
|
|
182
|
+
*/
|
|
170
183
|
pathToQoderCLIExecutable?: string;
|
|
171
184
|
permissionMode?: PermissionMode;
|
|
172
185
|
allowDangerouslySkipPermissions?: boolean;
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -190,6 +190,62 @@ export type TaskStopOutput = {
|
|
|
190
190
|
task_id: string;
|
|
191
191
|
error?: string;
|
|
192
192
|
};
|
|
193
|
+
export type TaskCreateInput = {
|
|
194
|
+
subject: string;
|
|
195
|
+
description: string;
|
|
196
|
+
activeForm?: string;
|
|
197
|
+
metadata?: Record<string, unknown>;
|
|
198
|
+
};
|
|
199
|
+
export type TaskCreateOutput = {
|
|
200
|
+
task: {
|
|
201
|
+
id: string;
|
|
202
|
+
subject: string;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
export type TaskGetInput = {
|
|
206
|
+
taskId: string;
|
|
207
|
+
};
|
|
208
|
+
export type TaskGetOutput = {
|
|
209
|
+
task: {
|
|
210
|
+
id: string;
|
|
211
|
+
subject: string;
|
|
212
|
+
description: string;
|
|
213
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
214
|
+
blocks: string[];
|
|
215
|
+
blockedBy: string[];
|
|
216
|
+
} | null;
|
|
217
|
+
};
|
|
218
|
+
export type TaskUpdateInput = {
|
|
219
|
+
taskId: string;
|
|
220
|
+
subject?: string;
|
|
221
|
+
description?: string;
|
|
222
|
+
activeForm?: string;
|
|
223
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'deleted';
|
|
224
|
+
addBlocks?: string[];
|
|
225
|
+
addBlockedBy?: string[];
|
|
226
|
+
owner?: string;
|
|
227
|
+
metadata?: Record<string, unknown>;
|
|
228
|
+
};
|
|
229
|
+
export type TaskUpdateOutput = {
|
|
230
|
+
success: boolean;
|
|
231
|
+
taskId: string;
|
|
232
|
+
updatedFields: string[];
|
|
233
|
+
error?: string;
|
|
234
|
+
statusChange?: {
|
|
235
|
+
from: string;
|
|
236
|
+
to: string;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export type TaskListInput = Record<string, never>;
|
|
240
|
+
export type TaskListOutput = {
|
|
241
|
+
tasks: Array<{
|
|
242
|
+
id: string;
|
|
243
|
+
subject: string;
|
|
244
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
245
|
+
owner?: string;
|
|
246
|
+
blockedBy: string[];
|
|
247
|
+
}>;
|
|
248
|
+
};
|
|
193
249
|
export type ExitPlanModeInput = {
|
|
194
250
|
confirm?: boolean;
|
|
195
251
|
};
|
|
@@ -271,5 +327,5 @@ export type McpOutput = {
|
|
|
271
327
|
content: unknown;
|
|
272
328
|
isError?: boolean;
|
|
273
329
|
};
|
|
274
|
-
export type ToolInputSchemas = AgentInput | BashInput | FileReadInput | FileEditInput | FileWriteInput | GlobInput | GrepInput | WebFetchInput | WebSearchInput | AskUserQuestionInput | NotebookEditInput | TaskOutputInput | TaskStopInput | ExitPlanModeInput | ConfigInput | EnterWorktreeInput | ExitWorktreeInput | TodoWriteInput | ListMcpResourcesInput | ReadMcpResourceInput | McpInput;
|
|
275
|
-
export type ToolOutputSchemas = AgentOutput | BashOutput | FileReadOutput | FileEditOutput | FileWriteOutput | GlobOutput | GrepOutput | WebFetchOutput | WebSearchOutput | AskUserQuestionOutput | NotebookEditOutput | TaskStopOutput | ExitPlanModeOutput | ConfigOutput | EnterWorktreeOutput | ExitWorktreeOutput | TodoWriteOutput | ListMcpResourcesOutput | McpOutput;
|
|
330
|
+
export type ToolInputSchemas = AgentInput | BashInput | FileReadInput | FileEditInput | FileWriteInput | GlobInput | GrepInput | WebFetchInput | WebSearchInput | AskUserQuestionInput | NotebookEditInput | TaskOutputInput | TaskStopInput | TaskCreateInput | TaskGetInput | TaskUpdateInput | TaskListInput | ExitPlanModeInput | ConfigInput | EnterWorktreeInput | ExitWorktreeInput | TodoWriteInput | ListMcpResourcesInput | ReadMcpResourceInput | McpInput;
|
|
331
|
+
export type ToolOutputSchemas = AgentOutput | BashOutput | FileReadOutput | FileEditOutput | FileWriteOutput | GlobOutput | GrepOutput | WebFetchOutput | WebSearchOutput | AskUserQuestionOutput | NotebookEditOutput | TaskStopOutput | TaskCreateOutput | TaskGetOutput | TaskUpdateOutput | TaskListOutput | ExitPlanModeOutput | ConfigOutput | EnterWorktreeOutput | ExitWorktreeOutput | TodoWriteOutput | ListMcpResourcesOutput | McpOutput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qoder-agent-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "TypeScript SDK for building Qoder-powered coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,53 +34,7 @@
|
|
|
34
34
|
"node": ">=18.0.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"
|
|
38
|
-
"watch": "tsc --watch",
|
|
39
|
-
"clean": "rm -rf dist",
|
|
40
|
-
"bundle": "npm run clean && tsc && node scripts/bundle.mjs",
|
|
41
|
-
"bundle:worker": "npm run clean && tsc && node scripts/bundle.mjs --runtime-transport=worker --require-worker-runtime",
|
|
42
|
-
"build:obfuscated": "npm run bundle",
|
|
43
|
-
"check:package-version": "node scripts/check-package-version.mjs",
|
|
44
|
-
"hooks:install": "sh scripts/install-git-hooks.sh",
|
|
45
|
-
"release:check": "bash scripts/release-npm.sh check",
|
|
46
|
-
"release:beta": "bash scripts/release-npm.sh beta",
|
|
47
|
-
"release:latest": "bash scripts/release-npm.sh latest",
|
|
48
|
-
"release:promote": "bash scripts/release-npm.sh promote",
|
|
49
|
-
"prepublishOnly": "npm run bundle",
|
|
50
|
-
"postinstall": "node scripts/postinstall.cjs",
|
|
51
|
-
"demo:minimal": "npm run demo:chat",
|
|
52
|
-
"demo:image": "node examples/image-input-demo/demo.mjs",
|
|
53
|
-
"demo:models": "npm run build && node examples/list-models-demo/demo.mjs",
|
|
54
|
-
"demo:usage": "npm run build && node examples/usage-info-demo/demo.mjs",
|
|
55
|
-
"demo:steer-control": "npm run build && node examples/steer-control-demo/demo.mjs",
|
|
56
|
-
"demo:chat": "npm run build && node examples/interactive-chat-demo/demo.mjs",
|
|
57
|
-
"demo:mcp-oauth": "npm run build && node examples/mcp-oauth-demo/demo.mjs",
|
|
58
|
-
"demo:inprocess-mcp": "npm run build && node examples/inprocess-mcp-demo/demo.mjs",
|
|
59
|
-
"demo:byok": "npm run build && node examples/byok-validation-demo/demo.mjs",
|
|
60
|
-
"test": "npm run test:unit",
|
|
61
|
-
"test:unit": "npm run build && node --test tests/*.test.mjs",
|
|
62
|
-
"test:query-session-control:unit": "npm run build && node --test tests/query-session-control/unit/*.test.mjs",
|
|
63
|
-
"test:query-session-control:functional": "npm run build && node --test tests/query-session-control/functional/*.test.mjs",
|
|
64
|
-
"test:query-input-output:unit": "npm run build && node --test tests/query-input-output/unit/*.test.mjs",
|
|
65
|
-
"test:query-input-output:functional": "npm run build && node --test tests/query-input-output/functional/*.test.mjs",
|
|
66
|
-
"test:query-auth": "npm run test:query-auth:unit && npm run test:query-auth:functional",
|
|
67
|
-
"test:query-auth:unit": "npm run build && node --test tests/query-auth/unit/*.test.mjs",
|
|
68
|
-
"test:query-auth:functional": "npm run build && node --test tests/query-auth/functional/*.test.mjs",
|
|
69
|
-
"test:query-auth:e2e": "npm run test:query-auth:functional",
|
|
70
|
-
"test:query-system-prompt:unit": "npm run build && node --test tests/query-system-prompt/unit/*.test.mjs",
|
|
71
|
-
"test:query-system-prompt:functional": "npm run build && node --test tests/query-system-prompt/functional/*.test.mjs",
|
|
72
|
-
"test:query-mcp:functional": "npm run build && node --test tests/query-mcp/functional/*.test.mjs",
|
|
73
|
-
"test:query-output-events:unit": "npm run build && node --test tests/query-output-events/unit/*.test.mjs",
|
|
74
|
-
"test:query-output-events:functional": "npm run build && node --test tests/query-output-events/functional/*.test.mjs",
|
|
75
|
-
"test:query-working-directory:functional": "npm run build && node --test tests/query-working-directory/functional/*.test.mjs",
|
|
76
|
-
"test:query-runtime-control:unit": "npm run build && node --test tests/query-runtime-control/unit/*.test.mjs",
|
|
77
|
-
"test:query-runtime-control:functional": "npm run build && node --test tests/query-runtime-control/functional/*.test.mjs",
|
|
78
|
-
"test:worker-runtime:functional": "npm run build && node --test tests/worker-runtime/functional/*.test.mjs",
|
|
79
|
-
"test:skills-loading-control:unit": "npm run build && node --test tests/skills-loading-control/unit/*.test.mjs",
|
|
80
|
-
"test:skills-loading-control:functional": "npm run build && node --test tests/skills-loading-control/functional/*.test.mjs",
|
|
81
|
-
"test:plugins-loading-control:unit": "npm run build && node --test tests/plugins-loading-control/unit/*.test.mjs",
|
|
82
|
-
"test:plugins-loading-control:functional": "npm run build && node --test tests/plugins-loading-control/functional/*.test.mjs",
|
|
83
|
-
"test:integration": "npm run build && node --test tests/integration/**/*.test.mjs"
|
|
37
|
+
"postinstall": "node scripts/postinstall.cjs"
|
|
84
38
|
},
|
|
85
39
|
"keywords": [
|
|
86
40
|
"qoder",
|
|
@@ -96,12 +50,7 @@
|
|
|
96
50
|
"peerDependencies": {
|
|
97
51
|
"zod": "^3.25.0 || ^4.0.0"
|
|
98
52
|
},
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
"esbuild": "^0.24.2",
|
|
102
|
-
"typescript": "^5.7.0",
|
|
103
|
-
"zod": "^4.0.0"
|
|
104
|
-
},
|
|
105
|
-
"qoderCliVersion": "1.1.7",
|
|
53
|
+
"qoderCliVersion": "1.1.16",
|
|
54
|
+
"qoderSdkBrand": "global",
|
|
106
55
|
"license": "SEE LICENSE IN LICENSE"
|
|
107
56
|
}
|