@ornexus/neocortex 4.60.49 → 4.60.51

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 (38) hide show
  1. package/dist/sbom.cdx.json +23 -23
  2. package/install.ps1 +1 -1
  3. package/install.sh +1 -1
  4. package/package.json +2 -2
  5. package/packages/client/dist/adapters/platform-detector.d.ts +9 -0
  6. package/packages/client/dist/adapters/platform-detector.js +1 -1
  7. package/packages/client/dist/cli.js +3 -2
  8. package/packages/client/dist/commands/invoke.d.ts +4 -0
  9. package/packages/client/dist/commands/invoke.js +49 -49
  10. package/packages/client/dist/commands/native-agent.d.ts +1 -0
  11. package/packages/client/dist/commands/native-agent.js +2 -0
  12. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.d.ts +9 -0
  13. package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +48 -0
  14. package/packages/client/dist/continuity/native-agent-store.d.ts +13 -0
  15. package/packages/client/dist/continuity/native-agent-store.js +1 -0
  16. package/packages/client/dist/continuity/native-agent-types.d.ts +54 -0
  17. package/packages/client/dist/continuity/native-agent-types.js +1 -0
  18. package/packages/client/dist/continuity/sqlite-store.d.ts +43 -2
  19. package/packages/client/dist/continuity/sqlite-store.js +88 -62
  20. package/packages/client/dist/index.d.ts +1 -0
  21. package/packages/client/dist/index.js +1 -1
  22. package/packages/client/dist/yoloop/invoke-hooks.d.ts +4 -3
  23. package/packages/client/dist/yoloop/invoke-hooks.js +11 -11
  24. package/packages/client/dist/yoloop/shared-yoloop-types.d.ts +21 -1
  25. package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +17 -1
  26. package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1
  27. package/targets-stubs/antigravity/gemini.md +1 -1
  28. package/targets-stubs/antigravity/skill/SKILL.md +1 -1
  29. package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
  30. package/targets-stubs/claude-code/neocortex-root.md +2 -2
  31. package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
  32. package/targets-stubs/claude-code/neocortex.md +2 -2
  33. package/targets-stubs/codex/AGENTS.md +35 -2
  34. package/targets-stubs/codex/neocortex.toml +6 -0
  35. package/targets-stubs/cursor/agent.md +2 -2
  36. package/targets-stubs/gemini-cli/agent.md +2 -2
  37. package/targets-stubs/opencode/neocortex-root.md +1 -1
  38. package/targets-stubs/vscode/neocortex.agent.md +2 -2
@@ -0,0 +1 @@
1
+ export declare function nativeAgentCliHandler(args: readonly string[]): Promise<number>;
@@ -0,0 +1,2 @@
1
+ import{isNativeDispatchBindingV1 as b,isNativeHostAttestationV1 as A}from"../continuity/native-agent-types.js";import{deriveOpaqueNativeAgentHandle as v,openNativeAgentPrivateStore as m}from"../continuity/native-agent-store.js";const k=64*1024,E=new Set(["requested","spawned","running","completed","failed","interrupted","unknown","lost"]),g=new Set(["native-agent","headless-process","inline"]),N=new Set(["fresh","stale","unknown"]),H=new Set(["host-event","host-list","bounded-poll","local-reservation"]);function l(t,o){const i=t.indexOf(o);return i>=0?t[i+1]:void 0}function h(t,o,i=[]){const n=new Set([...o,...i]);return o.every(a=>Object.prototype.hasOwnProperty.call(t,a))&&Object.keys(t).every(a=>n.has(a))}async function w(){const t=[];let o=0;for await(const n of process.stdin){const a=Buffer.isBuffer(n)?n:Buffer.from(String(n));if(o+=a.length,o>k)throw new Error("native-agent-input-too-large");t.push(a)}const i=JSON.parse(Buffer.concat(t).toString("utf8"));if(!i||typeof i!="object"||Array.isArray(i))throw new Error("native-agent-input-invalid");return i}function r(t){process.stdout.write(`${JSON.stringify(t)}
2
+ `)}function O(t){return t&&typeof t=="object"&&"code"in t&&typeof t.code=="string"?t.code:t instanceof SyntaxError?"native-agent-input-invalid":t instanceof Error&&/^native-agent-[a-z0-9-]+$/.test(t.message)?t.message:"native-agent-operation-failed"}async function C(t){const o=t[0],i=l(t,"--project-root")??process.cwd();let n;try{if(o!=="reserve"&&o!=="observe"&&o!=="status")return r({ok:!1,reasonCode:"native-agent-action-invalid",publicSafe:!0}),1;if(n=await m(i),o==="reserve"){const e=await w();if(!h(e,["directiveKind","supportsTaskDelegation","taskDelegationCapability","binding","hostAttestation"],["requestedAt","topology"]))throw new Error("native-agent-input-invalid");if(e.directiveKind!=="task"||e.supportsTaskDelegation!==!0||e.taskDelegationCapability!=="native_safe"||!b(e.binding)||!A(e.hostAttestation))throw new Error("native-agent-dispatch-not-authorized");const s=e.topology??"native-agent";if(!g.has(s))throw new Error("native-agent-input-invalid");const c=n.store.reserveNativeAgentDispatch({binding:e.binding,hostAttestation:e.hostAttestation,requestedAt:typeof e.requestedAt=="string"?e.requestedAt:new Date().toISOString(),topology:s});return r({ok:!0,authorized:!0,action:c.reserved?"spawn-once":"reconcile-existing",...c,publicSafe:!0}),0}if(o==="observe"){const e=await w();if(!h(e,["dispatchKey","expectedRevision","state","topology","observedAt","freshness","observationSource","reasonCode"],["rawHandle","rawParentHandle","terminalAt"]))throw new Error("native-agent-input-invalid");const s=e.state,c=e.topology,u=e.freshness,d=e.observationSource;if(!E.has(s)||!g.has(c)||!N.has(u)||!H.has(d))throw new Error("native-agent-input-invalid");const p=typeof e.rawHandle=="string"?e.rawHandle:null,f=typeof e.rawParentHandle=="string"?e.rawParentHandle:null,y=n.store.observeNativeAgentDispatch({dispatchKey:String(e.dispatchKey),expectedRevision:Number(e.expectedRevision),state:s,handle:p?v(p,n.paths.handleKeyPath):null,parentHandle:f?v(f,n.paths.handleKeyPath):null,topology:c,observedAt:String(e.observedAt),terminalAt:e.terminalAt===null||typeof e.terminalAt=="string"?e.terminalAt:void 0,freshness:u,observationSource:d,reasonCode:String(e.reasonCode)});return r({ok:!0,...y,publicSafe:!0}),0}const a=l(t,"--dispatch-key"),S=Number(l(t,"--stale-after-ms")??3e4);if(a){const e=n.store.getNativeAgentDispatchStatus(a,{staleAfterMs:S});r({ok:!0,receipt:e,publicSafe:!0})}else{const e=n.store.listRecentNativeAgentDispatches(Number(l(t,"--limit")??20));r({ok:!0,receipts:e,publicSafe:!0})}return 0}catch(a){return r({ok:!1,reasonCode:O(a),publicSafe:!0}),1}finally{n?.store.close()}}export{C as nativeAgentCliHandler};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public-safe native-agent dispatch reservation and immutable observations.
3
+ * Raw runtime handles, prompts and logs are deliberately absent.
4
+ */
5
+ export declare const NATIVE_AGENT_DISPATCHES_SQLITE_MIGRATION: Readonly<{
6
+ readonly version: 6;
7
+ readonly name: "native-agent-dispatches";
8
+ readonly sql: "\nCREATE TABLE IF NOT EXISTS native_agent_dispatches (\n dispatch_key TEXT PRIMARY KEY CHECK (dispatch_key GLOB 'sha256:*' AND length(dispatch_key) = 71),\n story_id TEXT NOT NULL,\n graph_revision TEXT NOT NULL CHECK (length(graph_revision) = 64),\n profile TEXT NOT NULL CHECK (profile = 'neocortex'),\n host_kind TEXT NOT NULL CHECK (host_kind IN ('codex-cli', 'codex-desktop', 'unknown')),\n host_version TEXT,\n host_origin TEXT NOT NULL CHECK (host_origin IN ('runtime-attested', 'host-observed', 'environment', 'explicit-override', 'unknown')),\n host_confidence TEXT NOT NULL CHECK (host_confidence IN ('attested', 'observed', 'inferred', 'unknown')),\n parent_handle TEXT CHECK (parent_handle IS NULL OR (parent_handle GLOB 'agt_*' AND length(parent_handle) BETWEEN 28 AND 68)),\n handle TEXT CHECK (handle IS NULL OR (handle GLOB 'agt_*' AND length(handle) BETWEEN 28 AND 68)),\n topology TEXT NOT NULL CHECK (topology IN ('native-agent', 'headless-process', 'inline')),\n state TEXT NOT NULL CHECK (state IN ('requested', 'spawned', 'running', 'completed', 'failed', 'interrupted', 'unknown', 'lost')),\n requested_at TEXT NOT NULL,\n observed_at TEXT,\n terminal_at TEXT,\n freshness TEXT NOT NULL CHECK (freshness IN ('fresh', 'stale', 'unknown')),\n observation_source TEXT NOT NULL CHECK (observation_source IN ('host-event', 'host-list', 'bounded-poll', 'local-reservation')),\n reason_code TEXT NOT NULL,\n revision INTEGER NOT NULL DEFAULT 0 CHECK (revision >= 0),\n public_safe INTEGER NOT NULL DEFAULT 1 CHECK (public_safe = 1),\n UNIQUE (story_id, graph_revision)\n);\n\nCREATE INDEX IF NOT EXISTS idx_native_agent_dispatches_state_observed\n ON native_agent_dispatches(state, observed_at, dispatch_key);\n\nCREATE TABLE IF NOT EXISTS native_agent_observations (\n dispatch_key TEXT NOT NULL,\n sequence INTEGER NOT NULL CHECK (sequence > 0),\n state TEXT NOT NULL CHECK (state IN ('requested', 'spawned', 'running', 'completed', 'failed', 'interrupted', 'unknown', 'lost')),\n handle TEXT CHECK (handle IS NULL OR (handle GLOB 'agt_*' AND length(handle) BETWEEN 28 AND 68)),\n parent_handle TEXT CHECK (parent_handle IS NULL OR (parent_handle GLOB 'agt_*' AND length(parent_handle) BETWEEN 28 AND 68)),\n topology TEXT NOT NULL CHECK (topology IN ('native-agent', 'headless-process', 'inline')),\n observed_at TEXT NOT NULL,\n terminal_at TEXT,\n freshness TEXT NOT NULL CHECK (freshness IN ('fresh', 'stale', 'unknown')),\n observation_source TEXT NOT NULL CHECK (observation_source IN ('host-event', 'host-list', 'bounded-poll', 'local-reservation')),\n reason_code TEXT NOT NULL,\n public_safe INTEGER NOT NULL DEFAULT 1 CHECK (public_safe = 1),\n PRIMARY KEY (dispatch_key, sequence),\n FOREIGN KEY (dispatch_key) REFERENCES native_agent_dispatches(dispatch_key) ON DELETE RESTRICT\n);\n\nCREATE INDEX IF NOT EXISTS idx_native_agent_observations_dispatch_observed\n ON native_agent_observations(dispatch_key, observed_at, sequence);\n";
9
+ }>;
@@ -0,0 +1,48 @@
1
+ const e=Object.freeze({version:6,name:"native-agent-dispatches",sql:`
2
+ CREATE TABLE IF NOT EXISTS native_agent_dispatches (
3
+ dispatch_key TEXT PRIMARY KEY CHECK (dispatch_key GLOB 'sha256:*' AND length(dispatch_key) = 71),
4
+ story_id TEXT NOT NULL,
5
+ graph_revision TEXT NOT NULL CHECK (length(graph_revision) = 64),
6
+ profile TEXT NOT NULL CHECK (profile = 'neocortex'),
7
+ host_kind TEXT NOT NULL CHECK (host_kind IN ('codex-cli', 'codex-desktop', 'unknown')),
8
+ host_version TEXT,
9
+ host_origin TEXT NOT NULL CHECK (host_origin IN ('runtime-attested', 'host-observed', 'environment', 'explicit-override', 'unknown')),
10
+ host_confidence TEXT NOT NULL CHECK (host_confidence IN ('attested', 'observed', 'inferred', 'unknown')),
11
+ parent_handle TEXT CHECK (parent_handle IS NULL OR (parent_handle GLOB 'agt_*' AND length(parent_handle) BETWEEN 28 AND 68)),
12
+ handle TEXT CHECK (handle IS NULL OR (handle GLOB 'agt_*' AND length(handle) BETWEEN 28 AND 68)),
13
+ topology TEXT NOT NULL CHECK (topology IN ('native-agent', 'headless-process', 'inline')),
14
+ state TEXT NOT NULL CHECK (state IN ('requested', 'spawned', 'running', 'completed', 'failed', 'interrupted', 'unknown', 'lost')),
15
+ requested_at TEXT NOT NULL,
16
+ observed_at TEXT,
17
+ terminal_at TEXT,
18
+ freshness TEXT NOT NULL CHECK (freshness IN ('fresh', 'stale', 'unknown')),
19
+ observation_source TEXT NOT NULL CHECK (observation_source IN ('host-event', 'host-list', 'bounded-poll', 'local-reservation')),
20
+ reason_code TEXT NOT NULL,
21
+ revision INTEGER NOT NULL DEFAULT 0 CHECK (revision >= 0),
22
+ public_safe INTEGER NOT NULL DEFAULT 1 CHECK (public_safe = 1),
23
+ UNIQUE (story_id, graph_revision)
24
+ );
25
+
26
+ CREATE INDEX IF NOT EXISTS idx_native_agent_dispatches_state_observed
27
+ ON native_agent_dispatches(state, observed_at, dispatch_key);
28
+
29
+ CREATE TABLE IF NOT EXISTS native_agent_observations (
30
+ dispatch_key TEXT NOT NULL,
31
+ sequence INTEGER NOT NULL CHECK (sequence > 0),
32
+ state TEXT NOT NULL CHECK (state IN ('requested', 'spawned', 'running', 'completed', 'failed', 'interrupted', 'unknown', 'lost')),
33
+ handle TEXT CHECK (handle IS NULL OR (handle GLOB 'agt_*' AND length(handle) BETWEEN 28 AND 68)),
34
+ parent_handle TEXT CHECK (parent_handle IS NULL OR (parent_handle GLOB 'agt_*' AND length(parent_handle) BETWEEN 28 AND 68)),
35
+ topology TEXT NOT NULL CHECK (topology IN ('native-agent', 'headless-process', 'inline')),
36
+ observed_at TEXT NOT NULL,
37
+ terminal_at TEXT,
38
+ freshness TEXT NOT NULL CHECK (freshness IN ('fresh', 'stale', 'unknown')),
39
+ observation_source TEXT NOT NULL CHECK (observation_source IN ('host-event', 'host-list', 'bounded-poll', 'local-reservation')),
40
+ reason_code TEXT NOT NULL,
41
+ public_safe INTEGER NOT NULL DEFAULT 1 CHECK (public_safe = 1),
42
+ PRIMARY KEY (dispatch_key, sequence),
43
+ FOREIGN KEY (dispatch_key) REFERENCES native_agent_dispatches(dispatch_key) ON DELETE RESTRICT
44
+ );
45
+
46
+ CREATE INDEX IF NOT EXISTS idx_native_agent_observations_dispatch_observed
47
+ ON native_agent_observations(dispatch_key, observed_at, sequence);
48
+ `});export{e as NATIVE_AGENT_DISPATCHES_SQLITE_MIGRATION};
@@ -0,0 +1,13 @@
1
+ import { type OpenContinuitySqliteStoreOptions } from './sqlite-store.js';
2
+ export interface NativeAgentPrivateRuntimePaths {
3
+ readonly commonDir: string;
4
+ readonly runtimeDir: string;
5
+ readonly databasePath: string;
6
+ readonly handleKeyPath: string;
7
+ }
8
+ export declare function resolveNativeAgentPrivateRuntimePaths(projectRoot: string): NativeAgentPrivateRuntimePaths;
9
+ export declare function deriveOpaqueNativeAgentHandle(rawHandle: string, handleKeyPath: string): string;
10
+ export declare function openNativeAgentPrivateStore(projectRoot: string, options?: Omit<OpenContinuitySqliteStoreOptions, 'projectRoot' | 'filePath'>): Promise<Readonly<{
11
+ store: import("./sqlite-store.js").ContinuitySqliteStore;
12
+ paths: NativeAgentPrivateRuntimePaths;
13
+ }>>;
@@ -0,0 +1 @@
1
+ import{createHmac as c,randomBytes as m}from"node:crypto";import{execFileSync as s}from"node:child_process";import{chmodSync as o,existsSync as a,mkdirSync as u,readFileSync as d,writeFileSync as f}from"node:fs";import{isAbsolute as h,join as i,resolve as l}from"node:path";import{openContinuitySqliteStore as y}from"./sqlite-store.js";const v="neocortex-runtime/native-agent",g="continuity.sqlite",P="handle-key",A=/^[^\r\n\0]{1,256}$/;function S(e){const t=s("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,encoding:"utf8",timeout:3e3,stdio:["ignore","pipe","ignore"]}).trim();if(!t||/[\r\n\0]/.test(t))throw new Error("native-agent-git-common-dir-unavailable");const n=h(t)?t:l(e,t),r=i(n,v);return Object.freeze({commonDir:n,runtimeDir:r,databasePath:i(r,g),handleKeyPath:i(r,P)})}function w(e){u(e.runtimeDir,{recursive:!0,mode:448});try{o(e.runtimeDir,448)}catch{}if(!a(e.handleKeyPath))try{f(e.handleKeyPath,m(32).toString("hex"),{encoding:"utf8",flag:"wx",mode:384})}catch(t){if(!a(e.handleKeyPath))throw t}try{o(e.handleKeyPath,384)}catch{}}function _(e,t){if(!A.test(e))throw new Error("native-agent-raw-handle-invalid");const n=d(t,"utf8").trim();if(!/^[a-f0-9]{64}$/i.test(n))throw new Error("native-agent-handle-key-invalid");return`agt_${c("sha256",Buffer.from(n,"hex")).update(e,"utf8").digest("hex")}`}async function K(e,t={}){const n=S(e);w(n);const r=await y({...t,projectRoot:e,filePath:n.databasePath});return Object.freeze({store:r,paths:n})}export{_ as deriveOpaqueNativeAgentHandle,K as openNativeAgentPrivateStore,S as resolveNativeAgentPrivateRuntimePaths};
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Client SSoT shadow of the public native-agent wire contract.
3
+ * Keep synchronized with packages/shared/src/yoloop/native-agent-observation.ts;
4
+ * the published client cannot resolve the private workspace package at runtime.
5
+ */
6
+ export type NativeHostKind = 'codex-cli' | 'codex-desktop' | 'unknown';
7
+ export type NativeHostAttestationOrigin = 'runtime-attested' | 'host-observed' | 'environment' | 'explicit-override' | 'unknown';
8
+ export type NativeHostAttestationConfidence = 'attested' | 'observed' | 'inferred' | 'unknown';
9
+ export interface NativeHostAttestationV1 {
10
+ readonly schemaVersion: 1;
11
+ readonly platformTarget: 'codex';
12
+ readonly hostKind: NativeHostKind;
13
+ readonly hostVersion: string | null;
14
+ readonly origin: NativeHostAttestationOrigin;
15
+ readonly confidence: NativeHostAttestationConfidence;
16
+ readonly publicSafe: true;
17
+ }
18
+ export interface NativeDispatchBindingV1 {
19
+ readonly schemaVersion: 1;
20
+ readonly storyId: string;
21
+ readonly graphRevision: string;
22
+ readonly dispatchKey: string;
23
+ readonly requiredCapability: 'native_safe';
24
+ readonly maxDepth: 1;
25
+ readonly publicSafe: true;
26
+ }
27
+ export type NativeAgentState = 'requested' | 'spawned' | 'running' | 'completed' | 'failed' | 'interrupted' | 'unknown' | 'lost';
28
+ export type NativeAgentTopology = 'native-agent' | 'headless-process' | 'inline';
29
+ export type NativeAgentFreshness = 'fresh' | 'stale' | 'unknown';
30
+ export type NativeAgentObservationSource = 'host-event' | 'host-list' | 'bounded-poll' | 'local-reservation';
31
+ export interface NativeAgentDispatchReceiptV1 {
32
+ readonly schemaVersion: 1;
33
+ readonly storyId: string;
34
+ readonly graphRevision: string;
35
+ readonly dispatchKey: string;
36
+ readonly profile: 'neocortex';
37
+ readonly parentHandle: string | null;
38
+ readonly handle: string | null;
39
+ readonly topology: NativeAgentTopology;
40
+ readonly state: NativeAgentState;
41
+ readonly requestedAt: string;
42
+ readonly observedAt: string | null;
43
+ readonly terminalAt: string | null;
44
+ readonly freshness: NativeAgentFreshness;
45
+ readonly observationSource: NativeAgentObservationSource;
46
+ readonly reasonCode: string;
47
+ readonly revision: number;
48
+ readonly publicSafe: true;
49
+ }
50
+ export declare const NATIVE_AGENT_TERMINAL_STATES: ReadonlySet<NativeAgentState>;
51
+ export declare function isNativeHostAttestationV1(value: unknown): value is NativeHostAttestationV1;
52
+ export declare function isNativeDispatchBindingV1(value: unknown): value is NativeDispatchBindingV1;
53
+ export declare function isNativeAgentDispatchReceiptV1(value: unknown): value is NativeAgentDispatchReceiptV1;
54
+ export declare function isNativeAgentStateTransitionAllowed(previous: NativeAgentState, next: NativeAgentState): boolean;
@@ -0,0 +1 @@
1
+ const S=["requested","spawned","running","completed","failed","interrupted","unknown","lost"],l=["native-agent","headless-process","inline"],g=["fresh","stale","unknown"],y=["host-event","host-list","bounded-poll","local-reservation"],m=["codex-cli","codex-desktop","unknown"],A=["runtime-attested","host-observed","environment","explicit-override","unknown"],u=["attested","observed","inferred","unknown"],w=new Set(["completed","failed","interrupted"]),d=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)+$/,c=/^(?:sha256:)?[a-f0-9]{64}$/i,p=/^sha256:[a-f0-9]{64}$/i,f=/^agt_[a-f0-9]{24,64}$/i,b=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,I=/^[a-z0-9][a-z0-9-]{0,95}$/;function n(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function s(e,t){const o=Object.keys(e).sort(),i=[...t].sort();return o.length===i.length&&o.every((a,h)=>a===i[h])}function r(e){return typeof e=="string"&&e.length>=20&&e.length<=40&&Number.isFinite(Date.parse(e))}function T(e){return!n(e)||!s(e,["schemaVersion","platformTarget","hostKind","hostVersion","origin","confidence","publicSafe"])?!1:e.schemaVersion===1&&e.platformTarget==="codex"&&m.includes(e.hostKind)&&(e.hostVersion===null||typeof e.hostVersion=="string"&&b.test(e.hostVersion))&&A.includes(e.origin)&&u.includes(e.confidence)&&e.publicSafe===!0}function E(e){return!n(e)||!s(e,["schemaVersion","storyId","graphRevision","dispatchKey","requiredCapability","maxDepth","publicSafe"])?!1:e.schemaVersion===1&&typeof e.storyId=="string"&&d.test(e.storyId)&&typeof e.graphRevision=="string"&&c.test(e.graphRevision)&&typeof e.dispatchKey=="string"&&p.test(e.dispatchKey)&&e.requiredCapability==="native_safe"&&e.maxDepth===1&&e.publicSafe===!0}function R(e){if(!n(e)||!s(e,["schemaVersion","storyId","graphRevision","dispatchKey","profile","parentHandle","handle","topology","state","requestedAt","observedAt","terminalAt","freshness","observationSource","reasonCode","revision","publicSafe"]))return!1;const t=e.state;return e.schemaVersion!==1||typeof e.storyId!="string"||!d.test(e.storyId)||typeof e.graphRevision!="string"||!c.test(e.graphRevision)||typeof e.dispatchKey!="string"||!p.test(e.dispatchKey)||e.profile!=="neocortex"||e.parentHandle!==null&&(typeof e.parentHandle!="string"||!f.test(e.parentHandle))||e.handle!==null&&(typeof e.handle!="string"||!f.test(e.handle))||!l.includes(e.topology)||!S.includes(t)||!r(e.requestedAt)||e.observedAt!==null&&!r(e.observedAt)||e.terminalAt!==null&&!r(e.terminalAt)||!g.includes(e.freshness)||!y.includes(e.observationSource)||typeof e.reasonCode!="string"||!I.test(e.reasonCode)||typeof e.revision!="number"||!Number.isSafeInteger(e.revision)||e.revision<0||e.publicSafe!==!0?!1:t==="requested"?e.handle===null&&e.observedAt===null&&e.terminalAt===null&&e.freshness==="unknown"&&e.observationSource==="local-reservation":!(e.observationSource==="local-reservation"||(t==="spawned"||t==="running")&&(e.handle===null||e.freshness!=="fresh")||w.has(t)!==(e.terminalAt!==null))}const N={requested:new Set(["requested","spawned","failed","interrupted","unknown"]),spawned:new Set(["spawned","running","completed","failed","interrupted","unknown","lost"]),running:new Set(["running","completed","failed","interrupted","unknown","lost"]),unknown:new Set(["unknown","spawned","running","completed","failed","interrupted","lost"]),lost:new Set(["lost","running","completed","failed","interrupted"]),completed:new Set(["completed"]),failed:new Set(["failed"]),interrupted:new Set(["interrupted"])};function V(e,t){return N[e].has(t)}export{w as NATIVE_AGENT_TERMINAL_STATES,R as isNativeAgentDispatchReceiptV1,V as isNativeAgentStateTransitionAllowed,E as isNativeDispatchBindingV1,T as isNativeHostAttestationV1};
@@ -4,10 +4,11 @@
4
4
  *
5
5
  * P180.04 -- Local SQLite continuity store, migrations and integrity checks.
6
6
  */
7
+ import { type NativeAgentDispatchReceiptV1, type NativeAgentFreshness, type NativeAgentObservationSource, type NativeAgentState, type NativeAgentTopology, type NativeDispatchBindingV1, type NativeHostAttestationV1 } from './native-agent-types.js';
7
8
  import { CONTINUITY_RECEIPT_COMPACTION_EVENT_TYPE, CONTINUITY_RECEIPT_RETENTION_REASON_CODES, type ContinuityQueuePolicy, type ContinuityQueueScope, type ContinuityOutboxRetryPolicy, type ContinuityOutboxStatus, type ContinuityRetentionPolicyInput } from './outbox.js';
8
9
  export declare const CONTINUITY_SQLITE_RELATIVE_DIR: ".neocortex/continuity";
9
10
  export declare const CONTINUITY_SQLITE_FILENAME: "continuity.sqlite";
10
- export declare const CONTINUITY_SQLITE_SCHEMA_VERSION: 5;
11
+ export declare const CONTINUITY_SQLITE_SCHEMA_VERSION: 6;
11
12
  export declare const DEFAULT_CONTINUITY_SQLITE_BUSY_TIMEOUT_MS = 5000;
12
13
  export declare const CONTINUITY_PROCESSING_OUTPUT_SUMMARY_EVENT_TYPE: "processing_output_summary";
13
14
  export declare const CONTINUITY_PROCESSING_OUTPUT_SUMMARY_MAX_CHARS: 2000;
@@ -96,6 +97,8 @@ export type ContinuitySqliteAdapterLoadResult = {
96
97
  export type ContinuitySqliteDynamicImporter = (specifier: string) => Promise<unknown>;
97
98
  export interface OpenContinuitySqliteStoreOptions {
98
99
  readonly projectRoot: string;
100
+ /** Optional private runtime path; default remains the compatibility project store. */
101
+ readonly filePath?: string;
99
102
  readonly adapter?: ContinuitySqliteAdapter;
100
103
  readonly adapterLoader?: () => Promise<ContinuitySqliteAdapterLoadResult>;
101
104
  readonly busyTimeoutMs?: number;
@@ -356,6 +359,36 @@ export interface ContinuitySqliteWriteResult {
356
359
  readonly replay: boolean;
357
360
  readonly changes: number;
358
361
  }
362
+ export interface NativeAgentDispatchReservationInput {
363
+ readonly binding: NativeDispatchBindingV1;
364
+ readonly hostAttestation: NativeHostAttestationV1;
365
+ readonly requestedAt: string;
366
+ readonly topology?: NativeAgentTopology;
367
+ readonly reasonCode?: string;
368
+ }
369
+ export interface NativeAgentDispatchReservationResult {
370
+ readonly receipt: NativeAgentDispatchReceiptV1;
371
+ readonly reserved: boolean;
372
+ readonly replay: boolean;
373
+ }
374
+ export interface NativeAgentObservationInput {
375
+ readonly dispatchKey: string;
376
+ readonly expectedRevision: number;
377
+ readonly state: NativeAgentState;
378
+ readonly handle: string | null;
379
+ readonly parentHandle?: string | null;
380
+ readonly topology: NativeAgentTopology;
381
+ readonly observedAt: string;
382
+ readonly terminalAt?: string | null;
383
+ readonly freshness: NativeAgentFreshness;
384
+ readonly observationSource: NativeAgentObservationSource;
385
+ readonly reasonCode: string;
386
+ }
387
+ export interface NativeAgentObservationResult {
388
+ readonly receipt: NativeAgentDispatchReceiptV1;
389
+ readonly applied: boolean;
390
+ readonly replay: boolean;
391
+ }
359
392
  export interface ContinuityJobStatusUpdateInput {
360
393
  readonly jobId: string;
361
394
  readonly status: string;
@@ -839,7 +872,7 @@ export interface ContinuityOutboxRetryResult {
839
872
  readonly reasonCode: string;
840
873
  readonly publicSafe: true;
841
874
  }
842
- declare const CONTINUITY_TABLES: readonly ["continuity_migrations", "jobs", "job_leases", "job_events", "job_receipts", "goal_campaigns", "goal_ledger_items", "goal_verifiers", "goal_review_gates", "loop_jobs", "artifacts", "state_snapshots", "headless_execution_attempts", "runner_config", "outbox"];
875
+ declare const CONTINUITY_TABLES: readonly ["continuity_migrations", "jobs", "job_leases", "job_events", "job_receipts", "goal_campaigns", "goal_ledger_items", "goal_verifiers", "goal_review_gates", "loop_jobs", "artifacts", "state_snapshots", "headless_execution_attempts", "runner_config", "outbox", "native_agent_dispatches", "native_agent_observations"];
843
876
  export type ContinuitySqliteTable = (typeof CONTINUITY_TABLES)[number];
844
877
  export declare function loadBetterSqlite3Adapter(importer?: ContinuitySqliteDynamicImporter): Promise<ContinuitySqliteAdapterLoadResult>;
845
878
  export declare function continuitySqliteStorePath(projectRoot: string): string;
@@ -872,6 +905,14 @@ export declare class ContinuitySqliteStore {
872
905
  runIntegrityCheck(): void;
873
906
  getSchemaVersion(): number;
874
907
  countRows(table: ContinuitySqliteTable): number;
908
+ reserveNativeAgentDispatch(input: NativeAgentDispatchReservationInput): NativeAgentDispatchReservationResult;
909
+ observeNativeAgentDispatch(input: NativeAgentObservationInput): NativeAgentObservationResult;
910
+ getNativeAgentDispatchStatus(dispatchKey: string, options?: {
911
+ readonly nowIso?: string;
912
+ readonly staleAfterMs?: number;
913
+ }): NativeAgentDispatchReceiptV1 | null;
914
+ listRecentNativeAgentDispatches(limit?: number): readonly NativeAgentDispatchReceiptV1[];
915
+ private findNativeAgentDispatchRow;
875
916
  getLocalConsoleAttachmentState(jobId: string): ContinuityLocalConsoleAttachmentState | null;
876
917
  recordJob(input: ContinuityJobWriteInput): ContinuitySqliteWriteResult;
877
918
  appendEvent(input: ContinuityEventWriteInput): ContinuitySqliteWriteResult;