@claudexor/cli 3.5.0 → 3.8.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 (157) hide show
  1. package/dist/accounts-projection.d.ts +22 -14
  2. package/dist/accounts-projection.d.ts.map +1 -1
  3. package/dist/accounts-projection.js +112 -60
  4. package/dist/accounts-projection.js.map +1 -1
  5. package/dist/accounts-services.d.ts +140 -128
  6. package/dist/accounts-services.d.ts.map +1 -1
  7. package/dist/accounts-services.js +22 -9
  8. package/dist/accounts-services.js.map +1 -1
  9. package/dist/accounts-unified-migration.d.ts +110 -0
  10. package/dist/accounts-unified-migration.d.ts.map +1 -0
  11. package/dist/accounts-unified-migration.js +422 -0
  12. package/dist/accounts-unified-migration.js.map +1 -0
  13. package/dist/agy-quota-source.d.ts +1 -0
  14. package/dist/agy-quota-source.d.ts.map +1 -1
  15. package/dist/agy-quota-source.js +61 -108
  16. package/dist/agy-quota-source.js.map +1 -1
  17. package/dist/auth-login-harnesses.d.ts +7 -5
  18. package/dist/auth-login-harnesses.d.ts.map +1 -1
  19. package/dist/auth-login-harnesses.js +10 -9
  20. package/dist/auth-login-harnesses.js.map +1 -1
  21. package/dist/capabilities.d.ts.map +1 -1
  22. package/dist/capabilities.js +6 -1
  23. package/dist/capabilities.js.map +1 -1
  24. package/dist/claude-oauth-usage.d.ts.map +1 -1
  25. package/dist/claude-oauth-usage.js +9 -3
  26. package/dist/claude-oauth-usage.js.map +1 -1
  27. package/dist/claude-statusline.d.ts.map +1 -1
  28. package/dist/claude-statusline.js +14 -1
  29. package/dist/claude-statusline.js.map +1 -1
  30. package/dist/claudexord-entry.d.ts +7 -2
  31. package/dist/claudexord-entry.d.ts.map +1 -1
  32. package/dist/claudexord-entry.js +33 -11
  33. package/dist/claudexord-entry.js.map +1 -1
  34. package/dist/claudexord.d.ts.map +1 -1
  35. package/dist/claudexord.js +25 -37
  36. package/dist/claudexord.js.map +1 -1
  37. package/dist/cli.js +2 -1
  38. package/dist/cli.js.map +1 -1
  39. package/dist/codex-quota-source.d.ts.map +1 -1
  40. package/dist/codex-quota-source.js +8 -3
  41. package/dist/codex-quota-source.js.map +1 -1
  42. package/dist/command-flags.d.ts.map +1 -1
  43. package/dist/command-flags.js +1 -0
  44. package/dist/command-flags.js.map +1 -1
  45. package/dist/control-services.d.ts +206 -188
  46. package/dist/control-services.d.ts.map +1 -1
  47. package/dist/control-services.js +54 -122
  48. package/dist/control-services.js.map +1 -1
  49. package/dist/credential-commands.d.ts +16 -0
  50. package/dist/credential-commands.d.ts.map +1 -1
  51. package/dist/credential-commands.js +93 -39
  52. package/dist/credential-commands.js.map +1 -1
  53. package/dist/credential-profile-mutations.d.ts +70 -0
  54. package/dist/credential-profile-mutations.d.ts.map +1 -0
  55. package/dist/credential-profile-mutations.js +219 -0
  56. package/dist/credential-profile-mutations.js.map +1 -0
  57. package/dist/credential-status-invalidation.d.ts +11 -0
  58. package/dist/credential-status-invalidation.d.ts.map +1 -0
  59. package/dist/credential-status-invalidation.js +36 -0
  60. package/dist/credential-status-invalidation.js.map +1 -0
  61. package/dist/daemon-admission-runtime.d.ts +5 -0
  62. package/dist/daemon-admission-runtime.d.ts.map +1 -1
  63. package/dist/daemon-admission-runtime.js +1 -0
  64. package/dist/daemon-admission-runtime.js.map +1 -1
  65. package/dist/delegation-belt-descriptor.d.ts +2 -1
  66. package/dist/delegation-belt-descriptor.d.ts.map +1 -1
  67. package/dist/delegation-belt-descriptor.js +2 -1
  68. package/dist/delegation-belt-descriptor.js.map +1 -1
  69. package/dist/harness-command-specs.d.ts.map +1 -1
  70. package/dist/harness-command-specs.js +4 -4
  71. package/dist/harness-command-specs.js.map +1 -1
  72. package/dist/harness-command.d.ts +5 -3
  73. package/dist/harness-command.d.ts.map +1 -1
  74. package/dist/harness-command.js +5 -3
  75. package/dist/harness-command.js.map +1 -1
  76. package/dist/harness-install-lease.d.ts +11 -0
  77. package/dist/harness-install-lease.d.ts.map +1 -0
  78. package/dist/harness-install-lease.js +98 -0
  79. package/dist/harness-install-lease.js.map +1 -0
  80. package/dist/harness-install-proof.d.ts +36 -0
  81. package/dist/harness-install-proof.d.ts.map +1 -0
  82. package/dist/harness-install-proof.js +148 -0
  83. package/dist/harness-install-proof.js.map +1 -0
  84. package/dist/harness-install-recipes.d.ts +80 -0
  85. package/dist/harness-install-recipes.d.ts.map +1 -0
  86. package/dist/harness-install-recipes.js +130 -0
  87. package/dist/harness-install-recipes.js.map +1 -0
  88. package/dist/harness-installer.d.ts +45 -46
  89. package/dist/harness-installer.d.ts.map +1 -1
  90. package/dist/harness-installer.js +248 -156
  91. package/dist/harness-installer.js.map +1 -1
  92. package/dist/mcp-run-projections.d.ts +1 -1
  93. package/dist/native-login.d.ts +7 -0
  94. package/dist/native-login.d.ts.map +1 -1
  95. package/dist/native-login.js +40 -17
  96. package/dist/native-login.js.map +1 -1
  97. package/dist/profile-registration.d.ts +15 -1
  98. package/dist/profile-registration.d.ts.map +1 -1
  99. package/dist/profile-registration.js +124 -7
  100. package/dist/profile-registration.js.map +1 -1
  101. package/dist/quota-services.d.ts +4 -4
  102. package/dist/quota-subject-universe.d.ts.map +1 -1
  103. package/dist/quota-subject-universe.js +6 -0
  104. package/dist/quota-subject-universe.js.map +1 -1
  105. package/dist/remote-command.d.ts +0 -2
  106. package/dist/remote-command.d.ts.map +1 -1
  107. package/dist/remote-command.js +3 -74
  108. package/dist/remote-command.js.map +1 -1
  109. package/dist/run-orchestrator.d.ts +28 -0
  110. package/dist/run-orchestrator.d.ts.map +1 -0
  111. package/dist/run-orchestrator.js +43 -0
  112. package/dist/run-orchestrator.js.map +1 -0
  113. package/dist/settings-service.d.ts +1 -1
  114. package/dist/settings-service.js +3 -3
  115. package/dist/settings-service.js.map +1 -1
  116. package/dist/setup-attach-command.d.ts +30 -0
  117. package/dist/setup-attach-command.d.ts.map +1 -0
  118. package/dist/setup-attach-command.js +118 -0
  119. package/dist/setup-attach-command.js.map +1 -0
  120. package/dist/setup-job-store.d.ts +2 -2
  121. package/dist/setup-job-support.d.ts +36 -9
  122. package/dist/setup-job-support.d.ts.map +1 -1
  123. package/dist/setup-job-support.js +81 -10
  124. package/dist/setup-job-support.js.map +1 -1
  125. package/dist/setup-jobs.d.ts +4 -4
  126. package/dist/setup-jobs.d.ts.map +1 -1
  127. package/dist/setup-jobs.js +50 -47
  128. package/dist/setup-jobs.js.map +1 -1
  129. package/dist/setup-login-capability.d.ts +37 -0
  130. package/dist/setup-login-capability.d.ts.map +1 -0
  131. package/dist/setup-login-capability.js +96 -0
  132. package/dist/setup-login-capability.js.map +1 -0
  133. package/dist/setup-login-io.d.ts +4 -1
  134. package/dist/setup-login-io.d.ts.map +1 -1
  135. package/dist/setup-login-io.js +22 -3
  136. package/dist/setup-login-io.js.map +1 -1
  137. package/dist/setup-login-pty.d.ts +64 -22
  138. package/dist/setup-login-pty.d.ts.map +1 -1
  139. package/dist/setup-login-pty.js +289 -48
  140. package/dist/setup-login-pty.js.map +1 -1
  141. package/dist/setup-login-runner-support.d.ts +12 -0
  142. package/dist/setup-login-runner-support.d.ts.map +1 -0
  143. package/dist/setup-login-runner-support.js +65 -0
  144. package/dist/setup-login-runner-support.js.map +1 -0
  145. package/dist/setup-login-runner.d.ts +2 -0
  146. package/dist/setup-login-runner.d.ts.map +1 -1
  147. package/dist/setup-login-runner.js +119 -116
  148. package/dist/setup-login-runner.js.map +1 -1
  149. package/dist/setup-runner-outcome.d.ts +10 -0
  150. package/dist/setup-runner-outcome.d.ts.map +1 -0
  151. package/dist/setup-runner-outcome.js +49 -0
  152. package/dist/setup-runner-outcome.js.map +1 -0
  153. package/dist/thread-continuity-context.d.ts +24 -0
  154. package/dist/thread-continuity-context.d.ts.map +1 -1
  155. package/dist/thread-continuity-context.js +17 -0
  156. package/dist/thread-continuity-context.js.map +1 -1
  157. package/package.json +24 -24
@@ -0,0 +1,37 @@
1
+ import type { HarnessAdapter } from "@claudexor/core";
2
+ import type { ControlSetupJobTransport, SetupLoginCapability, SetupTerminalTransportErrorCode } from "@claudexor/schema";
3
+ import { type CodexLoginFlow, type NativeLoginSpec } from "./native-login.js";
4
+ import { type TerminalTransportBackend, type TerminalTransportResolution } from "./setup-login-pty.js";
5
+ export type SetupLoginCapabilityStatus = "ready" | "manifest_unsupported" | "vendor_binary_unavailable" | "terminal_transport_unavailable" | "terminal_transport_unsupported" | "terminal_transport_probe_failed";
6
+ export interface SetupLoginCapabilityProjection {
7
+ status: SetupLoginCapabilityStatus;
8
+ backend: "direct" | TerminalTransportBackend | null;
9
+ capability: SetupLoginCapability | null;
10
+ detail: string;
11
+ errorCode?: Exclude<SetupTerminalTransportErrorCode, "terminal_transport_failed">;
12
+ }
13
+ type ResolveTerminalTransport = (childBinary: string, childArgs: readonly string[]) => Promise<TerminalTransportResolution>;
14
+ export interface SetupLoginCapabilityOptions {
15
+ transport?: ControlSetupJobTransport;
16
+ loginFlow?: CodexLoginFlow;
17
+ getAdapter?: (harness: string) => HarnessAdapter | undefined;
18
+ resolveLoginSpec?: (harness: string, loginFlow?: CodexLoginFlow) => NativeLoginSpec | null;
19
+ resolveTerminalTransport?: ResolveTerminalTransport;
20
+ }
21
+ /**
22
+ * One effective setup-login projector for status, catalog, and create
23
+ * admission. Static manifest input is consulted without vendor discovery;
24
+ * exact vendor binary readiness comes from nativeLoginSpec; terminal stdin
25
+ * alone reaches the shared bounded PTY/ConPTY resolver.
26
+ */
27
+ export declare function projectSetupLoginCapability(harness: string, options?: SetupLoginCapabilityOptions): Promise<SetupLoginCapabilityProjection>;
28
+ /** Thin public wire: current producers always emit this null/object value. */
29
+ export declare function effectiveSetupLoginCapability(harness: string, options?: Omit<SetupLoginCapabilityOptions, "transport">): Promise<SetupLoginCapability | null>;
30
+ /**
31
+ * Map only pre-job daemon terminal failures into the frozen request-problem
32
+ * contract. Manifest/vendor misses remain the manager's existing durable
33
+ * not-supported result; client_pty projections are ready and never enter here.
34
+ */
35
+ export declare function assertSetupLoginAdmission(projection: SetupLoginCapabilityProjection): void;
36
+ export {};
37
+ //# sourceMappingURL=setup-login-capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-login-capability.d.ts","sourceRoot":"","sources":["../src/setup-login-capability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,0BAA0B,GAClC,OAAO,GACP,sBAAsB,GACtB,2BAA2B,GAC3B,gCAAgC,GAChC,gCAAgC,GAChC,iCAAiC,CAAC;AAEtC,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,QAAQ,GAAG,wBAAwB,GAAG,IAAI,CAAC;IACpD,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC,+BAA+B,EAAE,2BAA2B,CAAC,CAAC;CACnF;AAED,KAAK,wBAAwB,GAAG,CAC9B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,MAAM,EAAE,KACzB,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IAC7D,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,KAAK,eAAe,GAAG,IAAI,CAAC;IAC3F,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;CACrD;AAKD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,8BAA8B,CAAC,CAiEzC;AAED,8EAA8E;AAC9E,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAM,GAC3D,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAGtC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,8BAA8B,GAAG,IAAI,CAe1F"}
@@ -0,0 +1,96 @@
1
+ import { buildRegistry } from "./registry.js";
2
+ import { nativeLoginSpec } from "./native-login.js";
3
+ import { resolvePtyWrappedCommand, } from "./setup-login-pty.js";
4
+ const EXTERNAL_TERMINAL = { mode: "external_terminal" };
5
+ const IN_APP = { mode: "in_app" };
6
+ /**
7
+ * One effective setup-login projector for status, catalog, and create
8
+ * admission. Static manifest input is consulted without vendor discovery;
9
+ * exact vendor binary readiness comes from nativeLoginSpec; terminal stdin
10
+ * alone reaches the shared bounded PTY/ConPTY resolver.
11
+ */
12
+ export async function projectSetupLoginCapability(harness, options = {}) {
13
+ const getAdapter = options.getAdapter ?? ((id) => buildRegistry({ includeFakes: false }).get(id));
14
+ const declaration = getAdapter(harness)?.capabilityProfile?.auth.managed_login;
15
+ if (!declaration) {
16
+ return {
17
+ status: "manifest_unsupported",
18
+ backend: null,
19
+ capability: null,
20
+ detail: "the harness declares no managed subscription login",
21
+ };
22
+ }
23
+ const resolveLogin = options.resolveLoginSpec ??
24
+ ((id, flow) => nativeLoginSpec(id, undefined, flow));
25
+ const spec = resolveLogin(harness, options.loginFlow);
26
+ if (!spec) {
27
+ return {
28
+ status: "vendor_binary_unavailable",
29
+ backend: null,
30
+ capability: null,
31
+ detail: "the managed vendor login command is unavailable on this host",
32
+ };
33
+ }
34
+ // client_pty is the explicit external-terminal fallback. It still requires
35
+ // an exact vendor command, but never asks the daemon to prove a PTY backend.
36
+ if (options.transport === "client_pty") {
37
+ return {
38
+ status: "ready",
39
+ backend: null,
40
+ capability: EXTERNAL_TERMINAL,
41
+ detail: "the exact vendor login command is ready for external-terminal attachment",
42
+ };
43
+ }
44
+ if (declaration.stdin !== "terminal") {
45
+ return {
46
+ status: "ready",
47
+ backend: "direct",
48
+ capability: IN_APP,
49
+ detail: "the exact vendor login command is ready for daemon-hosted input",
50
+ };
51
+ }
52
+ const resolution = await (options.resolveTerminalTransport ?? resolvePtyWrappedCommand)(spec.binary, spec.args);
53
+ if (resolution.status === "ready") {
54
+ return {
55
+ status: "ready",
56
+ backend: resolution.backend,
57
+ capability: IN_APP,
58
+ detail: "the daemon terminal transport passed its bounded capability probe",
59
+ };
60
+ }
61
+ return {
62
+ status: `terminal_transport_${resolution.status}`,
63
+ backend: resolution.backend,
64
+ capability: EXTERNAL_TERMINAL,
65
+ detail: resolution.detail,
66
+ errorCode: resolution.errorCode,
67
+ };
68
+ }
69
+ /** Thin public wire: current producers always emit this null/object value. */
70
+ export async function effectiveSetupLoginCapability(harness, options = {}) {
71
+ return (await projectSetupLoginCapability(harness, { ...options, transport: "daemon" }))
72
+ .capability;
73
+ }
74
+ /**
75
+ * Map only pre-job daemon terminal failures into the frozen request-problem
76
+ * contract. Manifest/vendor misses remain the manager's existing durable
77
+ * not-supported result; client_pty projections are ready and never enter here.
78
+ */
79
+ export function assertSetupLoginAdmission(projection) {
80
+ if (!projection.errorCode)
81
+ return;
82
+ const probeFailed = projection.errorCode === "terminal_transport_probe_failed";
83
+ const fieldMessage = probeFailed
84
+ ? "Daemon-hosted terminal transport could not be verified; retry setup login or use the external terminal flow."
85
+ : "Daemon-hosted terminal transport is unavailable; use the external terminal flow.";
86
+ throw Object.assign(new Error(projection.detail), {
87
+ status: probeFailed ? 503 : 409,
88
+ code: projection.errorCode,
89
+ retryable: probeFailed,
90
+ fieldErrors: { "/transport": [fieldMessage] },
91
+ requiredActions: probeFailed
92
+ ? ["retry_setup_login", "use_external_terminal"]
93
+ : ["use_external_terminal"],
94
+ });
95
+ }
96
+ //# sourceMappingURL=setup-login-capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-login-capability.js","sourceRoot":"","sources":["../src/setup-login-capability.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EACL,wBAAwB,GAGzB,MAAM,sBAAsB,CAAC;AA+B9B,MAAM,iBAAiB,GAAyB,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;AAC9E,MAAM,MAAM,GAAyB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAe,EACf,OAAO,GAAgC,EAAE;IAEzC,MAAM,UAAU,GACd,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC;IAC/E,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;YACL,MAAM,EAAE,sBAAsB;YAC9B,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,oDAAoD;SAC7D,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAChB,OAAO,CAAC,gBAAgB;QACxB,CAAC,CAAC,EAAU,EAAE,IAAqB,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC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8E;AAC9E,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAe,EACf,OAAO,GAAmD,EAAE;IAE5D,OAAO,CAAC,MAAM,2BAA2B,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;SACrF,UAAU,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAA0C;IAClF,IAAI,CAAC,UAAU,CAAC,SAAS;QAAE,OAAO;IAClC,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,KAAK,iCAAiC,CAAC;IAC/E,MAAM,YAAY,GAAG,WAAW;QAC9B,CAAC,CAAC,8GAA8G;QAChH,CAAC,CAAC,kFAAkF,CAAC;IACvF,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAChD,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QAC/B,IAAI,EAAE,UAAU,CAAC,SAAS;QAC1B,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,EAAE,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE;QAC7C,eAAe,EAAE,WAAW;YAC1B,CAAC,CAAC,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;YAChD,CAAC,CAAC,CAAC,uBAAuB,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -27,7 +27,10 @@ export declare function watchLoginInput(manifest: SetupLoginManifest, child: Chi
27
27
  * (ptyStdin) is ECHOED by the terminal line discipline, so the pasted code
28
28
  * comes straight back out on the tee'd output — the tail must forget it
29
29
  * before any failure receipt is written (INV-062). */
30
- onDelivered?: (value: string) => void): () => void;
30
+ options?: {
31
+ onDelivered?: (value: string) => void;
32
+ windowsConpty?: boolean;
33
+ }): () => void;
31
34
  /** Ring buffer of the last OUTPUT_TAIL_BYTES of tee'd vendor output. */
32
35
  export declare function createTailBuffer(): {
33
36
  push(chunk: Buffer): void;
@@ -1 +1 @@
1
- {"version":3,"file":"setup-login-io.d.ts","sourceRoot":"","sources":["../src/setup-login-io.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;;;GAOG;AAEH,eAAO,MAAM,cAAc,QACgD,CAAC;AAE5E,eAAO,MAAM,aAAa,QAAwC,CAAC;AAInE;;;0DAG0D;AAC1D,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,IAAI;AACf;;;sDAGsD;AACtD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GACpC,MAAM,IAAI,CA4BZ;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI;IAClC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CA4CA;AAMD;;;gBAGgB;AAChB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAqBnE"}
1
+ {"version":3,"file":"setup-login-io.d.ts","sourceRoot":"","sources":["../src/setup-login-io.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;;;GAOG;AAEH,eAAO,MAAM,cAAc,QACgD,CAAC;AAE5E,eAAO,MAAM,aAAa,QAAwC,CAAC;AAInE;;;0DAG0D;AAC1D,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,IAAI;AACf;;;sDAGsD;AACtD,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACpB,GACL,MAAM,IAAI,CAmCZ;AAcD,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI;IAClC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CA4CA;AAMD;;;gBAGgB;AAChB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAqBnE"}
@@ -23,7 +23,7 @@ export function watchLoginInput(manifest, child, now,
23
23
  * (ptyStdin) is ECHOED by the terminal line discipline, so the pasted code
24
24
  * comes straight back out on the tee'd output — the tail must forget it
25
25
  * before any failure receipt is written (INV-062). */
26
- onDelivered) {
26
+ options = {}) {
27
27
  let delivered = false;
28
28
  const timer = setInterval(() => {
29
29
  if (delivered || !manifest.inputPath || !child.stdin || child.stdin.destroyed)
@@ -32,9 +32,18 @@ onDelivered) {
32
32
  if (!input)
33
33
  return;
34
34
  delivered = true;
35
- onDelivered?.(input.value);
35
+ options.onDelivered?.(input.value);
36
36
  try {
37
- child.stdin.write(`${input.value}\n`);
37
+ if (options.windowsConpty) {
38
+ // Server-era ConPTY parsers have shipped bugs around chunked Win32
39
+ // input-mode sequences. Keep each complete KEY_EVENT_RECORD in its
40
+ // own pipe write instead of presenting one concatenated CSI stream.
41
+ for (const record of encodeWindowsConptyLine(input.value))
42
+ child.stdin.write(record);
43
+ }
44
+ else {
45
+ child.stdin.write(`${input.value}\n`);
46
+ }
38
47
  // The secret has been handed to the vendor; what stays on disk is a
39
48
  // non-secret consumed marker, so the one-shot conflict check still
40
49
  // refuses a second submission while the code itself stops existing.
@@ -55,6 +64,16 @@ onDelivered) {
55
64
  void now;
56
65
  return () => clearInterval(timer);
57
66
  }
67
+ function encodeWindowsConptyLine(value) {
68
+ const keyRecord = (virtualKey, scanCode, codeUnit, keyDown) => `\u001b[${virtualKey};${scanCode};${codeUnit};${keyDown};0;1_`;
69
+ const records = [];
70
+ for (let index = 0; index < value.length; index += 1) {
71
+ const codeUnit = value.charCodeAt(index);
72
+ records.push(keyRecord(231, 0, codeUnit, 1), keyRecord(231, 0, codeUnit, 0));
73
+ }
74
+ records.push(keyRecord(13, 28, 13, 1), keyRecord(13, 28, 13, 0));
75
+ return records;
76
+ }
58
77
  /** Ring buffer of the last OUTPUT_TAIL_BYTES of tee'd vendor output. */
59
78
  export function createTailBuffer() {
60
79
  // Byte-accurate ring: keep the final OUTPUT_TAIL_BYTES RAW bytes, decode
@@ -1 +1 @@
1
- {"version":3,"file":"setup-login-io.js","sourceRoot":"","sources":["../src/setup-login-io.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC;;;;;;;GAOG;AACH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GACzB,yEAAyE,CAAC;AAC5E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAEnE,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;0DAG0D;AAC1D,MAAM,UAAU,eAAe,CAC7B,QAA4B,EAC5B,KAAmB,EACnB,GAAe;AACf;;;sDAGsD;AACtD,WAAqC;IAErC,IAAI,SAAS,GAAG,KAAK,CA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IAC5C,MAAM,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC;IAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAC3E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAE,GAAG,WAAW,CAAC,KAAK,WAAW;QAAE,KAAK,IAAI,CAAC,CAAC;IACvF,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,IAAI,GAAG;QAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -1,27 +1,69 @@
1
- /** Refusal when this host has no way to give a login a terminal. */
2
- export declare const PTY_UNAVAILABLE = "this sign-in needs a terminal on stdin and no terminal helper (expect, script) is available here; run the CLI login instead";
3
- /** Refusal when the sealed command cannot be carried to the helper verbatim. */
4
- export declare const PTY_UNQUOTABLE = "this sign-in command contains characters the terminal helper cannot carry unchanged; run the CLI login instead";
1
+ import type { SetupTerminalTransportErrorCode } from "@claudexor/schema";
2
+ export declare const CONPTY_HELPER_PROTOCOL = "claudexor-conpty-helper-v1";
3
+ export declare const CONPTY_HELPER_ARCHITECTURE = "x64";
4
+ export type TerminalTransportBackend = "expect" | "script" | "windows_conpty";
5
+ type TerminalTransportSafeFailure = {
6
+ status: "unavailable";
7
+ backend: TerminalTransportBackend | null;
8
+ errorCode: Extract<SetupTerminalTransportErrorCode, "terminal_transport_unavailable">;
9
+ detail: string;
10
+ } | {
11
+ status: "unsupported";
12
+ backend: TerminalTransportBackend;
13
+ errorCode: Extract<SetupTerminalTransportErrorCode, "terminal_transport_unsupported">;
14
+ detail: string;
15
+ } | {
16
+ status: "probe_failed";
17
+ backend: TerminalTransportBackend;
18
+ errorCode: Extract<SetupTerminalTransportErrorCode, "terminal_transport_probe_failed">;
19
+ detail: string;
20
+ };
21
+ export type TerminalTransportResolution = {
22
+ status: "ready";
23
+ backend: TerminalTransportBackend;
24
+ command: {
25
+ binary: string;
26
+ args: string[];
27
+ };
28
+ /** ConPTY reserves helper stderr for bounded control frames. POSIX
29
+ * wrappers still carry vendor diagnostics there and must be teed. */
30
+ helperControlStderr: boolean;
31
+ }
32
+ /** Closed safe failures: detail never includes helper paths, child argv,
33
+ * environment, helper control numbers, or terminal output. */
34
+ | TerminalTransportSafeFailure;
35
+ type ExecutableInspection = "missing" | "regular_executable" | "invalid";
36
+ type ConptyProbeResult = "ready" | "unsupported" | "failed";
37
+ export interface TerminalTransportResolverOptions {
38
+ platform?: NodeJS.Platform;
39
+ helperPath?: string;
40
+ inspectExecutable?: (path: string) => Promise<ExecutableInspection>;
41
+ probeConpty?: (path: string) => Promise<ConptyProbeResult>;
42
+ expectPath?: string;
43
+ scriptPath?: string;
44
+ }
5
45
  /**
6
- * Wrap a login command that needs a real terminal on stdin.
46
+ * Resolve and wrap a login command that needs a real terminal on stdin.
7
47
  *
8
- * Proven by experiment on this platform pair (2026-08-16): BSD `script(1)`
9
- * calls `tcgetattr` on its OWN stdin and dies with "Operation not supported"
10
- * the moment that stdin is a pipe, which is exactly how a daemon-hosted runner
11
- * spawns it so macOS cannot use it. `expect(1)`, which ships with macOS,
12
- * allocates the pty itself and relays plain pipes, and util-linux `script`
13
- * accepts non-tty stdio where `expect` is usually not installed. Probing for
14
- * the tool rather than branching on the platform therefore lands on the one
15
- * that works on both, with a typed refusal when neither exists.
16
- *
17
- * The command is passed to Tcl brace-quoted; a word containing a brace or a
18
- * backslash is REFUSED rather than escaped, because a mis-escaped word would
19
- * become a different command than the manifest digest sealed.
48
+ * This is the single host-capability and spawn-spec owner used by setup
49
+ * admission, status projection, and the worker immediately before spawn. A
50
+ * Windows helper is never reported ready from file presence: its bounded
51
+ * `--probe` must create and close an HPCON and return the exact protocol marker.
20
52
  */
21
- export declare function ptyWrappedCommand(binary: string, args: string[], exists?: (path: string) => boolean): {
22
- binary: string;
23
- args: string[];
24
- } | {
25
- refusal: string;
53
+ export declare function resolvePtyWrappedCommand(childBinary: string, childArgs: readonly string[], options?: TerminalTransportResolverOptions): Promise<TerminalTransportResolution>;
54
+ export interface ConptyControlState {
55
+ started: boolean;
56
+ childPid: number | null;
57
+ error: {
58
+ phase: number;
59
+ code: number;
60
+ } | null;
61
+ malformed: boolean;
62
+ }
63
+ /** Bounded parser for helper-only stderr. It never returns raw bytes. */
64
+ export declare function createConptyControlParser(limit?: number): {
65
+ push(chunk: Buffer): void;
66
+ finish(): ConptyControlState;
26
67
  };
68
+ export {};
27
69
  //# sourceMappingURL=setup-login-pty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-login-pty.d.ts","sourceRoot":"","sources":["../src/setup-login-pty.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,eAAO,MAAM,eAAe,gIACmG,CAAC;AAEhI,gFAAgF;AAChF,eAAO,MAAM,cAAc,mHACuF,CAAC;AAEnH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB,GAC7C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAkC1D"}
1
+ {"version":3,"file":"setup-login-pty.d.ts","sourceRoot":"","sources":["../src/setup-login-pty.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEzE,e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