@quantiya/codevibe-core 2.0.6 → 2.0.8

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 (233) hide show
  1. package/README.md +7 -5
  2. package/dist/agy-cli-contract.d.ts +14 -0
  3. package/dist/appsync/appsync-client.d.ts +229 -61
  4. package/dist/appsync/event-throttle.d.ts +33 -0
  5. package/dist/appsync/index.d.ts +3 -2
  6. package/dist/appsync/queries.d.ts +6 -2
  7. package/dist/auth/auth-telemetry.d.ts +26 -0
  8. package/dist/auth/keychain-cli.d.ts +6 -0
  9. package/dist/auth/vendor-key-cli.d.ts +49 -0
  10. package/dist/companion-mode/index.d.ts +50 -22
  11. package/dist/companion-mode/persist-preference.d.ts +1 -5
  12. package/dist/companion-mode/resolve-agent.d.ts +5 -4
  13. package/dist/config/config.d.ts +0 -5
  14. package/dist/credential-broker/__tests__/oauth-refresh.test.d.ts +1 -0
  15. package/dist/credential-broker/__tests__/upstream-result-helpers.d.ts +21 -0
  16. package/dist/credential-broker/broker.d.ts +196 -12
  17. package/dist/credential-broker/chatgpt-config.d.ts +40 -0
  18. package/dist/credential-broker/index.d.ts +4 -1
  19. package/dist/credential-broker/oauth-account-lock.d.ts +150 -0
  20. package/dist/credential-broker/oauth-refresh.d.ts +72 -0
  21. package/dist/credential-broker/types.d.ts +165 -17
  22. package/dist/credential-broker/upstream-client.d.ts +3 -2
  23. package/dist/credential-broker/vendor-key-store.d.ts +32 -1
  24. package/dist/crypto/__tests__/encrypt-for-emit.test.d.ts +1 -0
  25. package/dist/crypto/__tests__/open-prompt-id.test.d.ts +1 -0
  26. package/dist/crypto/encrypt-for-emit.d.ts +39 -0
  27. package/dist/crypto/index.d.ts +3 -0
  28. package/dist/crypto/open-prompt-id.d.ts +36 -0
  29. package/dist/daemon/__tests__/process-guards.test.d.ts +1 -0
  30. package/dist/daemon/index.d.ts +2 -0
  31. package/dist/daemon/process-guards.d.ts +38 -0
  32. package/dist/e1/__tests__/prompt-raise.test.d.ts +1 -0
  33. package/dist/e1/index.d.ts +2 -0
  34. package/dist/e1/prompt-raise.d.ts +65 -0
  35. package/dist/index.d.ts +20 -2
  36. package/dist/index.js +4543 -288
  37. package/dist/keychain/__tests__/keychain-manager.test.d.ts +1 -0
  38. package/dist/keychain/__tests__/keychain-migrate.test.d.ts +1 -0
  39. package/dist/keychain/keychain-backend.d.ts +105 -0
  40. package/dist/keychain/keychain-manager.d.ts +40 -5
  41. package/dist/keychain/keychain-migrate.d.ts +46 -0
  42. package/dist/local-executor/__tests__/anchored-fs.test.d.ts +1 -0
  43. package/dist/local-executor/__tests__/bounded-directory.test.d.ts +1 -0
  44. package/dist/local-executor/__tests__/bounded-output.test.d.ts +1 -0
  45. package/dist/local-executor/__tests__/durable-directory.test.d.ts +1 -0
  46. package/dist/local-executor/__tests__/hosted-class-a-sink.test.d.ts +1 -0
  47. package/dist/local-executor/__tests__/process-identity.test.d.ts +1 -0
  48. package/dist/local-executor/__tests__/process-tree.test.d.ts +1 -0
  49. package/dist/local-executor/__tests__/publication-authority-capability.test.d.ts +1 -0
  50. package/dist/local-executor/__tests__/reviewer-rationale-flag.test.d.ts +1 -0
  51. package/dist/local-executor/__tests__/snapshot-merge.test.d.ts +1 -0
  52. package/dist/local-executor/__tests__/workspace-authority-fixture.d.ts +3 -0
  53. package/dist/local-executor/__tests__/workspace-authority.test.d.ts +1 -0
  54. package/dist/local-executor/__tests__/workspace-materializer.test.d.ts +1 -0
  55. package/dist/local-executor/agentic-disposable-repo.d.ts +23 -6
  56. package/dist/local-executor/agentic-resolve.d.ts +16 -0
  57. package/dist/local-executor/anchored-fs.d.ts +243 -0
  58. package/dist/local-executor/bounded-directory.d.ts +64 -0
  59. package/dist/local-executor/bounded-helper.d.ts +22 -0
  60. package/dist/local-executor/bounded-output.d.ts +11 -0
  61. package/dist/local-executor/class-a-emit.d.ts +13 -1
  62. package/dist/local-executor/class-a-sign.d.ts +15 -0
  63. package/dist/local-executor/durable-directory.d.ts +25 -0
  64. package/dist/local-executor/durable-store.d.ts +217 -25
  65. package/dist/local-executor/group-decision-outcome.d.ts +11 -0
  66. package/dist/local-executor/hosted-class-a-sink.d.ts +27 -0
  67. package/dist/local-executor/implementor-argv.d.ts +89 -7
  68. package/dist/local-executor/index.d.ts +3 -2
  69. package/dist/local-executor/local-executor-impl.d.ts +177 -76
  70. package/dist/local-executor/merge-conflict-resolve.d.ts +19 -0
  71. package/dist/local-executor/process-identity.d.ts +16 -0
  72. package/dist/local-executor/process-tree.d.ts +123 -0
  73. package/dist/local-executor/revert-reconcile.d.ts +16 -0
  74. package/dist/local-executor/revert-runner.d.ts +14 -1
  75. package/dist/local-executor/reviewer-rationale-flag.d.ts +10 -0
  76. package/dist/local-executor/snapshot-merge.d.ts +124 -0
  77. package/dist/local-executor/task-group-types.d.ts +7 -6
  78. package/dist/local-executor/team-execution-flag.d.ts +2 -2
  79. package/dist/local-executor/track-registry.d.ts +2 -0
  80. package/dist/local-executor/types.d.ts +34 -2
  81. package/dist/local-executor/verification-gates/build.d.ts +5 -0
  82. package/dist/local-executor/verification-gates/deploy-preflight.d.ts +2 -0
  83. package/dist/local-executor/verification-gates/diff-sanity.d.ts +12 -0
  84. package/dist/local-executor/verification-gates/hostile-grep.d.ts +2 -0
  85. package/dist/local-executor/verification-gates/lint.d.ts +2 -0
  86. package/dist/local-executor/verification-gates/shell-runner.d.ts +5 -0
  87. package/dist/local-executor/verification-gates/source-traceability.d.ts +2 -0
  88. package/dist/local-executor/verification-gates/tests.d.ts +3 -0
  89. package/dist/local-executor/verification-gates/typecheck.d.ts +3 -0
  90. package/dist/local-executor/verification-runner.d.ts +6 -0
  91. package/dist/local-executor/workspace-authority.d.ts +45 -0
  92. package/dist/local-executor/workspace-materializer.d.ts +27 -0
  93. package/dist/local-executor/workspace-shadow.d.ts +378 -85
  94. package/dist/local-model/manager.d.ts +1 -1
  95. package/dist/local-model/ollama.d.ts +40 -0
  96. package/dist/orchestration/__tests__/detect-agents.test.d.ts +1 -0
  97. package/dist/orchestration/detect-agents.d.ts +10 -30
  98. package/dist/orchestration/index.d.ts +1 -2
  99. package/dist/orchestration-shell/__tests__/a1a-planner-offers.test.d.ts +1 -0
  100. package/dist/orchestration-shell/__tests__/a6-cli-surface.test.d.ts +1 -0
  101. package/dist/orchestration-shell/__tests__/advisory-attachment-journal.test.d.ts +1 -0
  102. package/dist/orchestration-shell/__tests__/advisory-attachments-dir-race.test.d.ts +1 -0
  103. package/dist/orchestration-shell/__tests__/advisory-multi-mention-panel.test.d.ts +1 -0
  104. package/dist/orchestration-shell/__tests__/advisory-panel-attachments.test.d.ts +1 -0
  105. package/dist/orchestration-shell/__tests__/advisory-quota-stdout-result.test.d.ts +1 -0
  106. package/dist/orchestration-shell/__tests__/agent-turn-context-batch.test.d.ts +1 -0
  107. package/dist/orchestration-shell/__tests__/bounded-shutdown.test.d.ts +1 -0
  108. package/dist/orchestration-shell/__tests__/brainstorm-quorum-wiring.test.d.ts +1 -0
  109. package/dist/orchestration-shell/__tests__/brainstorm-quorum.test.d.ts +1 -0
  110. package/dist/orchestration-shell/__tests__/cli-team-session-key.test.d.ts +1 -0
  111. package/dist/orchestration-shell/__tests__/command-intent.test.d.ts +1 -0
  112. package/dist/orchestration-shell/__tests__/context-compaction.test.d.ts +1 -0
  113. package/dist/orchestration-shell/__tests__/context-items-hosted-sync.test.d.ts +1 -0
  114. package/dist/orchestration-shell/__tests__/context-items-wiring.test.d.ts +1 -0
  115. package/dist/orchestration-shell/__tests__/context-items.test.d.ts +1 -0
  116. package/dist/orchestration-shell/__tests__/cp8-full-team-events.test.d.ts +1 -0
  117. package/dist/orchestration-shell/__tests__/cp8-team-decomposed-zk.test.d.ts +1 -0
  118. package/dist/orchestration-shell/__tests__/explicit-tty-exit.test.d.ts +1 -0
  119. package/dist/orchestration-shell/__tests__/mention-suggest.test.d.ts +1 -0
  120. package/dist/orchestration-shell/__tests__/planner-offer-e1.test.d.ts +1 -0
  121. package/dist/orchestration-shell/__tests__/route-browse-summarize-recovery.test.d.ts +1 -0
  122. package/dist/orchestration-shell/__tests__/workspace-shutdown.test.d.ts +1 -0
  123. package/dist/orchestration-shell/advisory-attachment-journal.d.ts +165 -0
  124. package/dist/orchestration-shell/attachments.d.ts +53 -8
  125. package/dist/orchestration-shell/bounded-shutdown.d.ts +22 -0
  126. package/dist/orchestration-shell/brainstorm-quorum.d.ts +118 -0
  127. package/dist/orchestration-shell/cli.d.ts +97 -70
  128. package/dist/orchestration-shell/cli.js +51847 -33465
  129. package/dist/orchestration-shell/command-intent.d.ts +56 -0
  130. package/dist/orchestration-shell/components/InputBar.d.ts +6 -0
  131. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +2 -0
  132. package/dist/orchestration-shell/context-compaction.d.ts +264 -0
  133. package/dist/orchestration-shell/context-items-hosted-sync.d.ts +19 -0
  134. package/dist/orchestration-shell/context-items.d.ts +408 -0
  135. package/dist/orchestration-shell/context-store.d.ts +162 -0
  136. package/dist/orchestration-shell/declared-test-runner.d.ts +21 -2
  137. package/dist/orchestration-shell/emit-shell-event.d.ts +41 -13
  138. package/dist/orchestration-shell/explicit-tty-exit.d.ts +17 -0
  139. package/dist/orchestration-shell/gate-decision-submit.d.ts +11 -0
  140. package/dist/orchestration-shell/gate-prompts.d.ts +78 -3
  141. package/dist/orchestration-shell/index.d.ts +309 -37
  142. package/dist/orchestration-shell/mention-suggest.d.ts +11 -0
  143. package/dist/orchestration-shell/mode-selection.d.ts +4 -22
  144. package/dist/orchestration-shell/planner-offer-e1.d.ts +97 -0
  145. package/dist/orchestration-shell/quorum-loop.d.ts +603 -77
  146. package/dist/orchestration-shell/reducer.d.ts +9 -0
  147. package/dist/orchestration-shell/task-progress.d.ts +17 -4
  148. package/dist/orchestration-shell/team-decompose.d.ts +47 -29
  149. package/dist/orchestration-shell/types.d.ts +103 -6
  150. package/dist/orchestration-shell/workspace-shutdown.d.ts +27 -0
  151. package/dist/planner/index.d.ts +1 -1
  152. package/dist/planner/local-advisory.d.ts +12 -0
  153. package/dist/planner/local-gemma.d.ts +27 -0
  154. package/dist/planner/types.d.ts +7 -0
  155. package/dist/reviewer/index.d.ts +0 -2
  156. package/dist/reviewer/output-parser.d.ts +19 -0
  157. package/dist/reviewer/provider.d.ts +9 -6
  158. package/dist/reviewer/providers/antigravity.d.ts +2 -3
  159. package/dist/reviewer/registry.d.ts +9 -4
  160. package/dist/reviewer/token-usage.d.ts +10 -0
  161. package/dist/reviewer/types.d.ts +3 -0
  162. package/dist/reviewer/verdict-classifier.d.ts +1 -0
  163. package/dist/session/__tests__/device-registration-lease.test.d.ts +1 -0
  164. package/dist/session/__tests__/pending-session-create.test.d.ts +1 -0
  165. package/dist/session/__tests__/session-rekey-fingerprint.test.d.ts +1 -0
  166. package/dist/session/__tests__/session-resume-key-reconciliation.test.d.ts +1 -0
  167. package/dist/session/__tests__/session-resume-pending-first.test.d.ts +1 -0
  168. package/dist/session/device-key-watcher.d.ts +1 -0
  169. package/dist/session/index.d.ts +4 -2
  170. package/dist/session/pending-session-create.d.ts +61 -0
  171. package/dist/session/register-device-key.d.ts +11 -1
  172. package/dist/session/session-rekey.d.ts +8 -8
  173. package/dist/session/session-resume.d.ts +21 -1
  174. package/dist/substrate/command-runner.d.ts +2 -0
  175. package/dist/substrate/docker.d.ts +14 -32
  176. package/dist/substrate/index.d.ts +0 -1
  177. package/dist/substrate/sandbox-exec.d.ts +17 -16
  178. package/dist/substrate/types.d.ts +39 -5
  179. package/dist/substrate-launch/__tests__/reviewer-credential-preflight.test.d.ts +1 -0
  180. package/dist/substrate-launch/apikey-bootstrap.d.ts +24 -1
  181. package/dist/substrate-launch/engage-substrate.d.ts +20 -0
  182. package/dist/substrate-launch/index.d.ts +2 -0
  183. package/dist/substrate-launch/reviewer-credential-preflight.d.ts +50 -0
  184. package/dist/substrate-launch/sanitized-env.d.ts +5 -5
  185. package/dist/test-publication-authority-setup.d.ts +1 -0
  186. package/dist/tool-activity/__tests__/consolidator.test.d.ts +1 -0
  187. package/dist/tool-activity/__tests__/digest.test.d.ts +1 -0
  188. package/dist/tool-activity/__tests__/flock-rollout-lock.test.d.ts +1 -0
  189. package/dist/tool-activity/__tests__/ledger.test.d.ts +1 -0
  190. package/dist/tool-activity/__tests__/outbox.test.d.ts +1 -0
  191. package/dist/tool-activity/__tests__/replay-cursor.test.d.ts +1 -0
  192. package/dist/tool-activity/__tests__/session-map.test.d.ts +1 -0
  193. package/dist/tool-activity/__tests__/socket-rollout-lock.test.d.ts +1 -0
  194. package/dist/tool-activity/atomic-file.d.ts +27 -0
  195. package/dist/tool-activity/consolidator.d.ts +253 -0
  196. package/dist/tool-activity/digest.d.ts +4 -0
  197. package/dist/tool-activity/flock-rollout-lock.d.ts +68 -0
  198. package/dist/tool-activity/index.d.ts +9 -0
  199. package/dist/tool-activity/ledger.d.ts +274 -0
  200. package/dist/tool-activity/outbox.d.ts +60 -0
  201. package/dist/tool-activity/replay-cursor.d.ts +190 -0
  202. package/dist/tool-activity/session-map.d.ts +133 -0
  203. package/dist/tool-activity/socket-rollout-lock.d.ts +57 -0
  204. package/dist/tool-activity/types.d.ts +368 -0
  205. package/dist/types/encryption.d.ts +9 -0
  206. package/dist/types/events.d.ts +29 -4
  207. package/dist/types/session.d.ts +32 -2
  208. package/package.json +7 -6
  209. package/dist/orchestration/orchestration-cli.d.ts +0 -12
  210. package/dist/orchestration/setup-bootstrap.d.ts +0 -146
  211. package/dist/orchestration/setup-failure-recourse.d.ts +0 -23
  212. package/dist/orchestration/setup-save.d.ts +0 -47
  213. package/dist/orchestration/setup-seat-picker.d.ts +0 -72
  214. package/dist/orchestration/setup-telemetry.d.ts +0 -54
  215. package/dist/orchestration/setup-test-agents.d.ts +0 -108
  216. package/dist/orchestration/setup-types.d.ts +0 -146
  217. package/dist/orchestration/setup-wizard.d.ts +0 -57
  218. package/dist/orchestration-shell/cohort-flag.d.ts +0 -16
  219. package/dist/reviewer/providers/gemini.d.ts +0 -109
  220. package/dist/substrate/git-proxy.d.ts +0 -35
  221. /package/dist/{companion-mode/__tests__/detect-parallel.test.d.ts → appsync/__tests__/appsync-client-context-items.test.d.ts} +0 -0
  222. /package/dist/{orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts → appsync/__tests__/heartbeat-active.test.d.ts} +0 -0
  223. /package/dist/{orchestration/__tests__/setup-bootstrap.test.d.ts → appsync/__tests__/orphan-sweep-null-heartbeat.test.d.ts} +0 -0
  224. /package/dist/{orchestration/__tests__/setup-failure-recourse.test.d.ts → appsync/__tests__/refresh-open-prompt-ttl-chunk.test.d.ts} +0 -0
  225. /package/dist/{orchestration/__tests__/setup-save.test.d.ts → auth/__tests__/keychain-cli.test.d.ts} +0 -0
  226. /package/dist/{orchestration/__tests__/setup-seat-picker.test.d.ts → auth/__tests__/vendor-key-cli.test.d.ts} +0 -0
  227. /package/dist/{orchestration/__tests__/setup-telemetry.test.d.ts → companion-mode/__tests__/mode-selected-emit.test.d.ts} +0 -0
  228. /package/dist/{orchestration/__tests__/setup-test-agents.test.d.ts → companion-mode/__tests__/private-launcher-detection.test.d.ts} +0 -0
  229. /package/dist/{orchestration/__tests__/setup-types.test.d.ts → companion-mode/__tests__/private-launcher-path.test.d.ts} +0 -0
  230. /package/dist/{orchestration/__tests__/setup-wizard.test.d.ts → credential-broker/__tests__/broker-c4.test.d.ts} +0 -0
  231. /package/dist/{reviewer/providers/__tests__/gemini-live-smoke.test.d.ts → credential-broker/__tests__/broker-streaming.test.d.ts} +0 -0
  232. /package/dist/{reviewer/providers/__tests__/gemini.test.d.ts → credential-broker/__tests__/chatgpt-config.test.d.ts} +0 -0
  233. /package/dist/{substrate/__tests__/git-proxy.test.d.ts → credential-broker/__tests__/oauth-account-lock.test.d.ts} +0 -0
@@ -0,0 +1,57 @@
1
+ import type { Logger } from '../logger';
2
+ import type { RolloutLock, RolloutOwnership } from './session-map';
3
+ export interface SocketRolloutLockOptions {
4
+ agent: string;
5
+ logger: Logger;
6
+ /** Override the filesystem-socket directory (tests) — default os.tmpdir(). */
7
+ socketDir?: string;
8
+ /** Base retry backoff while a LIVE owner holds `R` (default 25ms, capped ×~40). */
9
+ backoffMs?: number;
10
+ /** Max total wait before {@link acquireOwnership} throws (default 60000ms). */
11
+ maxWaitMs?: number;
12
+ /** Injectable clock (default Date.now). */
13
+ now?: () => number;
14
+ /** Injectable delay (default setTimeout) — tests pass a controllable fake. */
15
+ delay?: (ms: number) => Promise<void>;
16
+ /** Connect-probe timeout deciding live-vs-stale on filesystem sockets (default 500ms). */
17
+ probeTimeoutMs?: number;
18
+ }
19
+ export declare class SocketRolloutLock implements RolloutLock {
20
+ private readonly agent;
21
+ private readonly logger;
22
+ private readonly socketDir;
23
+ private readonly backoffMs;
24
+ private readonly maxWaitMs;
25
+ private readonly now;
26
+ private readonly delayFn;
27
+ private readonly probeTimeoutMs;
28
+ constructor(opts: SocketRolloutLockOptions);
29
+ /** A short per-user, per-R address key (sun_path is length-bounded). */
30
+ private key;
31
+ /** Abstract name (Linux) or filesystem path (else) for a rollout's lock socket. */
32
+ private address;
33
+ /**
34
+ * The on-disk lock-socket path for a rollout, or `null` on Linux (abstract
35
+ * sockets have no filesystem presence). Diagnostic / test use only.
36
+ */
37
+ socketPathFor(rollout: string): string | null;
38
+ /**
39
+ * Block until this process exclusively holds `rollout` (like `flock(LOCK_EX)`),
40
+ * then return an ownership handle. Throws if it cannot acquire within maxWaitMs
41
+ * (the caller's per-call barrier then throws — a RETRYABLE re-observe, never a
42
+ * skip, §4.5 invariant ①).
43
+ */
44
+ acquireOwnership(rollout: string): Promise<RolloutOwnership>;
45
+ /** Attempt one bind. Returns the listening server, or null on EADDRINUSE. */
46
+ private tryBind;
47
+ /**
48
+ * On a filesystem socket, decide whether EADDRINUSE is a live owner or a stale
49
+ * file from a crashed one. Connect-probe: connect OK → live (false); refused /
50
+ * absent → stale → unlink → true. Linux abstract sockets vanish on death, so
51
+ * EADDRINUSE is always live → never stale.
52
+ */
53
+ private breakStaleFilesystemSocket;
54
+ /** True if a listener currently accepts a connection at `address`. */
55
+ private probeConnect;
56
+ private closeServer;
57
+ }
@@ -0,0 +1,368 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One occurrence of a tool invocation inside a window (§4.1). `id` is the
4
+ * REPRODUCIBLE native invocation id (claude `toolu_…`, codex `call_id`) — it is
5
+ * the MOBILE render-dedup key (design-lock ①), so it must re-derive
6
+ * byte-identically on any transcript rescan. `ts` is the best-available
7
+ * occurrence time (display fidelity only; not required re-derivable, §4.5).
8
+ */
9
+ export declare const ToolActivityOccurrenceSchema: z.ZodObject<{
10
+ ts: z.ZodString;
11
+ id: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ id: string;
14
+ ts: string;
15
+ }, {
16
+ id: string;
17
+ ts: string;
18
+ }>;
19
+ export type ToolActivityOccurrence = z.infer<typeof ToolActivityOccurrenceSchema>;
20
+ /**
21
+ * Per-occurrence display detail (§4.1 manifest JSON `detail[]`) — lives OUTSIDE
22
+ * `occurrences[]` (which stays the minimal `{ts,id}` dedup shape). `i` indexes into
23
+ * the group's `occurrences[]`; `digest` is `digestOf(toolInput)` (§0), a one-way
24
+ * `sha256:`-prefixed hash carried ENCRYPTED (G4-safe). Present only for occurrences
25
+ * whose observer supplied a tool input.
26
+ */
27
+ export declare const ToolActivityDetailSchema: z.ZodObject<{
28
+ i: z.ZodNumber;
29
+ digest: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ digest: string;
32
+ i: number;
33
+ }, {
34
+ digest: string;
35
+ i: number;
36
+ }>;
37
+ export type ToolActivityDetail = z.infer<typeof ToolActivityDetailSchema>;
38
+ /**
39
+ * One `{tool, target}` group within a window (§4.1) — Hendry's
40
+ * `grep file1 ×2 @ t1,t2` shape. `count === occurrences.length` (lossless).
41
+ */
42
+ export declare const ToolActivityGroupSchema: z.ZodObject<{
43
+ tool: z.ZodString;
44
+ /** The normalized grouping target (§4.1 manifest JSON key `target`; file path / command word). */
45
+ target: z.ZodOptional<z.ZodString>;
46
+ count: z.ZodNumber;
47
+ occurrences: z.ZodArray<z.ZodObject<{
48
+ ts: z.ZodString;
49
+ id: z.ZodString;
50
+ }, "strip", z.ZodTypeAny, {
51
+ id: string;
52
+ ts: string;
53
+ }, {
54
+ id: string;
55
+ ts: string;
56
+ }>, "many">;
57
+ detail: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
+ i: z.ZodNumber;
59
+ digest: z.ZodString;
60
+ }, "strip", z.ZodTypeAny, {
61
+ digest: string;
62
+ i: number;
63
+ }, {
64
+ digest: string;
65
+ i: number;
66
+ }>, "many">>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ count: number;
69
+ occurrences: {
70
+ id: string;
71
+ ts: string;
72
+ }[];
73
+ tool: string;
74
+ target?: string | undefined;
75
+ detail?: {
76
+ digest: string;
77
+ i: number;
78
+ }[] | undefined;
79
+ }, {
80
+ count: number;
81
+ occurrences: {
82
+ id: string;
83
+ ts: string;
84
+ }[];
85
+ tool: string;
86
+ target?: string | undefined;
87
+ detail?: {
88
+ digest: string;
89
+ i: number;
90
+ }[] | undefined;
91
+ }>;
92
+ export type ToolActivityGroup = z.infer<typeof ToolActivityGroupSchema>;
93
+ /**
94
+ * The consolidated manifest carried (E2E-encrypted at send) as the content of a
95
+ * `TOOL_ACTIVITY` event (§4.1 manifest JSON). `continues` marks an overflow-chained
96
+ * segment (§4.4 — never truncate, never degrade). The window-level fields
97
+ * (`windowStart`/`windowEnd`/`totalInvocations`/`trackId`) are OPTIONAL in the schema
98
+ * (a bare `{groups}` still validates) but the consolidator ALWAYS populates them;
99
+ * `trackId` is `null` on the companion path (2.0 team attribution only).
100
+ */
101
+ export declare const ToolActivityManifestSchema: z.ZodObject<{
102
+ windowStart: z.ZodOptional<z.ZodString>;
103
+ windowEnd: z.ZodOptional<z.ZodString>;
104
+ totalInvocations: z.ZodOptional<z.ZodNumber>;
105
+ trackId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
+ groups: z.ZodArray<z.ZodObject<{
107
+ tool: z.ZodString;
108
+ /** The normalized grouping target (§4.1 manifest JSON key `target`; file path / command word). */
109
+ target: z.ZodOptional<z.ZodString>;
110
+ count: z.ZodNumber;
111
+ occurrences: z.ZodArray<z.ZodObject<{
112
+ ts: z.ZodString;
113
+ id: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ id: string;
116
+ ts: string;
117
+ }, {
118
+ id: string;
119
+ ts: string;
120
+ }>, "many">;
121
+ detail: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
+ i: z.ZodNumber;
123
+ digest: z.ZodString;
124
+ }, "strip", z.ZodTypeAny, {
125
+ digest: string;
126
+ i: number;
127
+ }, {
128
+ digest: string;
129
+ i: number;
130
+ }>, "many">>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ count: number;
133
+ occurrences: {
134
+ id: string;
135
+ ts: string;
136
+ }[];
137
+ tool: string;
138
+ target?: string | undefined;
139
+ detail?: {
140
+ digest: string;
141
+ i: number;
142
+ }[] | undefined;
143
+ }, {
144
+ count: number;
145
+ occurrences: {
146
+ id: string;
147
+ ts: string;
148
+ }[];
149
+ tool: string;
150
+ target?: string | undefined;
151
+ detail?: {
152
+ digest: string;
153
+ i: number;
154
+ }[] | undefined;
155
+ }>, "many">;
156
+ continues: z.ZodOptional<z.ZodBoolean>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ groups: {
159
+ count: number;
160
+ occurrences: {
161
+ id: string;
162
+ ts: string;
163
+ }[];
164
+ tool: string;
165
+ target?: string | undefined;
166
+ detail?: {
167
+ digest: string;
168
+ i: number;
169
+ }[] | undefined;
170
+ }[];
171
+ trackId?: string | null | undefined;
172
+ windowStart?: string | undefined;
173
+ windowEnd?: string | undefined;
174
+ totalInvocations?: number | undefined;
175
+ continues?: boolean | undefined;
176
+ }, {
177
+ groups: {
178
+ count: number;
179
+ occurrences: {
180
+ id: string;
181
+ ts: string;
182
+ }[];
183
+ tool: string;
184
+ target?: string | undefined;
185
+ detail?: {
186
+ digest: string;
187
+ i: number;
188
+ }[] | undefined;
189
+ }[];
190
+ trackId?: string | null | undefined;
191
+ windowStart?: string | undefined;
192
+ windowEnd?: string | undefined;
193
+ totalInvocations?: number | undefined;
194
+ continues?: boolean | undefined;
195
+ }>;
196
+ export type ToolActivityManifest = z.infer<typeof ToolActivityManifestSchema>;
197
+ /**
198
+ * The durable outbox entry, stored PLAINTEXT at rest inside an explicit envelope
199
+ * (§4.5 — Stage-2 Codex H3 + agy F2: the envelope flag is unconditional so the
200
+ * send loop never double-encrypts or leaks a stale-key ciphertext). The manifest
201
+ * is encrypted ONLY at SEND, under the session's CURRENT key; `expectedSessionKeyGen`
202
+ * is therefore a SEND-TIME value (read from the live session), NOT stored here.
203
+ *
204
+ * `backendSessionId` is bound into the entry (X2a/W4) so a durably-outboxed
205
+ * occurrence is ROUTED by reading the entry and never depends on the separate
206
+ * `(R, call_id) → backend` session-map surviving.
207
+ */
208
+ export declare const ToolActivityOutboxEnvelopeSchema: z.ZodObject<{
209
+ /** ALWAYS false — the entry never contains ciphertext (encrypt-at-send). */
210
+ isEncrypted: z.ZodLiteral<false>;
211
+ /** Random 128-bit id: the idempotency key (§4.9) AND the entry's filename stem. */
212
+ clientEventId: z.ZodString;
213
+ /** The plugin's backend session id this window belongs to (routing, X2a). */
214
+ backendSessionId: z.ZodString;
215
+ /** ISO-8601 ms — the event row sort key `(sessionId, windowStart)` (§4.9). */
216
+ windowStart: z.ZodString;
217
+ /** The plaintext manifest (encrypted only at send). */
218
+ manifest: z.ZodObject<{
219
+ windowStart: z.ZodOptional<z.ZodString>;
220
+ windowEnd: z.ZodOptional<z.ZodString>;
221
+ totalInvocations: z.ZodOptional<z.ZodNumber>;
222
+ trackId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
+ groups: z.ZodArray<z.ZodObject<{
224
+ tool: z.ZodString;
225
+ /** The normalized grouping target (§4.1 manifest JSON key `target`; file path / command word). */
226
+ target: z.ZodOptional<z.ZodString>;
227
+ count: z.ZodNumber;
228
+ occurrences: z.ZodArray<z.ZodObject<{
229
+ ts: z.ZodString;
230
+ id: z.ZodString;
231
+ }, "strip", z.ZodTypeAny, {
232
+ id: string;
233
+ ts: string;
234
+ }, {
235
+ id: string;
236
+ ts: string;
237
+ }>, "many">;
238
+ detail: z.ZodOptional<z.ZodArray<z.ZodObject<{
239
+ i: z.ZodNumber;
240
+ digest: z.ZodString;
241
+ }, "strip", z.ZodTypeAny, {
242
+ digest: string;
243
+ i: number;
244
+ }, {
245
+ digest: string;
246
+ i: number;
247
+ }>, "many">>;
248
+ }, "strip", z.ZodTypeAny, {
249
+ count: number;
250
+ occurrences: {
251
+ id: string;
252
+ ts: string;
253
+ }[];
254
+ tool: string;
255
+ target?: string | undefined;
256
+ detail?: {
257
+ digest: string;
258
+ i: number;
259
+ }[] | undefined;
260
+ }, {
261
+ count: number;
262
+ occurrences: {
263
+ id: string;
264
+ ts: string;
265
+ }[];
266
+ tool: string;
267
+ target?: string | undefined;
268
+ detail?: {
269
+ digest: string;
270
+ i: number;
271
+ }[] | undefined;
272
+ }>, "many">;
273
+ continues: z.ZodOptional<z.ZodBoolean>;
274
+ }, "strip", z.ZodTypeAny, {
275
+ groups: {
276
+ count: number;
277
+ occurrences: {
278
+ id: string;
279
+ ts: string;
280
+ }[];
281
+ tool: string;
282
+ target?: string | undefined;
283
+ detail?: {
284
+ digest: string;
285
+ i: number;
286
+ }[] | undefined;
287
+ }[];
288
+ trackId?: string | null | undefined;
289
+ windowStart?: string | undefined;
290
+ windowEnd?: string | undefined;
291
+ totalInvocations?: number | undefined;
292
+ continues?: boolean | undefined;
293
+ }, {
294
+ groups: {
295
+ count: number;
296
+ occurrences: {
297
+ id: string;
298
+ ts: string;
299
+ }[];
300
+ tool: string;
301
+ target?: string | undefined;
302
+ detail?: {
303
+ digest: string;
304
+ i: number;
305
+ }[] | undefined;
306
+ }[];
307
+ trackId?: string | null | undefined;
308
+ windowStart?: string | undefined;
309
+ windowEnd?: string | undefined;
310
+ totalInvocations?: number | undefined;
311
+ continues?: boolean | undefined;
312
+ }>;
313
+ /** Native invocation ids in this window (ledger reconciliation + render dedup). */
314
+ invocationIds: z.ZodArray<z.ZodString, "many">;
315
+ }, "strip", z.ZodTypeAny, {
316
+ isEncrypted: false;
317
+ manifest: {
318
+ groups: {
319
+ count: number;
320
+ occurrences: {
321
+ id: string;
322
+ ts: string;
323
+ }[];
324
+ tool: string;
325
+ target?: string | undefined;
326
+ detail?: {
327
+ digest: string;
328
+ i: number;
329
+ }[] | undefined;
330
+ }[];
331
+ trackId?: string | null | undefined;
332
+ windowStart?: string | undefined;
333
+ windowEnd?: string | undefined;
334
+ totalInvocations?: number | undefined;
335
+ continues?: boolean | undefined;
336
+ };
337
+ windowStart: string;
338
+ clientEventId: string;
339
+ backendSessionId: string;
340
+ invocationIds: string[];
341
+ }, {
342
+ isEncrypted: false;
343
+ manifest: {
344
+ groups: {
345
+ count: number;
346
+ occurrences: {
347
+ id: string;
348
+ ts: string;
349
+ }[];
350
+ tool: string;
351
+ target?: string | undefined;
352
+ detail?: {
353
+ digest: string;
354
+ i: number;
355
+ }[] | undefined;
356
+ }[];
357
+ trackId?: string | null | undefined;
358
+ windowStart?: string | undefined;
359
+ windowEnd?: string | undefined;
360
+ totalInvocations?: number | undefined;
361
+ continues?: boolean | undefined;
362
+ };
363
+ windowStart: string;
364
+ clientEventId: string;
365
+ backendSessionId: string;
366
+ invocationIds: string[];
367
+ }>;
368
+ export type ToolActivityOutboxEnvelope = z.infer<typeof ToolActivityOutboxEnvelopeSchema>;
@@ -5,6 +5,8 @@ export interface EncryptedSessionKey {
5
5
  deviceId: string;
6
6
  encryptedKey: string;
7
7
  ephemeralPublicKey: string;
8
+ /** SHA-256 of the exact registered public-key string used for wrapping. */
9
+ recipientPublicKeySha256?: string;
8
10
  }
9
11
  /**
10
12
  * Device key stored with backend
@@ -51,4 +53,11 @@ export interface GrantSessionKeyInput {
51
53
  deviceId: string;
52
54
  encryptedKey: string;
53
55
  ephemeralPublicKey: string;
56
+ /** SHA-256 of the exact registered public-key string used to wrap the key. */
57
+ recipientPublicKeySha256: string;
58
+ /**
59
+ * Exact session-key generation used to produce `encryptedKey`, or the
60
+ * generation-absent sentinel for a legacy row.
61
+ */
62
+ expectedSessionKeyGen: string;
54
63
  }
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * 1.x values come first. CP-1 adds 9 new values per
5
5
  * `codevibe-backend/docs/2.0/PHASE-CP-1-DESIGN.md` §3 lines 138-148 +
6
- * §16 Stage A LOCK. Emission of CP-1 values is gated by the
7
- * `new-event-types-enabled` cohort flag (default OFF — Phase 4 flips
8
- * per-user once mobile decoders ship).
6
+ * §16 Stage A LOCK. CP-1 values emit unconditionally — the earlier
7
+ * `new-event-types-enabled` cohort gate was removed (2026-07-09 descope)
8
+ * now that the mobile forward-compat decoder ships (unknown types render
9
+ * as an "Unsupported Event" placeholder, no crash).
9
10
  */
10
11
  export declare enum EventType {
11
12
  USER_PROMPT = "USER_PROMPT",
@@ -25,7 +26,12 @@ export declare enum EventType {
25
26
  STRUCTURAL_SUMMARY_GENERATED = "STRUCTURAL_SUMMARY_GENERATED",
26
27
  LOCAL_AUTHORITY_REFUSAL = "LOCAL_AUTHORITY_REFUSAL",
27
28
  CONTINUATION_PACKET_WRITTEN = "CONTINUATION_PACKET_WRITTEN",
28
- CONTINUATION_PACKET_FAILED = "CONTINUATION_PACKET_FAILED"
29
+ CONTINUATION_PACKET_FAILED = "CONTINUATION_PACKET_FAILED",
30
+ TEAM_DECOMPOSED = "TEAM_DECOMPOSED",
31
+ TEAM_TRACK_STATUS = "TEAM_TRACK_STATUS",
32
+ TEAM_GROUP_RESOLVED = "TEAM_GROUP_RESOLVED",
33
+ ADAPTER_PROGRESS = "ADAPTER_PROGRESS",
34
+ TOOL_ACTIVITY = "TOOL_ACTIVITY"
29
35
  }
30
36
  export declare enum EventSource {
31
37
  DESKTOP = "DESKTOP",
@@ -66,6 +72,16 @@ export interface Event {
66
72
  deliveredAt?: string;
67
73
  executedAt?: string;
68
74
  isEncrypted?: boolean;
75
+ encryptionVersion?: number;
76
+ writerAuthenticated?: boolean | null;
77
+ writerEventNonce?: string | null;
78
+ }
79
+ export interface WriterEventAttestationInput {
80
+ schema: 'codevibe.encrypted_desktop_event.writer.v1';
81
+ writerEventNonce: string;
82
+ contentCiphertextSha256: string;
83
+ metadataCiphertextSha256: string;
84
+ signatureB64: string;
69
85
  }
70
86
  /**
71
87
  * GraphQL input for creating events
@@ -79,6 +95,15 @@ export interface CreateEventInput {
79
95
  promptId?: string;
80
96
  timestamp?: string;
81
97
  isEncrypted?: boolean;
98
+ ownerToken?: string;
99
+ producerKind?: string;
100
+ mobileActionable?: boolean;
101
+ resolvedPromptId?: string;
102
+ resolutionAt?: string;
103
+ clientEventId?: string;
104
+ expectedSessionKeyGen?: string;
105
+ encryptionVersion?: number;
106
+ writerAttestation?: WriterEventAttestationInput;
82
107
  }
83
108
  /**
84
109
  * GraphQL input for updating event status
@@ -1,4 +1,18 @@
1
1
  import { EncryptedSessionKey } from './encryption';
2
+ /**
3
+ * Tool-event consolidation (codevibe-backend/docs/2.0/TOOL-EVENT-CONSOLIDATION-DESIGN.md
4
+ * §4.9). Distinguished sentinel a client stamps as `expectedSessionKeyGen` when it
5
+ * observes a session whose `sessionKeyGen` attribute is ABSENT (a LEGACY session
6
+ * created before sessionKeyGen shipped). The backend resolver maps this sentinel to
7
+ * the absence-aware, TTL-delete-safe ConditionCheck
8
+ * `attribute_exists(sessionId) AND attribute_not_exists(sessionKeyGen)` (never a
9
+ * literal `sessionKeyGen = :0`, which would wedge every legacy session).
10
+ *
11
+ * MUST stay byte-identical to the backend Lambda literal
12
+ * (codevibe-backend/lambda/event-management/index.ts `SESSION_KEY_GEN_ABSENT_SENTINEL`).
13
+ * The chosen value can never collide with a real server-minted nonce (a UUID).
14
+ */
15
+ export declare const SESSION_KEY_GEN_ABSENT_SENTINEL = "__CODEVIBE_SESSION_KEY_GEN_ABSENT__";
2
16
  /**
3
17
  * Session status enum
4
18
  */
@@ -14,6 +28,7 @@ export declare enum AgentType {
14
28
  CLAUDE = "CLAUDE",
15
29
  GEMINI = "GEMINI",
16
30
  CODEX = "CODEX",
31
+ ANTIGRAVITY = "ANTIGRAVITY",
17
32
  CODEVIBE = "CODEVIBE"
18
33
  }
19
34
  /**
@@ -33,18 +48,33 @@ export interface Session {
33
48
  creatorDeviceId?: string;
34
49
  encryptionVersion?: number;
35
50
  lastHeartbeatAt?: string;
51
+ /** True only for the immutable registered desktop creator key snapshot. */
52
+ writerAttestationEligible?: boolean | null;
53
+ /** SHA-256 of the raw 64-byte creator signing public key. */
54
+ creatorSigningKeySha256?: string | null;
36
55
  /**
37
56
  * Quorum 2.0 opt-in flag (2f.0.a.3). True routes the session to the
38
57
  * 2.0 orchestration flow once 2f.3 Lambda is live; null/false keeps
39
58
  * the 1.0 companion flow.
40
59
  */
41
60
  orchestrationEnabled?: boolean | null;
61
+ /**
62
+ * Tool-event consolidation (TOOL-EVENT-CONSOLIDATION-DESIGN.md §4.9).
63
+ * Server-minted random nonce written by createSession; advances ONLY on a
64
+ * genuine createSession (never updateSession/resume/grantSessionKey). The
65
+ * client reads it to stamp/refresh `expectedSessionKeyGen` on TOOL_ACTIVITY
66
+ * sends. OPTIONAL — a LEGACY session created before this shipped lacks it, in
67
+ * which case the client stamps SESSION_KEY_GEN_ABSENT_SENTINEL.
68
+ */
69
+ sessionKeyGen?: string;
42
70
  }
43
71
  /**
44
72
  * GraphQL input for creating sessions
45
73
  */
46
74
  export interface CreateSessionInput {
47
75
  sessionId?: string;
76
+ /** Stable UUIDv4 used to retry one sealed create request byte-for-byte. */
77
+ creationRequestId?: string;
48
78
  userId: string;
49
79
  agentType?: AgentType;
50
80
  projectPath: string;
@@ -69,8 +99,8 @@ export interface UpdateSessionInput {
69
99
  metadata?: Record<string, any>;
70
100
  lastHeartbeatAt?: string;
71
101
  /**
72
- * Quorum 2.0 (2f.0.a.3). Per-session override for the orchestration
73
- * opt-in. Plugin CLI --orchestration/--no-orchestration sets this.
102
+ * Legacy Quorum 2.0 compatibility field. Public per-session override flags
103
+ * were retired by A6; current clients do not set this from the CLI.
74
104
  */
75
105
  orchestrationEnabled?: boolean;
76
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Core library for CodeVibe plugins - shared keychain, crypto, AppSync, and auth functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,8 +16,8 @@
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "emit-types": "tsc --emitDeclarationOnly",
19
- "build": "rm -rf dist && npm run emit-types && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --packages=external --outfile=dist/index.js && esbuild src/orchestration-shell/cli.ts --bundle --platform=node --target=node18 --packages=external --outfile=dist/orchestration-shell/cli.js --banner:js=\"#!/usr/bin/env node\" && npm run verify-no-test-hooks",
20
- "verify-no-test-hooks": "if grep -Elq 'CODEVIBE_TEST_FORCE_QUOTA_FAIL|CODEVIBE_TEST_FORCE_IMPLEMENTOR_AGENT' dist/index.js dist/orchestration-shell/cli.js; then echo 'ERROR: a CODEVIBE_TEST_FORCE_* test hook leaked into a published bundle (prod-unreachability invariant)'; exit 1; fi; echo 'OK — no test-only hooks in published bundles'",
19
+ "build": "rm -rf dist && npm run emit-types && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/index.js && esbuild src/orchestration-shell/cli.ts --bundle --platform=node --target=node18 --minify-syntax --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/orchestration-shell/cli.js --banner:js=\"#!/usr/bin/env node\" && npm run verify-no-test-hooks",
20
+ "verify-no-test-hooks": "if grep -ERl 'CODEVIBE_TEST_FORCE_QUOTA_FAIL|CODEVIBE_TEST_FORCE_IMPLEMENTOR_AGENT|CODEVIBE_ANCHORED_PUBLICATION_AUTHORITY_ROOT|codevibe-anchored-publications-|cv-publication-authority-vitest-|codevibe\\.test\\.publication-authority-|setPublicationAuthorityRootForTestBuild|__CODEVIBE_TEST_BUILD__' dist; then echo 'ERROR: a test-only hook leaked into a published artifact (prod-unreachability invariant)'; exit 1; fi; echo 'OK — no test-only hooks in published artifacts'",
21
21
  "clean": "rm -rf dist",
22
22
  "prepublishOnly": "npm run build",
23
23
  "test": "vitest run",
@@ -37,13 +37,14 @@
37
37
  "react": "^19.2.0",
38
38
  "react-devtools-core": "^6.1.2",
39
39
  "ulid": "^3.0.0",
40
- "uuid": "^9.0.0",
40
+ "uuid": "^11.1.1",
41
41
  "ws": "^8.14.0",
42
42
  "yaml": "^2.9.0",
43
43
  "zod": "^3.23.0"
44
44
  },
45
45
  "optionalDependencies": {
46
- "keytar": "^7.9.0"
46
+ "keytar": "^7.9.0",
47
+ "fs-ext": "^2.0.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@types/gradient-string": "^1.1.6",
@@ -70,7 +71,7 @@
70
71
  "quantiya",
71
72
  "claude",
72
73
  "codex",
73
- "gemini",
74
+ "antigravity",
74
75
  "ai",
75
76
  "coding",
76
77
  "encryption"
@@ -1,12 +0,0 @@
1
- /**
2
- * Dispatch for the `orchestration` subcommand. Called by runAuthCli
3
- * when it sees `argv[2] === 'orchestration'`. Supports five sub-actions:
4
- * enable — set orchestrationEnabledDefault = true
5
- * disable — set orchestrationEnabledDefault = false
6
- * status — print current policy snapshot + installed agents
7
- * configure — interactive wizard (toggle + panel customization)
8
- * setup — Phase 3.a (#190) 3-step locked setup wizard with Test
9
- * My Agents (locked role taxonomy: architecture /
10
- * correctness / security)
11
- */
12
- export declare function runOrchestrationCli(argv: string[]): Promise<void>;