dsh-loop-engine-allinone 0.0.0-stage → 0.4.1

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 (143) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/CONTRIBUTING.md +78 -0
  3. package/LICENSE +23 -0
  4. package/NOTICE +45 -0
  5. package/README.md +223 -2
  6. package/README.zh.md +179 -0
  7. package/SECURITY.md +39 -0
  8. package/cordis.patch.yml +3 -0
  9. package/lib/client.js +2166 -0
  10. package/lib/index.js +11621 -0
  11. package/lib/invariant.js +453 -0
  12. package/lib/types/agent-preset-ids.d.ts +276 -0
  13. package/lib/types/client/LoopEngineBadge.d.ts +71 -0
  14. package/lib/types/client/LoopEngineComposerSelect.d.ts +126 -0
  15. package/lib/types/client/LoopEngineSection.d.ts +35 -0
  16. package/lib/types/client/engine-marks.d.ts +87 -0
  17. package/lib/types/client/index.d.ts +39 -0
  18. package/lib/types/client/locales.d.ts +182 -0
  19. package/lib/types/client/reload.d.ts +135 -0
  20. package/lib/types/client/session-engine.d.ts +508 -0
  21. package/lib/types/client/store.d.ts +103 -0
  22. package/lib/types/client/turn-status.d.ts +234 -0
  23. package/lib/types/client/use-session-engine.d.ts +74 -0
  24. package/lib/types/commands.d.ts +77 -0
  25. package/lib/types/compat.d.ts +25 -0
  26. package/lib/types/driver-acp/agent.d.ts +289 -0
  27. package/lib/types/driver-acp/approval.d.ts +27 -0
  28. package/lib/types/driver-acp/capabilities.d.ts +200 -0
  29. package/lib/types/driver-acp/client.d.ts +297 -0
  30. package/lib/types/driver-acp/executable.d.ts +53 -0
  31. package/lib/types/driver-acp/mapping.d.ts +76 -0
  32. package/lib/types/driver-acp/profile.d.ts +126 -0
  33. package/lib/types/driver-acp/runtime.d.ts +45 -0
  34. package/lib/types/driver-acp/subprocess.d.ts +19 -0
  35. package/lib/types/driver-acp/terminal.d.ts +98 -0
  36. package/lib/types/driver-acp/transport.d.ts +43 -0
  37. package/lib/types/driver-acp/types.d.ts +152 -0
  38. package/lib/types/driver-cli/capability.d.ts +42 -0
  39. package/lib/types/driver-cli/cli-agent.d.ts +258 -0
  40. package/lib/types/driver-cli/cli-loop.d.ts +46 -0
  41. package/lib/types/driver-cli/flatten.d.ts +35 -0
  42. package/lib/types/driver-cli/frames.d.ts +128 -0
  43. package/lib/types/driver-cli/ndjson.d.ts +106 -0
  44. package/lib/types/driver-cli/session-sink.d.ts +333 -0
  45. package/lib/types/driver-cli/stream-json.d.ts +61 -0
  46. package/lib/types/driver-cli/text.d.ts +66 -0
  47. package/lib/types/driver-cli/transport.d.ts +84 -0
  48. package/lib/types/driver-core/agents-md-skill-provider.d.ts +72 -0
  49. package/lib/types/driver-core/assistant-stream.d.ts +68 -0
  50. package/lib/types/driver-core/context-files.d.ts +62 -0
  51. package/lib/types/driver-core/host-servers.d.ts +119 -0
  52. package/lib/types/driver-core/hosted-engine-runtime.d.ts +190 -0
  53. package/lib/types/driver-core/hosted-tool-vocabulary.d.ts +78 -0
  54. package/lib/types/driver-core/idle-child.d.ts +57 -0
  55. package/lib/types/driver-core/image-access.d.ts +25 -0
  56. package/lib/types/driver-core/inbox.d.ts +104 -0
  57. package/lib/types/driver-core/model-handover.d.ts +134 -0
  58. package/lib/types/driver-core/ownership.d.ts +41 -0
  59. package/lib/types/driver-core/permission-knobs.d.ts +26 -0
  60. package/lib/types/driver-core/prompt.d.ts +64 -0
  61. package/lib/types/driver-core/session-lifetime.d.ts +62 -0
  62. package/lib/types/driver-core/session-model.d.ts +128 -0
  63. package/lib/types/driver-core/skill-inject.d.ts +59 -0
  64. package/lib/types/driver-core/step-close.d.ts +49 -0
  65. package/lib/types/driver-core/step-images.d.ts +62 -0
  66. package/lib/types/driver-core/step-tools.d.ts +43 -0
  67. package/lib/types/driver-core/system-head.d.ts +43 -0
  68. package/lib/types/engine-agy/agent.d.ts +67 -0
  69. package/lib/types/engine-agy/frames.d.ts +90 -0
  70. package/lib/types/engine-agy/loop.d.ts +64 -0
  71. package/lib/types/engine-agy/process.d.ts +173 -0
  72. package/lib/types/engine-claude/agent.d.ts +186 -0
  73. package/lib/types/engine-claude/loop.d.ts +73 -0
  74. package/lib/types/engine-claude/mapping.d.ts +108 -0
  75. package/lib/types/engine-claude/permission.d.ts +41 -0
  76. package/lib/types/engine-claude/process.d.ts +59 -0
  77. package/lib/types/engine-claude/sdk.d.ts +67 -0
  78. package/lib/types/engine-claude/types.d.ts +28 -0
  79. package/lib/types/engine-codex/agent.d.ts +216 -0
  80. package/lib/types/engine-codex/appserver/client.d.ts +80 -0
  81. package/lib/types/engine-codex/appserver/mapping.d.ts +67 -0
  82. package/lib/types/engine-codex/appserver/thread.d.ts +66 -0
  83. package/lib/types/engine-codex/appserver/types.d.ts +225 -0
  84. package/lib/types/engine-codex/loop.d.ts +75 -0
  85. package/lib/types/engine-codex/model-handover.d.ts +56 -0
  86. package/lib/types/engine-codex/permission.d.ts +126 -0
  87. package/lib/types/engine-codex/skills.d.ts +28 -0
  88. package/lib/types/engine-codex/types.d.ts +36 -0
  89. package/lib/types/engine-drivers.d.ts +132 -0
  90. package/lib/types/engine-grok/agent.d.ts +24 -0
  91. package/lib/types/engine-grok/loop.d.ts +61 -0
  92. package/lib/types/engine-grok/process.d.ts +46 -0
  93. package/lib/types/engine-grok/profile.d.ts +82 -0
  94. package/lib/types/engine-hermes/agent.d.ts +47 -0
  95. package/lib/types/engine-hermes/loop.d.ts +56 -0
  96. package/lib/types/engine-hermes/process.d.ts +92 -0
  97. package/lib/types/engine-kimi/acp/client.d.ts +123 -0
  98. package/lib/types/engine-kimi/acp/mapping.d.ts +73 -0
  99. package/lib/types/engine-kimi/acp/types.d.ts +143 -0
  100. package/lib/types/engine-kimi/agent.d.ts +24 -0
  101. package/lib/types/engine-kimi/commands.d.ts +44 -0
  102. package/lib/types/engine-kimi/loop.d.ts +62 -0
  103. package/lib/types/engine-kimi/model-handover.d.ts +32 -0
  104. package/lib/types/engine-kimi/permission.d.ts +28 -0
  105. package/lib/types/engine-kimi/process.d.ts +47 -0
  106. package/lib/types/engine-kimi/profile.d.ts +19 -0
  107. package/lib/types/engine-kimi/skills.d.ts +52 -0
  108. package/lib/types/engine-kimi/types.d.ts +25 -0
  109. package/lib/types/engine-minimaxcode/agent.d.ts +24 -0
  110. package/lib/types/engine-minimaxcode/loop.d.ts +83 -0
  111. package/lib/types/engine-minimaxcode/process.d.ts +53 -0
  112. package/lib/types/engine-minimaxcode/profile.d.ts +72 -0
  113. package/lib/types/engine-of-session.d.ts +97 -0
  114. package/lib/types/engine-pi/agent.d.ts +230 -0
  115. package/lib/types/engine-pi/loop.d.ts +72 -0
  116. package/lib/types/engine-pi/model-handover.d.ts +84 -0
  117. package/lib/types/engine-pi/permission.d.ts +47 -0
  118. package/lib/types/engine-pi/rpc/client.d.ts +107 -0
  119. package/lib/types/engine-pi/rpc/mapping.d.ts +37 -0
  120. package/lib/types/engine-pi/rpc/types.d.ts +249 -0
  121. package/lib/types/engine-pi/skills.d.ts +47 -0
  122. package/lib/types/engine-pi/types.d.ts +36 -0
  123. package/lib/types/engine-qoderclicn/agent.d.ts +59 -0
  124. package/lib/types/engine-qoderclicn/loop.d.ts +51 -0
  125. package/lib/types/engine-qoderclicn/process.d.ts +113 -0
  126. package/lib/types/engine-registry.d.ts +584 -0
  127. package/lib/types/engine-remote.d.ts +192 -0
  128. package/lib/types/engine-surface.d.ts +36 -0
  129. package/lib/types/engine-zcode/agent.d.ts +50 -0
  130. package/lib/types/engine-zcode/loop.d.ts +47 -0
  131. package/lib/types/engine-zcode/process.d.ts +111 -0
  132. package/lib/types/index.d.ts +205 -0
  133. package/lib/types/invariant.d.ts +26 -0
  134. package/lib/types/model-selection-reset.d.ts +271 -0
  135. package/lib/types/namespace.d.ts +25 -0
  136. package/lib/types/patch-manager.d.ts +104 -0
  137. package/lib/types/preset.d.ts +254 -0
  138. package/lib/types/provider-route.d.ts +245 -0
  139. package/lib/types/router-loop.d.ts +458 -0
  140. package/lib/types/session-engine-store.d.ts +138 -0
  141. package/lib/types/settings.d.ts +60 -0
  142. package/lib/types/skills.d.ts +85 -0
  143. package/package.json +152 -6
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Qoder CN CLI process projection.
3
+ *
4
+ * The driver locates the `qoderclicn` executable, builds the argv for one step,
5
+ * and hands the child back as a transport. Qoder's CLI is a Claude-Code-lineage
6
+ * tool, so its non-interactive surface is the one that dialect converges on:
7
+ * `-p` for one shot, `--output-format stream-json` for framing, and
8
+ * `--permission-mode` for the stance.
9
+ *
10
+ * ## What was verified, and how
11
+ *
12
+ * `docs/probes/qoderclicn.md` records the raw captures. In short, against
13
+ * `qoderclicn 1.1.56` on this machine:
14
+ *
15
+ * - `qoderclicn -p "…"` prints the plain answer and exits 0;
16
+ * - `qoderclicn -p --output-format stream-json "…"` prints NDJSON whose frames
17
+ * carry `type`/`subtype`/`session_id`/`message` — Claude Code's dialect,
18
+ * including a `system`/`init` document naming `qodercli_version 1.1.56` and
19
+ * `protocol_version 1.5.0`.
20
+ *
21
+ * Two consequences are load-bearing rather than cosmetic:
22
+ *
23
+ * - The prompt travels as an ARGV argument, so the child needs no stdin pipe.
24
+ * Requesting one anyway would leave a pipe the child never reads.
25
+ * - The CLI writes hook chatter (`hook_started`, `hook_progress`,
26
+ * `hook_response`) onto the same stream. The adapter drops those documents;
27
+ * see `src/driver-cli/stream-json.ts` for why dropping is the right answer
28
+ * rather than an omission.
29
+ *
30
+ * @module dsh-loop-engine-allinone/engine-qoderclicn/process
31
+ */
32
+ import type { DshApprovalPolicy, DshSandboxMode } from '../driver-core/permission-knobs.ts';
33
+ import type { CliSpawnRequest } from '../driver-cli/transport.ts';
34
+ /** Grace in milliseconds for Qoder process-tree termination. */
35
+ export declare const QODERCLICN_DISPOSE_GRACE_MS = 3000;
36
+ /** The CLI's own permission modes, as `--permission-mode` accepts them. */
37
+ export declare const QODERCLICN_PERMISSION_MODES: readonly ["default", "accept_edits", "bypass_permissions", "dont_ask", "auto"];
38
+ /** One Qoder permission mode. */
39
+ export type QoderclicnPermissionMode = (typeof QODERCLICN_PERMISSION_MODES)[number];
40
+ /** Resolve the Qoder CN home directory from `QODER_HOME` or the current user's home. */
41
+ export declare function qoderclicnHomeDir(): string;
42
+ /**
43
+ * Resolve the `qoderclicn` executable.
44
+ *
45
+ * An explicit config path wins. Otherwise the CLI's own documented install
46
+ * location is probed (`<qoder home>/bin/qoderclicn/qoderclicn[.exe]`, which is
47
+ * where `qoderclicn update` puts it) and PATH is the last resort. The probe
48
+ * matters because Qoder's installer adds `.qoder-cn/bin/qoderclicn` to PATH
49
+ * itself, and a profile launched by a desktop app does not always inherit that.
50
+ * @param configBin - an operator-pinned path, if any.
51
+ * @returns the executable to spawn as `argv[0]`.
52
+ */
53
+ export declare function qoderclicnBinResolver(configBin?: string): string;
54
+ /**
55
+ * Map the session's dsh permission knobs onto Qoder's `--permission-mode`.
56
+ *
57
+ * The mapping follows the plugin's fail-closed rule rather than inventing a
58
+ * permissive default:
59
+ *
60
+ * - `danger-full-access` → `bypass_permissions`, the only mode that matches
61
+ * "the user said everything is allowed";
62
+ * - `workspace-write` → `accept_edits`, which lets file edits through while
63
+ * leaving the CLI's own gate in front of everything else;
64
+ * - anything else, INCLUDING no knobs at all → `default`, the CLI's own gate.
65
+ *
66
+ * The `ask` approval policy is deliberately NOT mapped to a permissive mode.
67
+ * Qoder's CLI can ask a human, but this driver has no channel to forward that
68
+ * question to dsh's approval seam — the child is unattended. So an `ask` policy
69
+ * degrades to the CLI's own non-interactive behaviour rather than to a silent
70
+ * yes, and the effective boundary stays the subprocess sandbox the whole child
71
+ * is spawned under.
72
+ * @param sandbox - the session's durable sandbox mode, if any.
73
+ * @param approval - the session's durable approval policy, if any.
74
+ * @returns the mode to pass.
75
+ */
76
+ export declare function qoderclicnPermissionMode(sandbox: DshSandboxMode | undefined, approval: DshApprovalPolicy | undefined): QoderclicnPermissionMode;
77
+ /** Everything one step's Qoder child needs. */
78
+ export interface QoderclicnSpawnSpec {
79
+ /** The resolved executable (`argv[0]`). */
80
+ readonly bin: string;
81
+ /** The prompt, passed as an argv argument (Qoder reads no stdin in `-p` mode). */
82
+ readonly prompt: string;
83
+ /** The session's working directory. */
84
+ readonly cwd: string;
85
+ /** Explicit environment entries layered over the scrubbed parent environment. */
86
+ readonly env: Record<string, string>;
87
+ /** Pinned model, when the deployment or the session named one. */
88
+ readonly model: string | undefined;
89
+ /** Resolved permission mode. */
90
+ readonly permissionMode: QoderclicnPermissionMode;
91
+ /** Cancellation. */
92
+ readonly signal: AbortSignal;
93
+ }
94
+ /**
95
+ * Build the argv for one non-interactive Qoder step.
96
+ *
97
+ * `--output-format stream-json` is what makes the answer structured; without it
98
+ * the CLI prints prose and the driver would have to guess where a tool call
99
+ * began. `--no-session-persistence` is deliberately NOT passed: the plugin
100
+ * replays the whole transcript into each prompt, so the CLI's own session store
101
+ * is dead weight, but disabling it also disables `--resume`, which a deployment
102
+ * may want later.
103
+ * @param spec - the step's spawn spec.
104
+ * @returns the argv.
105
+ */
106
+ export declare function qoderclicnArgv(spec: QoderclicnSpawnSpec): string[];
107
+ /**
108
+ * Project one step's spawn spec onto the transport request.
109
+ * @param spec - the step's spawn spec.
110
+ * @returns the transport's request shape.
111
+ */
112
+ export declare function qoderclicnSpawnRequest(spec: QoderclicnSpawnSpec): CliSpawnRequest;
113
+ //# sourceMappingURL=process.d.ts.map