@toddzheng024/dscode-bundle 0.4.0 → 0.6.0

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.
Files changed (93) hide show
  1. package/THIRD_PARTY_NOTICES.md +15 -0
  2. package/cordis.patch.yml +3 -3
  3. package/package.json +7 -1
  4. package/plugins/clipboard-image/clipboard-image.swift +56 -0
  5. package/plugins/clipboard-image/index.mjs +70 -0
  6. package/plugins/code-review/git.mjs +95 -0
  7. package/plugins/code-review/index.mjs +88 -0
  8. package/plugins/dscode/index.mjs +57 -5
  9. package/plugins/email-tools/index.mjs +2 -2
  10. package/plugins/exec/index.mjs +107 -0
  11. package/plugins/session-metrics/index.mjs +6 -2
  12. package/plugins/session-metrics/rate.mjs +62 -0
  13. package/plugins/session-metrics/view.mjs +15 -9
  14. package/plugins/tui-tools/doctor-cli.mjs +22 -0
  15. package/plugins/tui-tools/doctor.mjs +141 -0
  16. package/plugins/tui-tools/index.mjs +14 -6
  17. package/plugins/ultra/policy.mjs +13 -2
  18. package/plugins/worktree-subagent/worktree.mjs +50 -0
  19. package/presets/dscode/agent.cordis.yml +14 -3
  20. package/vendor/deepseek/index.js +12 -2
  21. package/vendor/subagent/index.js +39 -12
  22. package/vendor/subagent-core/LICENSE +21 -0
  23. package/vendor/subagent-core/index.js +3232 -0
  24. package/vendor/subagent-core/invariant.js +76 -0
  25. package/vendor/subagent-core/typert.host.d.ts +3 -0
  26. package/vendor/subagent-core/typert.host.js +964 -0
  27. package/vendor/subagent-core/typert.remote-client.d.ts +27 -0
  28. package/vendor/subagent-core/typert.remote-client.js +160 -0
  29. package/vendor/subagent-core/types/assistant-output.d.ts +48 -0
  30. package/vendor/subagent-core/types/assistant-output.js +73 -0
  31. package/vendor/subagent-core/types/catalog.d.ts +77 -0
  32. package/vendor/subagent-core/types/catalog.js +103 -0
  33. package/vendor/subagent-core/types/child-agent.d.ts +150 -0
  34. package/vendor/subagent-core/types/child-agent.js +207 -0
  35. package/vendor/subagent-core/types/client.d.ts +8 -0
  36. package/vendor/subagent-core/types/client.js +7 -0
  37. package/vendor/subagent-core/types/continuation-activation.d.ts +251 -0
  38. package/vendor/subagent-core/types/continuation-activation.js +663 -0
  39. package/vendor/subagent-core/types/continuation-messages.d.ts +62 -0
  40. package/vendor/subagent-core/types/continuation-messages.js +102 -0
  41. package/vendor/subagent-core/types/continuation.d.ts +124 -0
  42. package/vendor/subagent-core/types/continuation.js +455 -0
  43. package/vendor/subagent-core/types/control-types.d.ts +146 -0
  44. package/vendor/subagent-core/types/control-types.js +9 -0
  45. package/vendor/subagent-core/types/control.d.ts +71 -0
  46. package/vendor/subagent-core/types/control.js +116 -0
  47. package/vendor/subagent-core/types/depth.d.ts +31 -0
  48. package/vendor/subagent-core/types/depth.js +39 -0
  49. package/vendor/subagent-core/types/descriptor.d.ts +144 -0
  50. package/vendor/subagent-core/types/descriptor.js +193 -0
  51. package/vendor/subagent-core/types/error.d.ts +11 -0
  52. package/vendor/subagent-core/types/error.js +14 -0
  53. package/vendor/subagent-core/types/inbox.d.ts +43 -0
  54. package/vendor/subagent-core/types/inbox.js +61 -0
  55. package/vendor/subagent-core/types/index.d.ts +316 -0
  56. package/vendor/subagent-core/types/index.js +511 -0
  57. package/vendor/subagent-core/types/internal.d.ts +58 -0
  58. package/vendor/subagent-core/types/internal.js +58 -0
  59. package/vendor/subagent-core/types/invariant.d.ts +13 -0
  60. package/vendor/subagent-core/types/invariant.js +91 -0
  61. package/vendor/subagent-core/types/lifecycle.d.ts +113 -0
  62. package/vendor/subagent-core/types/lifecycle.js +178 -0
  63. package/vendor/subagent-core/types/list-children.d.ts +65 -0
  64. package/vendor/subagent-core/types/list-children.js +381 -0
  65. package/vendor/subagent-core/types/out-of-process.d.ts +118 -0
  66. package/vendor/subagent-core/types/out-of-process.js +219 -0
  67. package/vendor/subagent-core/types/projection-types.d.ts +74 -0
  68. package/vendor/subagent-core/types/projection-types.js +7 -0
  69. package/vendor/subagent-core/types/projection.d.ts +95 -0
  70. package/vendor/subagent-core/types/projection.js +151 -0
  71. package/vendor/subagent-core/types/run-settlement.d.ts +17 -0
  72. package/vendor/subagent-core/types/run-settlement.js +70 -0
  73. package/vendor/subagent-core/types/types.d.ts +377 -0
  74. package/vendor/subagent-core/types/types.js +19 -0
  75. package/vendor/subagent-driver/LICENSE +21 -0
  76. package/vendor/subagent-driver/index.js +255 -0
  77. package/vendor/subagent-driver/types/index.d.ts +33 -0
  78. package/vendor/subagent-driver/types/structured.d.ts +42 -0
  79. package/vendor/subagent-fork/LICENSE +21 -0
  80. package/vendor/subagent-fork/index.js +61 -0
  81. package/vendor/subagent-fork/types/index.d.ts +20 -0
  82. package/vendor/subagent-spawn/LICENSE +21 -0
  83. package/vendor/subagent-spawn/index.js +45 -0
  84. package/vendor/subagent-spawn/types/index.d.ts +19 -0
  85. package/vendor/terminal/LICENSE +21 -0
  86. package/vendor/terminal/index.js +1013 -0
  87. package/vendor/terminal/types/config.d.ts +71 -0
  88. package/vendor/terminal/types/index.d.ts +36 -0
  89. package/vendor/terminal/types/sanitize.d.ts +47 -0
  90. package/vendor/terminal/types/session.d.ts +87 -0
  91. package/vendor/tui/dscode-clipboard-image/clipboard-image.swift +56 -0
  92. package/vendor/tui/dscode-clipboard-image/index.mjs +70 -0
  93. package/vendor/tui/index.mjs +341 -93
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared driver for in-process ONE-SHOT subagent providers. The agent factory's
3
+ * creation transaction owns unpublished setup and rollback; after publication
4
+ * the returned AgentHandle is the one quiescent lifecycle owner held by the
5
+ * provider's caller.
6
+ *
7
+ * Continuable children never come through here: the continuation manager
8
+ * composes and drives them directly, so this driver owns exactly one turn with
9
+ * one result.
10
+ *
11
+ * @module @deepseek-ai/dsh-subagent-in-process-driver
12
+ */
13
+ import type { SessionEvent } from '@deepseek-ai/dsh-session';
14
+ import type { ResolvedSubagentStartRequest, SubagentRun } from '@deepseek-ai/dsh-subagent';
15
+ export { STRUCTURED_OUTPUT_TOOL, STRUCTURED_OUTPUT_INSTRUCTION, } from './structured.ts';
16
+ /** Extra inputs the spawn and fork providers supply to the shared driver. */
17
+ export interface InProcessRunOptions {
18
+ /** Completed-turn seed for fork, or undefined for a fresh spawn. */
19
+ readonly seed?: readonly SessionEvent[];
20
+ }
21
+ /**
22
+ * Establish and drive one in-process one-shot child. Fulfillment means the agent
23
+ * is already published in the registry and transfers its turn, cancellation,
24
+ * and disposal work through the returned run. Rejection means the agent
25
+ * factory's unpublished creation transaction reached quiescence without
26
+ * publishing a child. Every start appends its resolved descriptor inside the
27
+ * child's initial turn.
28
+ * @param request - the trusted typed start request, including its required signal.
29
+ * @param options - the optional fork seed.
30
+ * @returns a published holder-owned run.
31
+ */
32
+ export declare function startInProcessRun(request: ResolvedSubagentStartRequest, options: InProcessRunOptions): Promise<SubagentRun>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Child-scoped structured-output tool, prompt instruction, terminal guard, and authoritative
3
+ * result capture for in-process subagents. Each child registers its real schema on its own
4
+ * scope, so concurrent runs do not interact and disposal leaves no global residue. The prompt
5
+ * contribution is ordinary reconstructed request state.
6
+ *
7
+ * Capture commits only after the authoritative `tools/result` succeeds; PTC mode capture also
8
+ * waits for the enclosing `run_code` result. The terminal result marker and monotonic tool
9
+ * guard prevent later calls from reopening a completed structured run.
10
+ * @module @deepseek-ai/dsh-subagent-in-process-driver/structured
11
+ */
12
+ import type { Context } from '@deepseek-ai/cordis';
13
+ import { type ObjectJsonSchema } from '@deepseek-ai/dsh-tools';
14
+ /** The model-facing tool name a structured child must call to finish. */
15
+ export declare const STRUCTURED_OUTPUT_TOOL = "structured_output";
16
+ /**
17
+ * The instruction registered as the child's trailing scoped prompt section:
18
+ * the demand travels with the
19
+ * tool, as ordinary prompt state of exactly one agent.
20
+ */
21
+ export declare const STRUCTURED_OUTPUT_INSTRUCTION: string;
22
+ /** One structured run's live handle: read the captured value once the child settles. */
23
+ export interface StructuredAttachment {
24
+ /**
25
+ * The captured value, once the child called the tool with valid arguments
26
+ * and the authoritative final tool result accepted that call.
27
+ * @returns the committed value, or undefined while none was accepted.
28
+ */
29
+ captured(): {
30
+ value: unknown;
31
+ } | undefined;
32
+ }
33
+ /**
34
+ * Attach the scoped capture tool, instruction, and enforcement to a child during
35
+ * its creation window. Child disposal removes every registration.
36
+ * @param childCtx - the child agent's scope context (`setup`'s argument).
37
+ * @param schema - the trusted, already-asserted schema subset to enforce (see
38
+ * `assertObjectJsonSchema` in dsh-tools).
39
+ * @returns the attachment handle (read `captured()` after the child settles).
40
+ */
41
+ export declare function attachStructuredRuntime(childCtx: Context, schema: ObjectJsonSchema): StructuredAttachment;
42
+ //# sourceMappingURL=structured.d.ts.map
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { startInProcessRun } from "../subagent-driver/index.js";
3
+ //#region lib/types/index.js
4
+ /**
5
+ * The in-process FORK subagent backend: registers a {@link SubagentProvider} on
6
+ * `ctx.subagents` that runs each child as a child {@link Agent} SEEDED with a prefix of the
7
+ * parent's session log — so the child inherits the parent's conversation context instead of
8
+ * starting fresh. The seed ends at the last `turn/end`: the current tool-call turn is
9
+ * unbalanced and cannot be replayed as a valid child session.
10
+ * @module @deepseek-ai/dsh-subagent-fork-in-process
11
+ */
12
+ const name = "subagent-fork-in-process";
13
+ const inject = ["subagents"];
14
+ const Config = z.object({ providerName: z.string().default("fork") });
15
+ /**
16
+ * The balanced completed-turn prefix of `parent`'s log: every event up to and including the
17
+ * last `turn/end`. The in-flight turn is excluded; before any completed turn the child starts
18
+ * fresh. Because live sequence numbers equal array indexes, the result remains a valid seed
19
+ * beginning at sequence zero.
20
+ * @param parent - the agent whose session log to slice.
21
+ * @returns the seed events, contiguous from seq 0; empty when no turn has completed.
22
+ */
23
+ function completedTurnPrefix(parent) {
24
+ const events = parent.session.snapshotEvents();
25
+ const lastEnd = events.findLast((e) => e.type === "turn/end");
26
+ if (lastEnd === void 0) return [];
27
+ return events.slice(0, lastEnd.seq + 1);
28
+ }
29
+ /**
30
+ * The fork provider. Supports `depthLimit` and `outputSchema` (via the shared
31
+ * in-process structured runtime), `agentOptions` (merged over the parent
32
+ * route), and `toolFilter`/`persona` (scoped restrict() and a scoped shadowing
33
+ * persona section).
34
+ */
35
+ var ForkInProcessProvider = class {
36
+ name;
37
+ capabilities = {
38
+ agentOptions: true,
39
+ outputSchema: true,
40
+ depthLimit: true,
41
+ toolFilter: true,
42
+ persona: true
43
+ };
44
+ inheritsParentContext = true;
45
+ constructor(name) {
46
+ this.name = name;
47
+ }
48
+ start(request) {
49
+ const seed = completedTurnPrefix(request.parent);
50
+ return startInProcessRun(request, { ...seed.length > 0 ? { seed } : {} });
51
+ }
52
+ prepareContinuable(request) {
53
+ const seed = completedTurnPrefix(request.parent);
54
+ return Promise.resolve(seed.length > 0 ? { seed } : {});
55
+ }
56
+ };
57
+ function apply(ctx, config) {
58
+ ctx.subagents.registerProvider(new ForkInProcessProvider(config.providerName));
59
+ }
60
+ //#endregion
61
+ export { Config, apply, inject, name };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The in-process FORK subagent backend: registers a {@link SubagentProvider} on
3
+ * `ctx.subagents` that runs each child as a child {@link Agent} SEEDED with a prefix of the
4
+ * parent's session log — so the child inherits the parent's conversation context instead of
5
+ * starting fresh. The seed ends at the last `turn/end`: the current tool-call turn is
6
+ * unbalanced and cannot be replayed as a valid child session.
7
+ * @module @deepseek-ai/dsh-subagent-fork-in-process
8
+ */
9
+ import type { Context } from '@deepseek-ai/cordis';
10
+ import z from '@deepseek-ai/schemastery';
11
+ export declare const name = "subagent-fork-in-process";
12
+ export declare const inject: string[];
13
+ /** Config: the registry name to register the provider under. */
14
+ export interface Config {
15
+ /** Provider name on `ctx.subagents` (default `fork`). */
16
+ providerName: string;
17
+ }
18
+ export declare const Config: z<Config>;
19
+ export declare function apply(ctx: Context, config: Config): void;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,45 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { startInProcessRun } from "../subagent-driver/index.js";
3
+ //#region lib/types/index.js
4
+ /**
5
+ * The in-process SPAWN subagent backend: registers a {@link SubagentProvider} on
6
+ * `ctx.subagents` that runs each child as a fresh child {@link Agent} on the same cordis
7
+ * context (its own session, own system prompt, zero parent context). The cheapest transport,
8
+ * reusing the agent factory's quiescent teardown.
9
+ * @module @deepseek-ai/dsh-subagent-spawn-in-process
10
+ */
11
+ const name = "subagent-spawn-in-process";
12
+ const inject = ["subagents"];
13
+ const Config = z.object({ providerName: z.string().default("spawn") });
14
+ /**
15
+ * The spawn provider. Supports every start-time capability: `depthLimit` (it
16
+ * constructs the child, so it can enforce a recursion cap), `outputSchema`
17
+ * (the scoped structured runtime), `agentOptions` (merged over the parent
18
+ * route), and `toolFilter`/`persona` (scoped `restrict()` and a scoped
19
+ * shadowing persona section, applied in the child's creation window).
20
+ */
21
+ var SpawnInProcessProvider = class {
22
+ name;
23
+ capabilities = {
24
+ agentOptions: true,
25
+ outputSchema: true,
26
+ depthLimit: true,
27
+ toolFilter: true,
28
+ persona: true
29
+ };
30
+ inheritsParentContext = false;
31
+ constructor(name) {
32
+ this.name = name;
33
+ }
34
+ start(request) {
35
+ return startInProcessRun(request, {});
36
+ }
37
+ prepareContinuable() {
38
+ return Promise.resolve({});
39
+ }
40
+ };
41
+ function apply(ctx, config) {
42
+ ctx.subagents.registerProvider(new SpawnInProcessProvider(config.providerName));
43
+ }
44
+ //#endregion
45
+ export { Config, apply, inject, name };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The in-process SPAWN subagent backend: registers a {@link SubagentProvider} on
3
+ * `ctx.subagents` that runs each child as a fresh child {@link Agent} on the same cordis
4
+ * context (its own session, own system prompt, zero parent context). The cheapest transport,
5
+ * reusing the agent factory's quiescent teardown.
6
+ * @module @deepseek-ai/dsh-subagent-spawn-in-process
7
+ */
8
+ import type { Context } from '@deepseek-ai/cordis';
9
+ import z from '@deepseek-ai/schemastery';
10
+ export declare const name = "subagent-spawn-in-process";
11
+ export declare const inject: string[];
12
+ /** Config: the registry name to register the provider under. */
13
+ export interface Config {
14
+ /** Provider name on `ctx.subagents` (default `spawn`). */
15
+ providerName: string;
16
+ }
17
+ export declare const Config: z<Config>;
18
+ export declare function apply(ctx: Context, config: Config): void;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.