@ornexus/neocortex 4.60.16

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 (235) hide show
  1. package/LICENSE +56 -0
  2. package/LICENSE-COMMERCIAL.md +70 -0
  3. package/README.md +58 -0
  4. package/dist/sbom.cdx.json +11159 -0
  5. package/docs/install/coderabbit-manual-setup.md +86 -0
  6. package/docs/install/installer-diagnostics.md +107 -0
  7. package/docs/install/linux-global-install.md +97 -0
  8. package/install.js +572 -0
  9. package/install.ps1 +2214 -0
  10. package/install.sh +2013 -0
  11. package/package.json +132 -0
  12. package/packages/client/dist/adapters/adapter-registry.d.ts +61 -0
  13. package/packages/client/dist/adapters/adapter-registry.js +1 -0
  14. package/packages/client/dist/adapters/antigravity-adapter.d.ts +18 -0
  15. package/packages/client/dist/adapters/antigravity-adapter.js +2 -0
  16. package/packages/client/dist/adapters/claude-code-adapter.d.ts +19 -0
  17. package/packages/client/dist/adapters/claude-code-adapter.js +3 -0
  18. package/packages/client/dist/adapters/codex-adapter.d.ts +19 -0
  19. package/packages/client/dist/adapters/codex-adapter.js +2 -0
  20. package/packages/client/dist/adapters/cursor-adapter.d.ts +19 -0
  21. package/packages/client/dist/adapters/cursor-adapter.js +4 -0
  22. package/packages/client/dist/adapters/gemini-adapter.d.ts +18 -0
  23. package/packages/client/dist/adapters/gemini-adapter.js +2 -0
  24. package/packages/client/dist/adapters/index.d.ts +19 -0
  25. package/packages/client/dist/adapters/index.js +1 -0
  26. package/packages/client/dist/adapters/platform-detector.d.ts +48 -0
  27. package/packages/client/dist/adapters/platform-detector.js +1 -0
  28. package/packages/client/dist/adapters/target-adapter.d.ts +70 -0
  29. package/packages/client/dist/adapters/target-adapter.js +0 -0
  30. package/packages/client/dist/adapters/vscode-adapter.d.ts +19 -0
  31. package/packages/client/dist/adapters/vscode-adapter.js +2 -0
  32. package/packages/client/dist/agent/refresh-stubs.d.ts +90 -0
  33. package/packages/client/dist/agent/refresh-stubs.js +2 -0
  34. package/packages/client/dist/agent/update-agent-yaml.d.ts +26 -0
  35. package/packages/client/dist/agent/update-agent-yaml.js +1 -0
  36. package/packages/client/dist/agent/update-description.d.ts +45 -0
  37. package/packages/client/dist/agent/update-description.js +1 -0
  38. package/packages/client/dist/cache/crypto-utils.d.ts +30 -0
  39. package/packages/client/dist/cache/crypto-utils.js +1 -0
  40. package/packages/client/dist/cache/encrypted-cache.d.ts +30 -0
  41. package/packages/client/dist/cache/encrypted-cache.js +1 -0
  42. package/packages/client/dist/cache/in-memory-asset-cache.d.ts +62 -0
  43. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -0
  44. package/packages/client/dist/cache/index.d.ts +13 -0
  45. package/packages/client/dist/cache/index.js +1 -0
  46. package/packages/client/dist/cache/protected-pi-boundary.d.ts +19 -0
  47. package/packages/client/dist/cache/protected-pi-boundary.js +1 -0
  48. package/packages/client/dist/checkpoint/checkpoint-client-reader.d.ts +45 -0
  49. package/packages/client/dist/checkpoint/checkpoint-client-reader.js +2 -0
  50. package/packages/client/dist/checkpoint/index.d.ts +12 -0
  51. package/packages/client/dist/checkpoint/index.js +1 -0
  52. package/packages/client/dist/checkpoint/shared-checkpoint-types.d.ts +85 -0
  53. package/packages/client/dist/checkpoint/shared-checkpoint-types.js +1 -0
  54. package/packages/client/dist/cli.d.ts +14 -0
  55. package/packages/client/dist/cli.js +81 -0
  56. package/packages/client/dist/commands/activate.d.ts +55 -0
  57. package/packages/client/dist/commands/activate.js +8 -0
  58. package/packages/client/dist/commands/cache-status.d.ts +39 -0
  59. package/packages/client/dist/commands/cache-status.js +2 -0
  60. package/packages/client/dist/commands/invoke.d.ts +546 -0
  61. package/packages/client/dist/commands/invoke.js +140 -0
  62. package/packages/client/dist/commands/refresh-memory.d.ts +11 -0
  63. package/packages/client/dist/commands/refresh-memory.js +1 -0
  64. package/packages/client/dist/config/resolver-selection.d.ts +40 -0
  65. package/packages/client/dist/config/resolver-selection.js +1 -0
  66. package/packages/client/dist/config/secure-config.d.ts +78 -0
  67. package/packages/client/dist/config/secure-config.js +12 -0
  68. package/packages/client/dist/constants.d.ts +25 -0
  69. package/packages/client/dist/constants.js +1 -0
  70. package/packages/client/dist/context/context-collector.d.ts +28 -0
  71. package/packages/client/dist/context/context-collector.js +2 -0
  72. package/packages/client/dist/context/context-sanitizer.d.ts +28 -0
  73. package/packages/client/dist/context/context-sanitizer.js +1 -0
  74. package/packages/client/dist/continuity/autonomous-governance.d.ts +84 -0
  75. package/packages/client/dist/continuity/autonomous-governance.js +1 -0
  76. package/packages/client/dist/continuity/continuity-client-state-store.d.ts +302 -0
  77. package/packages/client/dist/continuity/continuity-client-state-store.js +1 -0
  78. package/packages/client/dist/continuity/invoke-hooks.d.ts +19 -0
  79. package/packages/client/dist/continuity/invoke-hooks.js +1 -0
  80. package/packages/client/dist/continuity/migrations/001-initial-schema.d.ts +11 -0
  81. package/packages/client/dist/continuity/migrations/001-initial-schema.js +263 -0
  82. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.d.ts +11 -0
  83. package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +7 -0
  84. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.d.ts +11 -0
  85. package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +62 -0
  86. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.d.ts +11 -0
  87. package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +19 -0
  88. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.d.ts +11 -0
  89. package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +35 -0
  90. package/packages/client/dist/continuity/outbox.d.ts +83 -0
  91. package/packages/client/dist/continuity/outbox.js +1 -0
  92. package/packages/client/dist/continuity/runner-bootstrap-policy.d.ts +50 -0
  93. package/packages/client/dist/continuity/runner-bootstrap-policy.js +1 -0
  94. package/packages/client/dist/continuity/sqlite-store.d.ts +926 -0
  95. package/packages/client/dist/continuity/sqlite-store.js +619 -0
  96. package/packages/client/dist/errors/error-messages.d.ts +40 -0
  97. package/packages/client/dist/errors/error-messages.js +2 -0
  98. package/packages/client/dist/graph-retrieval/pre-command-hook.d.ts +34 -0
  99. package/packages/client/dist/graph-retrieval/pre-command-hook.js +1 -0
  100. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.d.ts +99 -0
  101. package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +1 -0
  102. package/packages/client/dist/i18n/first-run.d.ts +23 -0
  103. package/packages/client/dist/i18n/first-run.js +2 -0
  104. package/packages/client/dist/index.d.ts +56 -0
  105. package/packages/client/dist/index.js +1 -0
  106. package/packages/client/dist/license/index.d.ts +5 -0
  107. package/packages/client/dist/license/index.js +1 -0
  108. package/packages/client/dist/license/license-client.d.ts +79 -0
  109. package/packages/client/dist/license/license-client.js +1 -0
  110. package/packages/client/dist/machine/fingerprint.d.ts +34 -0
  111. package/packages/client/dist/machine/fingerprint.js +2 -0
  112. package/packages/client/dist/machine/index.d.ts +5 -0
  113. package/packages/client/dist/machine/index.js +1 -0
  114. package/packages/client/dist/memory/project-memory-writer.d.ts +74 -0
  115. package/packages/client/dist/memory/project-memory-writer.js +36 -0
  116. package/packages/client/dist/memory/shared-project-memory-types.d.ts +370 -0
  117. package/packages/client/dist/memory/shared-project-memory-types.js +2 -0
  118. package/packages/client/dist/policy/architecture-policy.d.ts +40 -0
  119. package/packages/client/dist/policy/architecture-policy.js +2 -0
  120. package/packages/client/dist/policy/index.d.ts +8 -0
  121. package/packages/client/dist/policy/index.js +1 -0
  122. package/packages/client/dist/policy/shared-policy-types.d.ts +89 -0
  123. package/packages/client/dist/policy/shared-policy-types.js +0 -0
  124. package/packages/client/dist/resilience/circuit-breaker.d.ts +70 -0
  125. package/packages/client/dist/resilience/circuit-breaker.js +1 -0
  126. package/packages/client/dist/resilience/degradation-manager.d.ts +67 -0
  127. package/packages/client/dist/resilience/degradation-manager.js +1 -0
  128. package/packages/client/dist/resilience/freshness-indicator.d.ts +59 -0
  129. package/packages/client/dist/resilience/freshness-indicator.js +1 -0
  130. package/packages/client/dist/resilience/index.d.ts +8 -0
  131. package/packages/client/dist/resilience/index.js +1 -0
  132. package/packages/client/dist/resilience/recovery-detector.d.ts +59 -0
  133. package/packages/client/dist/resilience/recovery-detector.js +1 -0
  134. package/packages/client/dist/resolvers/asset-resolver.d.ts +79 -0
  135. package/packages/client/dist/resolvers/asset-resolver.js +0 -0
  136. package/packages/client/dist/resolvers/local-resolver.d.ts +26 -0
  137. package/packages/client/dist/resolvers/local-resolver.js +8 -0
  138. package/packages/client/dist/resolvers/remote-resolver.d.ts +91 -0
  139. package/packages/client/dist/resolvers/remote-resolver.js +1 -0
  140. package/packages/client/dist/runner/binary.d.ts +115 -0
  141. package/packages/client/dist/runner/binary.js +1 -0
  142. package/packages/client/dist/runner/cli.d.ts +168 -0
  143. package/packages/client/dist/runner/cli.js +70 -0
  144. package/packages/client/dist/runner/headless/adapters.d.ts +20 -0
  145. package/packages/client/dist/runner/headless/adapters.js +1 -0
  146. package/packages/client/dist/runner/headless/claude-code-adapter.d.ts +8 -0
  147. package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -0
  148. package/packages/client/dist/runner/headless/fake-adapter.d.ts +8 -0
  149. package/packages/client/dist/runner/headless/fake-adapter.js +1 -0
  150. package/packages/client/dist/runner/headless/opencode-adapter.d.ts +15 -0
  151. package/packages/client/dist/runner/headless/opencode-adapter.js +2 -0
  152. package/packages/client/dist/runner/headless/resolver.d.ts +68 -0
  153. package/packages/client/dist/runner/headless/resolver.js +1 -0
  154. package/packages/client/dist/runner/headless/run-yolo.d.ts +59 -0
  155. package/packages/client/dist/runner/headless/run-yolo.js +1 -0
  156. package/packages/client/dist/runner/headless/run-yoloop.d.ts +113 -0
  157. package/packages/client/dist/runner/headless/run-yoloop.js +1 -0
  158. package/packages/client/dist/runner/headless/types.d.ts +194 -0
  159. package/packages/client/dist/runner/headless/types.js +2 -0
  160. package/packages/client/dist/runner/local-console.d.ts +83 -0
  161. package/packages/client/dist/runner/local-console.js +13 -0
  162. package/packages/client/dist/runner/portal-sync-worker.d.ts +184 -0
  163. package/packages/client/dist/runner/portal-sync-worker.js +1 -0
  164. package/packages/client/dist/runner/project-identity.d.ts +19 -0
  165. package/packages/client/dist/runner/project-identity.js +1 -0
  166. package/packages/client/dist/runner/scheduler.d.ts +186 -0
  167. package/packages/client/dist/runner/scheduler.js +7 -0
  168. package/packages/client/dist/runner-cli.d.ts +9 -0
  169. package/packages/client/dist/runner-cli.js +3 -0
  170. package/packages/client/dist/state/project-state-snapshot.d.ts +24 -0
  171. package/packages/client/dist/state/project-state-snapshot.js +1 -0
  172. package/packages/client/dist/state/state-json-repair.d.ts +74 -0
  173. package/packages/client/dist/state/state-json-repair.js +3 -0
  174. package/packages/client/dist/telemetry/index.d.ts +5 -0
  175. package/packages/client/dist/telemetry/index.js +1 -0
  176. package/packages/client/dist/telemetry/offline-queue.d.ts +57 -0
  177. package/packages/client/dist/telemetry/offline-queue.js +1 -0
  178. package/packages/client/dist/tier/index.d.ts +5 -0
  179. package/packages/client/dist/tier/index.js +1 -0
  180. package/packages/client/dist/tier/tier-aware-client.d.ts +105 -0
  181. package/packages/client/dist/tier/tier-aware-client.js +1 -0
  182. package/packages/client/dist/types/index.d.ts +140 -0
  183. package/packages/client/dist/types/index.js +1 -0
  184. package/packages/client/dist/yoloop/discovery-hook.d.ts +85 -0
  185. package/packages/client/dist/yoloop/discovery-hook.js +2 -0
  186. package/packages/client/dist/yoloop/index.d.ts +10 -0
  187. package/packages/client/dist/yoloop/index.js +1 -0
  188. package/packages/client/dist/yoloop/invoke-hooks.d.ts +127 -0
  189. package/packages/client/dist/yoloop/invoke-hooks.js +5 -0
  190. package/packages/client/dist/yoloop/shared-discover-epics.d.ts +289 -0
  191. package/packages/client/dist/yoloop/shared-discover-epics.js +1 -0
  192. package/packages/client/dist/yoloop/shared-yoloop-types.d.ts +172 -0
  193. package/packages/client/dist/yoloop/shared-yoloop-types.js +1 -0
  194. package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +124 -0
  195. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -0
  196. package/postinstall.js +754 -0
  197. package/targets-stubs/antigravity/README.md +36 -0
  198. package/targets-stubs/antigravity/gemini.md +29 -0
  199. package/targets-stubs/antigravity/install-antigravity.sh +153 -0
  200. package/targets-stubs/antigravity/mcp-config.json +30 -0
  201. package/targets-stubs/antigravity/skill/SKILL.md +166 -0
  202. package/targets-stubs/claude-code/.mcp.json +32 -0
  203. package/targets-stubs/claude-code/README.md +20 -0
  204. package/targets-stubs/claude-code/neocortex-root.agent.yaml +42 -0
  205. package/targets-stubs/claude-code/neocortex-root.md +317 -0
  206. package/targets-stubs/claude-code/neocortex.agent.yaml +42 -0
  207. package/targets-stubs/claude-code/neocortex.md +385 -0
  208. package/targets-stubs/codex/AGENTS.md +250 -0
  209. package/targets-stubs/codex/README.md +47 -0
  210. package/targets-stubs/codex/config-mcp.toml +22 -0
  211. package/targets-stubs/codex/install-codex.sh +63 -0
  212. package/targets-stubs/codex/neocortex.toml +33 -0
  213. package/targets-stubs/cursor/README.md +33 -0
  214. package/targets-stubs/cursor/agent.md +211 -0
  215. package/targets-stubs/cursor/install-cursor.sh +50 -0
  216. package/targets-stubs/cursor/mcp.json +30 -0
  217. package/targets-stubs/gemini-cli/README.md +34 -0
  218. package/targets-stubs/gemini-cli/agent.md +241 -0
  219. package/targets-stubs/gemini-cli/agents/neocortex.md +60 -0
  220. package/targets-stubs/gemini-cli/gemini.md +46 -0
  221. package/targets-stubs/gemini-cli/install-gemini.sh +70 -0
  222. package/targets-stubs/gemini-cli/settings-mcp.json +30 -0
  223. package/targets-stubs/kimi/mcp.json +33 -0
  224. package/targets-stubs/kimi/neocortex.md +60 -0
  225. package/targets-stubs/lib/mcp-merge.js +189 -0
  226. package/targets-stubs/openclaw/README.md +12 -0
  227. package/targets-stubs/openclaw/SKILL.md +92 -0
  228. package/targets-stubs/opencode/neocortex-root.md +267 -0
  229. package/targets-stubs/opencode/neocortex.md +65 -0
  230. package/targets-stubs/opencode/opencode-mcp.json +35 -0
  231. package/targets-stubs/vscode/README.md +34 -0
  232. package/targets-stubs/vscode/copilot-instructions.md +47 -0
  233. package/targets-stubs/vscode/install-vscode.sh +72 -0
  234. package/targets-stubs/vscode/mcp.json +36 -0
  235. package/targets-stubs/vscode/neocortex.agent.md +252 -0
@@ -0,0 +1,546 @@
1
+ /**
2
+ * @license FSL-1.1
3
+ * Copyright (c) 2026 OrNexus AI
4
+ *
5
+ * This file is part of Neocortex CLI, licensed under the
6
+ * Functional Source License, Version 1.1 (FSL-1.1).
7
+ *
8
+ * Change Date: February 20, 2029
9
+ * Change License: MIT
10
+ *
11
+ * See the LICENSE file in the project root for full license text.
12
+ */
13
+ import type { YoloopPersistedState } from '../yoloop/shared-yoloop-types.js';
14
+ import { type RunnerBootstrapPolicyDecision } from '../continuity/runner-bootstrap-policy.js';
15
+ import { type RunnerSchedulerBootstrapOptions, type RunnerSchedulerBootstrapResult } from '../runner/scheduler.js';
16
+ import { type ContinuityProcessingSummaryCursorTarget } from '../continuity/continuity-client-state-store.js';
17
+ export declare const INVOKE_PAYLOAD_LIMIT_BYTES: number;
18
+ export declare const INVOKE_PAYLOAD_WARNING_THRESHOLD_BYTES: number;
19
+ interface InitProjectMemoryBootstrapSnapshot {
20
+ readonly canonical: {
21
+ readonly path: 'NEOCORTEX.md';
22
+ readonly exists: boolean;
23
+ readonly incompleteReasons: readonly string[];
24
+ readonly confidence: 'high' | 'medium' | 'low';
25
+ };
26
+ readonly permittedSources: {
27
+ readonly packageBuildFiles: number;
28
+ readonly architectureReadmeDocs: number;
29
+ readonly runtimeConfigTemplates: number;
30
+ readonly platformWrappers: number;
31
+ };
32
+ readonly wrapperFiles: readonly string[];
33
+ readonly recommendedPreviewCommand: string;
34
+ readonly recommendedRefreshCommand: string;
35
+ readonly guardrails: readonly string[];
36
+ }
37
+ export declare function isInitTrigger(args: string): boolean;
38
+ export declare function collectInitProjectMemoryBootstrapSnapshot(projectRoot: string): InitProjectMemoryBootstrapSnapshot;
39
+ export interface InvokeOptions {
40
+ /** Raw args from the user (e.g., "*yolo @docs/stories/1.1.story.md") */
41
+ readonly args: string;
42
+ /** Project root directory (default: cwd; Git repository not required) */
43
+ readonly projectRoot?: string;
44
+ /** Output format: 'json' for full response, 'plain' for instructions only */
45
+ readonly format?: 'json' | 'plain';
46
+ /** Server URL override */
47
+ readonly serverUrl?: string;
48
+ /** Platform target (default: 'claude-code') */
49
+ readonly platformTarget?: string;
50
+ /** CLI input source, used to decide when stdin/args-file need chunk transport. */
51
+ readonly inputSource?: InvokeCliInputSource;
52
+ /** Foreground local continuity watcher requested by CLI `--watch`. */
53
+ readonly watch?: boolean;
54
+ /** Test/integration seam for runner auto-bootstrap; CLI callers leave unset. */
55
+ readonly runnerBootstrapper?: InvokeRunnerSchedulerBootstrapper;
56
+ /** Test/integration seam for recursion guard env; CLI callers leave unset. */
57
+ readonly environment?: NodeJS.ProcessEnv;
58
+ }
59
+ /**
60
+ * Normalize the project root received from wrappers/CLI flags.
61
+ *
62
+ * Generated platform wrappers historically used
63
+ * `$(git rev-parse --show-toplevel)`. In a legitimate non-Git workspace that
64
+ * command expands to an empty string, which then reached the server as
65
+ * `projectRoot: ""` and was rejected by request validation before orchestration
66
+ * could run. Treat a missing/blank value as the current working directory so
67
+ * projects that intentionally do not have a Git repository can still invoke
68
+ * Neocortex commands.
69
+ */
70
+ export declare function resolveInvokeProjectRoot(projectRoot: string | undefined, fallbackRoot?: string): string;
71
+ export interface InvokeResult {
72
+ readonly success: boolean;
73
+ readonly instructions?: string;
74
+ readonly metadata?: Record<string, unknown>;
75
+ readonly error?: string;
76
+ readonly errorCode?: string;
77
+ readonly exitCode: number;
78
+ }
79
+ type InvokeWatchFormat = 'plain' | 'json';
80
+ interface InvokeWatchWritable {
81
+ write(chunk: string): unknown;
82
+ }
83
+ export interface InvokeWatchOptions {
84
+ readonly projectRoot: string;
85
+ readonly format: InvokeWatchFormat;
86
+ readonly stdout?: InvokeWatchWritable;
87
+ readonly signal?: AbortSignal;
88
+ readonly target?: ContinuityProcessingSummaryCursorTarget;
89
+ readonly targetJobId?: string;
90
+ readonly serverHeldStream?: false;
91
+ readonly initialCursor?: string;
92
+ readonly limit?: number;
93
+ readonly pollIntervalMs?: number;
94
+ readonly maxIdlePolls?: number;
95
+ readonly maxPolls?: number;
96
+ readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
97
+ }
98
+ type InvokeWatchTargetResolutionState = 'inactive' | 'pending' | 'resolved' | 'unresolved' | 'malformed' | 'ambiguous' | 'multiple' | 'unsafe' | 'unavailable';
99
+ type InvokeWatchSnapshotStatus = 'not_requested' | 'pending' | 'available' | 'empty' | 'unavailable' | 'unsafe';
100
+ type InvokeWatchCursorState = 'not_started' | 'unchanged' | 'advanced' | 'exhausted' | 'unavailable';
101
+ type InvokeWatchLifecycleStatus = 'inactive' | 'active' | 'polling' | 'waiting' | 'stopped' | 'blocked';
102
+ type InvokeWatchStopReason = 'not_stopped' | 'idle_limit_reached' | 'max_polls_reached' | 'target_unresolved' | 'cancelled' | 'error' | 'unsafe_evidence' | 'unavailable_evidence';
103
+ interface InvokeWatchTargetEvidence {
104
+ readonly schemaVersion: 1;
105
+ readonly contractVersion: 'continuity-v1';
106
+ readonly targetResolutionState: InvokeWatchTargetResolutionState;
107
+ readonly targetKind?: ContinuityProcessingSummaryCursorTarget['selectorKind'];
108
+ readonly targetId?: string;
109
+ readonly targetJobId?: string;
110
+ readonly jobId?: string;
111
+ readonly goalId?: string;
112
+ readonly loopId?: string;
113
+ readonly relatedJobIds?: readonly string[];
114
+ readonly relatedJobCount?: number;
115
+ readonly reasonCodes: readonly string[];
116
+ readonly publicSafe: true;
117
+ }
118
+ interface InvokeWatchSnapshotEvidence {
119
+ readonly schemaVersion: 1;
120
+ readonly contractVersion: 'continuity-v1';
121
+ readonly snapshotStatus: InvokeWatchSnapshotStatus;
122
+ readonly generatedAt?: string;
123
+ readonly renderedSummaryCount?: number;
124
+ readonly latestEventId?: string;
125
+ readonly reasonCodes: readonly string[];
126
+ readonly publicSafe: true;
127
+ }
128
+ interface InvokeWatchCursorEvidence {
129
+ readonly schemaVersion: 1;
130
+ readonly contractVersion: 'continuity-v1';
131
+ readonly cursorState: InvokeWatchCursorState;
132
+ readonly initialCursor?: string;
133
+ readonly currentCursor?: string;
134
+ readonly nextCursor?: string;
135
+ readonly cursorAdvanced?: boolean;
136
+ readonly eventId?: string;
137
+ readonly reasonCodes: readonly string[];
138
+ readonly publicSafe: true;
139
+ }
140
+ export interface InvokeWatchStatusRecord {
141
+ readonly type: 'watch_status';
142
+ readonly schemaVersion: 1;
143
+ readonly contractVersion: 'continuity-v1';
144
+ readonly recordType: 'watch_status';
145
+ readonly command: 'invoke';
146
+ readonly operation: 'watch';
147
+ readonly watchStatus: InvokeWatchLifecycleStatus;
148
+ readonly active: boolean;
149
+ readonly targetResolutionState?: InvokeWatchTargetResolutionState;
150
+ readonly targetKind?: ContinuityProcessingSummaryCursorTarget['selectorKind'];
151
+ readonly targetId?: string;
152
+ readonly targetEvidence?: InvokeWatchTargetEvidence;
153
+ readonly snapshotEvidence?: InvokeWatchSnapshotEvidence;
154
+ readonly cursorEvidence?: InvokeWatchCursorEvidence;
155
+ readonly stopReason?: InvokeWatchStopReason;
156
+ readonly reasonCodes: readonly string[];
157
+ readonly generatedAt: string;
158
+ readonly publicSafe: true;
159
+ }
160
+ export interface InvokeWatchResult {
161
+ readonly status: 'completed' | 'cancelled' | 'idle-timeout' | 'max-polls' | 'store-unavailable' | 'target-unresolved';
162
+ readonly summariesEmitted: number;
163
+ readonly polls: number;
164
+ readonly reasonCodes: readonly string[];
165
+ readonly watchStatus?: InvokeWatchLifecycleStatus;
166
+ readonly stopReason?: InvokeWatchStopReason;
167
+ readonly targetEvidence?: InvokeWatchTargetEvidence;
168
+ readonly snapshotEvidence?: InvokeWatchSnapshotEvidence;
169
+ readonly cursorEvidence?: InvokeWatchCursorEvidence;
170
+ readonly statusRecord?: InvokeWatchStatusRecord;
171
+ readonly metadata?: Record<string, unknown>;
172
+ readonly publicSafe: true;
173
+ }
174
+ type InvokeWatchTargetSource = 'watcher-metadata' | 'goal-loop-continuity-metadata' | 'continuity-state-update-operation-log' | 'explicit-args';
175
+ interface InvokeWatchTarget {
176
+ readonly target?: ContinuityProcessingSummaryCursorTarget;
177
+ readonly targetJobId?: string;
178
+ readonly initialCursor?: string;
179
+ readonly source?: InvokeWatchTargetSource;
180
+ readonly serverHeldStream?: false;
181
+ readonly disabled?: boolean;
182
+ readonly reasonCodes?: readonly string[];
183
+ }
184
+ export interface InvokeRunnerBootstrapMetadata {
185
+ readonly schemaVersion: 1;
186
+ readonly action: RunnerBootstrapPolicyDecision['action'];
187
+ readonly failurePolicy: RunnerBootstrapPolicyDecision['failurePolicy'];
188
+ readonly command: RunnerBootstrapPolicyDecision['command'];
189
+ readonly operation: RunnerBootstrapPolicyDecision['operation'];
190
+ readonly attempted: boolean;
191
+ readonly ok: boolean;
192
+ readonly cached: boolean;
193
+ readonly installed: boolean;
194
+ readonly started: boolean;
195
+ readonly projectKey?: string;
196
+ readonly reasonCodes: readonly string[];
197
+ readonly publicSummary: string;
198
+ readonly failOpenWarning?: boolean;
199
+ readonly publicSafe: true;
200
+ }
201
+ export interface InvokeRunnerAutoBootstrapResult {
202
+ readonly shouldContinue: boolean;
203
+ readonly attachToRequest: boolean;
204
+ readonly metadata: InvokeRunnerBootstrapMetadata;
205
+ readonly warning?: string;
206
+ readonly error?: string;
207
+ readonly errorCode?: string;
208
+ readonly exitCode?: number;
209
+ }
210
+ export type InvokeRunnerSchedulerBootstrapper = (options: RunnerSchedulerBootstrapOptions) => Promise<RunnerSchedulerBootstrapResult>;
211
+ export interface InvokeRunnerAutoBootstrapOptions {
212
+ readonly args: string;
213
+ readonly projectRoot: string;
214
+ readonly platformTarget: string;
215
+ readonly environment?: NodeJS.ProcessEnv;
216
+ readonly bootstrapper?: InvokeRunnerSchedulerBootstrapper;
217
+ }
218
+ export declare function sanitizeInvokeCliOutput(instructions: string | undefined, metadata: Record<string, unknown> | undefined): {
219
+ instructions: string;
220
+ metadata: Record<string, unknown> | undefined;
221
+ };
222
+ type InvokeCliInputSource = 'args' | 'stdin' | 'args-file';
223
+ export interface InvokeCliParsedOptions {
224
+ readonly args: string;
225
+ readonly inputSource: InvokeCliInputSource;
226
+ readonly projectRoot?: string;
227
+ readonly format: 'json' | 'plain';
228
+ readonly watch: boolean;
229
+ readonly commandLevelWatch?: InvokeCommandLevelWatchMetadata;
230
+ readonly serverUrl?: string;
231
+ }
232
+ type InvokeCommandLevelWatchCommand = 'goal' | 'loop' | 'jobs';
233
+ type InvokeCommandLevelWatchOperation = 'create' | 'start' | 'resume' | 'run-once' | 'watch';
234
+ interface InvokeCommandLevelWatchTokenSpan {
235
+ readonly literal: '--watch';
236
+ readonly position: 'final';
237
+ readonly start: number;
238
+ readonly end: number;
239
+ readonly quoted: false;
240
+ readonly publicSafe: true;
241
+ }
242
+ export interface InvokeCommandLevelWatchMetadata {
243
+ readonly schemaVersion: 1;
244
+ readonly contractVersion: 'continuity-v1';
245
+ readonly command?: InvokeCommandLevelWatchCommand;
246
+ readonly operation?: InvokeCommandLevelWatchOperation;
247
+ readonly active: boolean;
248
+ readonly watchToken?: InvokeCommandLevelWatchTokenSpan;
249
+ readonly reasonCodes: readonly string[];
250
+ readonly serverHeldStream: false;
251
+ readonly allJobsPolling: false;
252
+ readonly targetResolution: 'required-after-dispatch' | 'inactive';
253
+ readonly publicSafe: true;
254
+ }
255
+ export interface InvokeCommandLevelWatchResolution {
256
+ readonly args: string;
257
+ readonly watch: boolean;
258
+ readonly reasonCodes: readonly string[];
259
+ readonly metadata: InvokeCommandLevelWatchMetadata;
260
+ readonly publicSafe: true;
261
+ }
262
+ export interface InvokeCliInputReaders {
263
+ readonly readStdin?: () => string;
264
+ readonly readArgsFile?: (filePath: string) => string;
265
+ }
266
+ export declare class InvokeCliInputError extends Error {
267
+ readonly code: string;
268
+ constructor(code: string, message: string);
269
+ }
270
+ export type StateSnapshotScopeKind = 'full' | 'projected';
271
+ export type StateSnapshotCommandPolicy = 'full' | 'story-targeted' | 'epic-targeted' | 'yoloop-targeted' | 'epic-summary' | 'continuity-scoped' | 'adaptive-targeted' | (string & {});
272
+ export type StateSnapshotProjectionMode = 'full-compatible' | 'summary-only' | 'targeted-story' | 'targeted-epic' | 'structural-required' | (string & {});
273
+ export type StateSnapshotProjectionReason = 'full-state' | 'targeted-invocation' | 'summary-only' | 'epic-summary' | 'body-size' | 'context-cost' | 'unknown' | (string & {});
274
+ interface StateSnapshotScopeBase {
275
+ readonly kind: StateSnapshotScopeKind;
276
+ readonly commandId?: string | null;
277
+ readonly stateProjectionPolicy?: StateSnapshotCommandPolicy | null;
278
+ readonly projectionMode?: StateSnapshotProjectionMode;
279
+ readonly trigger?: string;
280
+ readonly targetEpicId?: string | null;
281
+ readonly targetStoryId?: string | null;
282
+ readonly includedStoryCount: number;
283
+ readonly includedEpicCount?: number;
284
+ readonly omittedStoryCount: number;
285
+ readonly omittedEpicCount: number;
286
+ readonly reason: StateSnapshotProjectionReason;
287
+ readonly reasonCodes?: readonly string[];
288
+ }
289
+ export interface FullStateSnapshotScope extends StateSnapshotScopeBase {
290
+ readonly kind: 'full';
291
+ readonly omittedStoryCount: 0;
292
+ readonly omittedEpicCount: 0;
293
+ readonly reason: 'full-state';
294
+ }
295
+ export interface ProjectedStateSnapshotScope extends StateSnapshotScopeBase {
296
+ readonly kind: 'projected';
297
+ }
298
+ export type StateSnapshotScope = FullStateSnapshotScope | ProjectedStateSnapshotScope;
299
+ export interface StateSnapshotCurrentSession {
300
+ readonly active_epic_id?: string | null;
301
+ readonly active_story_id?: string | null;
302
+ readonly active_step_id?: string | null;
303
+ readonly session_id?: string | null;
304
+ readonly started_at?: string | null;
305
+ }
306
+ export interface StateSummaryRecentStoryRef {
307
+ readonly id: string;
308
+ readonly epicId?: string;
309
+ readonly status?: string;
310
+ readonly lastStep?: string;
311
+ readonly lastUpdated?: string;
312
+ }
313
+ export interface StateSummarySessionRef {
314
+ readonly activeEpicId?: string | null;
315
+ readonly activeStoryId?: string | null;
316
+ readonly activeStepId?: string | null;
317
+ readonly sessionId?: string | null;
318
+ readonly startedAt?: string | null;
319
+ }
320
+ export interface StateSummaryYoloopRef {
321
+ readonly active?: boolean;
322
+ readonly currentEpicId?: string | null;
323
+ readonly currentStoryId?: string | null;
324
+ readonly sessionId?: string | null;
325
+ readonly lockEpicId?: string | null;
326
+ }
327
+ export interface StateSummaryContinuityRef {
328
+ readonly present: boolean;
329
+ readonly activeJobId?: string | null;
330
+ readonly activeGoalId?: string | null;
331
+ readonly activeLoopId?: string | null;
332
+ readonly reasonCodes?: readonly string[];
333
+ }
334
+ export interface StateSummaryProjectionRef {
335
+ readonly commandId?: string | null;
336
+ readonly stateProjectionPolicy?: StateSnapshotCommandPolicy | null;
337
+ readonly projectionMode?: StateSnapshotProjectionMode;
338
+ readonly scopeKind: StateSnapshotScopeKind;
339
+ readonly includedStoryCount: number;
340
+ readonly includedEpicCount: number;
341
+ readonly omittedStoryCount: number;
342
+ readonly omittedEpicCount: number;
343
+ readonly reason: StateSnapshotProjectionReason;
344
+ }
345
+ export interface StateSummary {
346
+ readonly schemaVersion: 1;
347
+ readonly totals: {
348
+ readonly stories: number;
349
+ readonly epics: number;
350
+ readonly storyStatus: Readonly<Record<string, number>>;
351
+ readonly epicStatus: Readonly<Record<string, number>>;
352
+ readonly blockedStories: number;
353
+ };
354
+ readonly active: {
355
+ readonly epicId: string | null;
356
+ readonly storyId: string | null;
357
+ readonly stepId: string | null;
358
+ };
359
+ readonly blockedCount: number;
360
+ readonly recentStories: readonly StateSummaryRecentStoryRef[];
361
+ readonly currentSession?: StateSummarySessionRef;
362
+ readonly currentYoloopSession?: StateSummaryYoloopRef;
363
+ readonly currentContinuitySession?: StateSummaryContinuityRef;
364
+ readonly projection: StateSummaryProjectionRef;
365
+ readonly reasonCodes: readonly string[];
366
+ readonly publicSafe: true;
367
+ }
368
+ export interface StateSnapshot {
369
+ readonly schema_version?: number;
370
+ readonly config: {
371
+ readonly project_name: string;
372
+ readonly default_branch: string;
373
+ readonly language: string;
374
+ readonly yolo_mode?: boolean;
375
+ readonly user_name?: string;
376
+ readonly worktree_base?: string;
377
+ readonly max_parallel_stories?: number;
378
+ };
379
+ readonly stories: Record<string, Record<string, unknown>>;
380
+ readonly epics: Record<string, Record<string, unknown>>;
381
+ readonly current_session?: StateSnapshotCurrentSession;
382
+ /**
383
+ * P141.01 -- request-only scope metadata. Never persisted to state.json.
384
+ * `projected` snapshots mean omitted entries are unknown/out-of-scope for
385
+ * this request, not nonexistent.
386
+ */
387
+ readonly scope?: StateSnapshotScope;
388
+ /**
389
+ * P198.03 -- bounded public-safe state affordance attached to request-only
390
+ * invoke snapshots. Never persisted to `.neocortex/state.json`.
391
+ */
392
+ readonly stateSummary?: StateSummary;
393
+ /**
394
+ * Epic P101.03 -- yoloop client-side persisted state echoed on each invoke
395
+ * so the server can treat yoloop as a pure function over client state.
396
+ * Optional during the P101 rollout; once MIN_CLIENT_VERSION bumps (P101.11),
397
+ * yoloop invocations without this field will receive CLIENT_UPGRADE_REQUIRED.
398
+ */
399
+ readonly yoloop?: YoloopPersistedState;
400
+ /**
401
+ * P180.05 -- optional client-owned Enterprise continuity snapshot.
402
+ * Compact/public-safe only; omitted when the SQLite store is absent or an
403
+ * adapter is unavailable for non-continuity commands.
404
+ */
405
+ readonly continuity?: unknown;
406
+ /**
407
+ * P158.06 -- optional client-side deterministic graph retrieval enrichment.
408
+ * This is request-only metadata for server validation/consumption; it never
409
+ * decides workflow locally and is omitted when disabled or unavailable.
410
+ */
411
+ readonly graphRetrieval?: unknown;
412
+ /**
413
+ * P181.04 -- request-only runner auto-bootstrap summary. Public-safe only;
414
+ * never persisted to `.neocortex/state.json` and omitted for unrelated
415
+ * non-continuity commands.
416
+ */
417
+ readonly runnerBootstrap?: InvokeRunnerBootstrapMetadata;
418
+ }
419
+ export interface InvokeArgsRef {
420
+ readonly manifestId: string;
421
+ readonly sha256?: string;
422
+ readonly byteLength?: number;
423
+ readonly chunkCount?: number;
424
+ readonly expiresAt?: string;
425
+ }
426
+ interface InvokeRequestBodyBase {
427
+ readonly projectRoot: string;
428
+ readonly stateSnapshot: StateSnapshot;
429
+ readonly platformTarget?: string;
430
+ }
431
+ export type InvokeRequestBody = InvokeRequestBodyBase & ({
432
+ readonly args: string;
433
+ readonly argsRef?: never;
434
+ } | {
435
+ readonly args?: never;
436
+ readonly argsRef: InvokeArgsRef;
437
+ });
438
+ export interface InvokePayloadTelemetry {
439
+ readonly schemaVersion: 1;
440
+ readonly payloadBytes: number;
441
+ readonly limitBytes: number;
442
+ readonly warningThresholdBytes: number;
443
+ readonly scope: {
444
+ readonly kind: StateSnapshotScopeKind;
445
+ readonly projectionMode?: StateSnapshotProjectionMode;
446
+ readonly commandId?: string | null;
447
+ readonly stateProjectionPolicy?: StateSnapshotCommandPolicy | null;
448
+ };
449
+ readonly includedStories: number;
450
+ readonly omittedStories: number;
451
+ readonly includedEpics: number;
452
+ readonly omittedEpics: number;
453
+ readonly graphRetrieval: {
454
+ readonly accepted: boolean;
455
+ readonly itemCount: number;
456
+ };
457
+ readonly reasonCodes: readonly string[];
458
+ readonly publicSafe: true;
459
+ }
460
+ export interface InvokePayloadGuardrailResult {
461
+ readonly body: InvokeRequestBody;
462
+ readonly telemetry: InvokePayloadTelemetry;
463
+ readonly degraded: boolean;
464
+ }
465
+ export declare class InvokePayloadTooLargeError extends Error {
466
+ readonly code = "PAYLOAD_TOO_LARGE";
467
+ readonly telemetry: InvokePayloadTelemetry;
468
+ constructor(telemetry: InvokePayloadTelemetry);
469
+ }
470
+ /**
471
+ * P103.02: Describe a schema-drift issue detected in a user's state.json.
472
+ * Codes map to concrete misalignments against the canonical v1 schema
473
+ * documented in docs/arquitetura-software/STATE-JSON-SCHEMA.md.
474
+ */
475
+ export interface SchemaDriftIssue {
476
+ readonly code: 'PLANNING_LEGACY' | 'STORIES_AS_ARRAY' | 'EPIC_STORIES_NOT_ARRAY' | 'SCHEMA_VERSION_MISSING' | 'SCHEMA_VERSION_OUTDATED';
477
+ readonly message: string;
478
+ }
479
+ /**
480
+ * P103.02: Detect legacy/malformed shapes that cause the orchestrator to
481
+ * silently treat the workspace as empty. Pure function — does NOT emit
482
+ * warnings, does NOT throw. Returns empty array when the shape looks v1-OK
483
+ * or when state has no data (new project).
484
+ */
485
+ export declare function detectStateSchemaDrift(stateData: unknown): SchemaDriftIssue[];
486
+ /**
487
+ * P103.02 test utility: reset the one-time flag between test cases.
488
+ * Exported for tests only; not part of the public API.
489
+ */
490
+ export declare function __resetSchemaDriftWarnedForTests(): void;
491
+ /**
492
+ * Read state.json and construct a sanitized snapshot for the server.
493
+ * Relative paths only - no absolute paths sent to server.
494
+ */
495
+ export declare function collectStateSnapshot(projectRoot: string): StateSnapshot;
496
+ export declare function createFullStateSnapshotScope(trigger: string, snapshot: Pick<StateSnapshot, 'stories' | 'epics'>): FullStateSnapshotScope;
497
+ export declare function computeInvokeRequestBodySizeBytes(body: InvokeRequestBody): number;
498
+ export declare function createInvokePayloadTelemetry(body: InvokeRequestBody, payloadBytes?: number, reasonCodes?: readonly string[], options?: {
499
+ readonly limitBytes?: number;
500
+ readonly warningThresholdBytes?: number;
501
+ }): InvokePayloadTelemetry;
502
+ export declare function guardInvokeRequestBodySize(body: InvokeRequestBody, options?: {
503
+ readonly limitBytes?: number;
504
+ readonly warningThresholdBytes?: number;
505
+ }): InvokePayloadGuardrailResult;
506
+ export declare function maybeEmitInvokePayloadSizeWarning(body: InvokeRequestBody): number;
507
+ export declare function maybeRunInvokeRunnerAutoBootstrap(options: InvokeRunnerAutoBootstrapOptions): Promise<InvokeRunnerAutoBootstrapResult>;
508
+ export declare function watchContinuityProcessingSummaries(options: InvokeWatchOptions): Promise<InvokeWatchResult>;
509
+ export declare function resolveInvokeCommandLevelWatch(args: string): InvokeCommandLevelWatchResolution;
510
+ export declare function resolveInvokeWatchTarget(metadata: Record<string, unknown> | undefined, args: string): InvokeWatchTarget;
511
+ /**
512
+ * Execute the invoke command.
513
+ *
514
+ * Flow:
515
+ * 1. Load config to get server URL
516
+ * 2. Collect state snapshot from project root
517
+ * 3. Check menu cache for empty invocations
518
+ * 4. Send POST /api/v1/invoke
519
+ * 5. Format and return result
520
+ */
521
+ export declare function invoke(options: InvokeOptions): Promise<InvokeResult>;
522
+ /**
523
+ * Extract the canonical trigger for client-side pre-flight checks.
524
+ * Mirrors server tolerant parsing only for explicit first-token command forms:
525
+ * `*yolo`, `yolo`, `22`, and registered aliases. It deliberately does not
526
+ * infer commands from free text or paths, so uncertain server-side inference
527
+ * remains fail-open and cannot block local invocation.
528
+ */
529
+ export declare function extractPreFlightTrigger(args: string): string | null;
530
+ export declare const INVOKE_HELP_TEXT: string;
531
+ export declare function parseInvokeCliOptions(argv: string[], readers?: InvokeCliInputReaders): InvokeCliParsedOptions;
532
+ export declare function writeInvokeCliSuccessOutput(result: InvokeResult, parsed: Pick<InvokeCliParsedOptions, 'format' | 'watch' | 'commandLevelWatch'>, stdout?: InvokeWatchWritable, stderr?: InvokeWatchWritable): void;
533
+ /**
534
+ * CLI handler for the invoke command.
535
+ * Parses CLI args and delegates to invoke().
536
+ *
537
+ * Usage:
538
+ * neocortex-client invoke --args "*yolo @story.md" --project-root /path
539
+ * neocortex-client invoke --args "*status" --format json
540
+ * neocortex-client invoke --args "*jobs watch @goal-G001 --watch" --format json
541
+ * neocortex-client invoke --args "*jobs watch @loop-L001" --watch
542
+ * neocortex-client invoke --stdin < synthetic.story.md
543
+ * neocortex-client invoke --args-file ./synthetic.story.md
544
+ */
545
+ export declare function invokeCliHandler(argv: string[]): Promise<number>;
546
+ export {};