@qoder-ai/qoder-agent-sdk 1.0.17 → 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 +17 -20
- package/dist/auth.d.ts +2 -2
- package/dist/core/brand.d.ts +22 -0
- package/dist/core/constants.d.ts +11 -6
- package/dist/core/runtime-launch-options.d.ts +1 -0
- package/dist/core/runtime-selection.d.ts +24 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -26
- package/dist/protocol/hooks.d.ts +2 -1
- package/dist/protocol/messages.d.ts +2 -0
- package/dist/runtime-manifest.json +10 -2
- package/dist/session/transcript-paths.d.ts +3 -3
- package/dist/types/options.d.ts +8 -1
- package/dist/types/tools.d.ts +58 -2
- package/package.json +4 -56
- package/scripts/postinstall.cjs +127 -135
package/README.md
CHANGED
|
@@ -23,16 +23,10 @@ installed if your application uses SDK tools or MCP integration.
|
|
|
23
23
|
|
|
24
24
|
## Runtime Behavior
|
|
25
25
|
|
|
26
|
-
The
|
|
27
|
-
`
|
|
28
|
-
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
Packages built with the Worker runtime bundle bake that choice into the SDK:
|
|
32
|
-
their default `query()` transport is `WorkerTransport.default`, and install
|
|
33
|
-
does not download the process CLI unless `QODER_INSTALL_BUNDLED_CLI=1` is set.
|
|
34
|
-
Worker runtime assets can either be packaged into the tarball or downloaded by
|
|
35
|
-
postinstall, depending on the release pipeline.
|
|
26
|
+
The npm package uses `WorkerTransport.default` for `query()` by default. During
|
|
27
|
+
`npm install`, its postinstall script downloads the Worker runtime selected by
|
|
28
|
+
the package's pinned CLI version into `dist/_worker`. It does not download the
|
|
29
|
+
process CLI unless `QODER_INSTALL_BUNDLED_CLI=1` is set.
|
|
36
30
|
|
|
37
31
|
You can still select a transport explicitly on the same `query()` entry:
|
|
38
32
|
|
|
@@ -52,17 +46,15 @@ const q = query({
|
|
|
52
46
|
});
|
|
53
47
|
```
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
worker
|
|
49
|
+
The worker transport uses the runtime installed at
|
|
50
|
+
`dist/_worker/qoder-worker-runtime.obf.mjs`. You can instead set
|
|
57
51
|
`QODER_WORKER_RUNTIME_PATH` or pass
|
|
58
52
|
`new WorkerTransport({ pathToQoderWorkerRuntime })`.
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
copy of the archive. The presence of `dist/_worker` is used as an integrity
|
|
65
|
-
check after installation, not as the mode selector.
|
|
54
|
+
The package includes a `dist/runtime-manifest.json` that records the default
|
|
55
|
+
runtime and pins the qodercli Worker runtime archive URL. The SDK package itself
|
|
56
|
+
does not need to host a copy of the archive. The presence of `dist/_worker` is
|
|
57
|
+
used as an integrity check after installation, not as the mode selector.
|
|
66
58
|
|
|
67
59
|
The packaged Worker runtime is built as a self-contained universal profile by
|
|
68
60
|
default. Runtime assets such as native keychain bindings, PTY bindings, image
|
|
@@ -86,11 +78,16 @@ export QODERCLI_PATH=/absolute/path/to/qodercli
|
|
|
86
78
|
export QODER_WORKER_RUNTIME_PATH=/absolute/path/to/qoder-worker-runtime.obf.mjs
|
|
87
79
|
```
|
|
88
80
|
|
|
89
|
-
`query()` is the only query entry point
|
|
90
|
-
|
|
81
|
+
`query()` is the only query entry point and defaults to Worker. Pass
|
|
82
|
+
`transport: ProcessTransport.default`,
|
|
91
83
|
`transport: WorkerTransport.default`, or a custom transport provider when a
|
|
92
84
|
single call needs to override the package default.
|
|
93
85
|
|
|
86
|
+
`pathToQoderCLIExecutable` accepts either local runtime form. Native binaries
|
|
87
|
+
and ordinary CLI `.js`/`.mjs` entries use the process transport; recognized
|
|
88
|
+
`qoder-worker-runtime*.mjs` entries use the Worker transport. An explicit
|
|
89
|
+
`transport` provider always takes precedence over automatic path selection.
|
|
90
|
+
|
|
94
91
|
## Authentication
|
|
95
92
|
|
|
96
93
|
Every SDK query needs an explicit authentication option.
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthOptions, FetchJobToken, JobTokenAuthOptions, ServiceAccountAuthOptions, ServiceAccountCredentials } from './types/auth.js';
|
|
2
|
-
export declare const DEFAULT_ACCESS_TOKEN_ENV_VAR
|
|
3
|
-
export declare const DEFAULT_SERVICE_ACCOUNT_ENV_VAR
|
|
2
|
+
export declare const DEFAULT_ACCESS_TOKEN_ENV_VAR: string;
|
|
3
|
+
export declare const DEFAULT_SERVICE_ACCOUNT_ENV_VAR: string;
|
|
4
4
|
export declare function accessToken(token: string): AuthOptions;
|
|
5
5
|
export declare function accessTokenFromEnv(envVar?: string): AuthOptions;
|
|
6
6
|
export declare function qodercliAuth(): AuthOptions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type SdkBrand = 'global' | 'cn';
|
|
2
|
+
export declare const SDK_BRAND: SdkBrand;
|
|
3
|
+
export declare const IS_CN_SDK: boolean;
|
|
4
|
+
export declare const SDK_BRAND_CONFIG: {
|
|
5
|
+
productName: string;
|
|
6
|
+
packageName: string;
|
|
7
|
+
cliCommands: readonly ["qoderclicn", "qodercn"];
|
|
8
|
+
configDirName: string;
|
|
9
|
+
configDirEnv: string;
|
|
10
|
+
cliHomeEnv: string;
|
|
11
|
+
accessTokenEnv: string;
|
|
12
|
+
serviceAccountEnv: string;
|
|
13
|
+
} | {
|
|
14
|
+
productName: string;
|
|
15
|
+
packageName: string;
|
|
16
|
+
cliCommands: readonly ["qodercli", "qoder"];
|
|
17
|
+
configDirName: string;
|
|
18
|
+
configDirEnv: string;
|
|
19
|
+
cliHomeEnv: string;
|
|
20
|
+
accessTokenEnv: string;
|
|
21
|
+
serviceAccountEnv: string;
|
|
22
|
+
};
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -21,10 +21,7 @@ export declare const CLOSE_GRACE_MS = 2000;
|
|
|
21
21
|
* If the process hasn't exited after SIGTERM within this window, force-kill it.
|
|
22
22
|
*/
|
|
23
23
|
export declare const KILL_GRACE_MS = 5000;
|
|
24
|
-
|
|
25
|
-
* Current SDK version, sent to CLI as QODER_AGENT_SDK_VERSION environment variable.
|
|
26
|
-
*/
|
|
27
|
-
export declare const SDK_VERSION = "1.0.16";
|
|
24
|
+
export declare const SDK_VERSION: string;
|
|
28
25
|
/**
|
|
29
26
|
* Value for the `--permission-prompt-tool` CLI flag.
|
|
30
27
|
*
|
|
@@ -44,10 +41,18 @@ export declare const CLI_EXIT_CODE_AUTH_ERROR = 41;
|
|
|
44
41
|
*
|
|
45
42
|
* Keep this list explicit so new qodercli built-ins do not automatically
|
|
46
43
|
* become SDK-visible. Goal, cron, workflow, plan-mode transition, Bash PTY,
|
|
47
|
-
* worktree,
|
|
44
|
+
* worktree, topic, and background-task control tools remain opt-in via
|
|
48
45
|
* `options.tools`.
|
|
49
46
|
*/
|
|
50
|
-
export declare const SDK_DEFAULT_TOOLS: readonly ["Agent", "AskUserQuestion", "Bash", "Edit", "Glob", "Grep", "ImageGen", "ImageSearch", "NotebookEdit", "Read", "Skill", "
|
|
47
|
+
export declare const SDK_DEFAULT_TOOLS: readonly ["Agent", "AskUserQuestion", "Bash", "Edit", "Glob", "Grep", "ImageGen", "ImageSearch", "NotebookEdit", "Read", "Skill", "TaskCreate", "TaskGet", "TaskUpdate", "TaskList", "WebFetch", "WebSearch", "Write"];
|
|
48
|
+
export declare const SDK_TASK_TOOLS: readonly ["TaskCreate", "TaskGet", "TaskUpdate", "TaskList"];
|
|
49
|
+
/**
|
|
50
|
+
* Resolve the SDK's curated default tool surface against qodercli's Task
|
|
51
|
+
* feature flag. qodercli replaces the persistent Task tools with TodoWrite
|
|
52
|
+
* when QODER_FEATURE_TASKS is explicitly disabled, so the SDK must make the
|
|
53
|
+
* same replacement before it writes its explicit --tools allowlist.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveSdkDefaultTools(env: Record<string, string | undefined>): string[];
|
|
51
56
|
/**
|
|
52
57
|
* Tool names with SDK-side enrichment. Tracked as constants so callers and
|
|
53
58
|
* the runner agree on the exact string the CLI emits.
|
|
@@ -61,6 +61,7 @@ export interface RuntimeLaunchConfig {
|
|
|
61
61
|
}
|
|
62
62
|
export declare function isScriptFile(filePath: string): boolean;
|
|
63
63
|
export declare function resolveDefaultCliPath(): string;
|
|
64
|
+
export declare function resolveUserInstalledCliPath(): string | null;
|
|
64
65
|
export declare class RuntimeLaunchOptionsBuilder {
|
|
65
66
|
private readonly options;
|
|
66
67
|
private readonly diagnostics?;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DefaultRuntimeTransport } from './default-runtime.js';
|
|
2
|
+
export interface ImplicitRuntimeOptions {
|
|
3
|
+
pathToQoderCLIExecutable?: string;
|
|
4
|
+
executable?: string;
|
|
5
|
+
executableArgs?: readonly string[];
|
|
6
|
+
spawnQoderCLIProcess?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export type ImplicitRuntimeSelection = {
|
|
9
|
+
transport: 'process';
|
|
10
|
+
} | {
|
|
11
|
+
transport: 'worker';
|
|
12
|
+
pathToQoderWorkerRuntime?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Distinguish a Qoder Worker entry from a CLI native binary or script entry.
|
|
16
|
+
* Unrecognized JavaScript paths remain process CLI entries for compatibility.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isQoderWorkerRuntimePath(candidate: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Select the local runtime when the caller has not supplied an explicit
|
|
21
|
+
* transport provider. Explicit paths and process-only launch options override
|
|
22
|
+
* the transport baked into the SDK package.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveImplicitRuntimeSelection(options: ImplicitRuntimeOptions, packageDefault: DefaultRuntimeTransport, environment?: NodeJS.ProcessEnv): ImplicitRuntimeSelection;
|
package/dist/index.d.ts
CHANGED
|
@@ -103,5 +103,5 @@ export type { QoderModelPurpose } from './types/control.js';
|
|
|
103
103
|
export type { SDKControlRequest, SDKControlResponse, SDKControlInterruptResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse, } from './types/control.js';
|
|
104
104
|
export type { SDKControlGetModelPolicyRequest, SDKControlGetModelPolicyResponse, SDKCapabilities, ModelPolicyContext, ModelPolicyResult, ModelPolicyProvider, } from './types/model-policy-provider.js';
|
|
105
105
|
export type { SDKControlGetByokConfigRequest, SDKControlGetByokConfigResponse, SDKControlValidateByokModelRequest, SDKControlValidateByokModelResponse, BYOKModelValidationInput, BYOKProviderInfo, BYOKModelTypeInfo, BYOKModelInfo, CustomModel, } from './types/byok.js';
|
|
106
|
-
export type { AgentInput, AgentOutput, BashInput, FileReadInput, FileReadOutput, FileEditInput, FileWriteInput, GlobInput, GrepInput, WebFetchInput, WebSearchInput, AskUserQuestionInput, NotebookEditInput, ExitPlanModeInput, TodoWriteInput, ToolInputSchemas, ToolOutputSchemas, } from './types/tools.js';
|
|
106
|
+
export type { AgentInput, AgentOutput, BashInput, FileReadInput, FileReadOutput, FileEditInput, FileWriteInput, GlobInput, GrepInput, WebFetchInput, WebSearchInput, AskUserQuestionInput, NotebookEditInput, TaskCreateInput, TaskCreateOutput, TaskGetInput, TaskGetOutput, TaskUpdateInput, TaskUpdateOutput, TaskListInput, TaskListOutput, ExitPlanModeInput, TodoWriteInput, ToolInputSchemas, ToolOutputSchemas, } from './types/tools.js';
|
|
107
107
|
export type { FeedbackResult } from './types/account.js';
|