@quantiya/codevibe-claude-plugin 2.0.41 → 2.0.43

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 (21) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/node_modules/@quantiya/codevibe-core/dist/index.js +454 -445
  3. package/node_modules/@quantiya/codevibe-core/dist/local-executor/class-b-consumer.d.ts +5 -5
  4. package/node_modules/@quantiya/codevibe-core/dist/local-executor/hook-bridge.d.ts +1 -1
  5. package/node_modules/@quantiya/codevibe-core/dist/local-executor/local-executor-impl.d.ts +53 -20
  6. package/node_modules/@quantiya/codevibe-core/dist/local-executor/types.d.ts +8 -2
  7. package/node_modules/@quantiya/codevibe-core/dist/local-executor/workspace-shadow.d.ts +16 -0
  8. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +1302 -374
  9. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/command-intent.d.ts +18 -0
  10. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/InputBar.d.ts +1 -0
  11. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/gate-decision-submit.d.ts +26 -5
  12. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +17 -0
  13. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/non-tty-fallback.d.ts +1 -1
  14. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +224 -51
  15. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/reducer.d.ts +7 -0
  16. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/slash-routes/continuation.d.ts +5 -0
  17. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/task-label.d.ts +25 -0
  18. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/types.d.ts +83 -0
  19. package/node_modules/@quantiya/codevibe-core/dist/substrate-launch/engage-substrate.d.ts +2 -0
  20. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  21. package/package.json +2 -2
@@ -193,11 +193,11 @@ export interface ClassBConsumerDeps {
193
193
  * CP-12 W2.b (§3.C.2 / H1) — `envelopeTaskId` carries the OUTER Class-B
194
194
  * envelope's `task_id` (the `GateDispatchPayload` has none), so the team
195
195
  * quorum loop can route the round-0 dispatch to the right per-track `task_id`.
196
- * The engine stamps this on EVERY gate dispatch — single-impl INCLUDED (it
197
- * equals the loop's single active task). The quorum loop discriminates team vs
198
- * single-impl by `envelopeTaskId !== activeTaskId`, NOT by presence, so a
199
- * single-impl dispatch (envelopeTaskId === activeTaskId) falls back to the
200
- * single active task — byte-identical to today. Mirrors the
196
+ * The engine stamps this on EVERY gate dispatch — single tasks INCLUDED. P46a
197
+ * B1: the quorum loop routes ONLY by this id a single task it knows
198
+ * (`singleTaskContextByTask`) takes the single path, any other id the team
199
+ * path, and an empty id buffers for a START still in flight (else it is a
200
+ * no-op left to recovery). Mirrors the
201
201
  * `notifyPolicyRejection(.., rejectedTaskId?)` precedent.
202
202
  */
203
203
  gateDispatch?: (payload: GateDispatchPayload, envelopeTaskId?: string) => Promise<void>;
@@ -30,7 +30,7 @@ export declare class HookBridge {
30
30
  refusedMessageId: string;
31
31
  shellContent: string;
32
32
  shellMetadata?: Record<string, unknown>;
33
- }): Promise<void>;
33
+ }, taskCtx?: ClassAEmitterContext | null): Promise<void>;
34
34
  private contextOrNull;
35
35
  /** @internal */
36
36
  get adapterForTests(): AgentKind;
@@ -112,6 +112,7 @@ export type SubstrateEngager = (input: {
112
112
  * applies whenever the row cannot be established).
113
113
  */
114
114
  requireConfined?: boolean;
115
+ webBrowsingActive?: boolean;
115
116
  }) => Promise<SubstrateEngageResult>;
116
117
  /** Backend lease is 15 minutes; three renewal opportunities fit inside it. */
117
118
  export declare const TEAM_TRACK_HEARTBEAT_INTERVAL_MS: number;
@@ -445,8 +446,23 @@ export interface LocalExecutorImplDeps {
445
446
  }
446
447
  export declare function makeEmptyScope(): AuthorityScope;
447
448
  export declare class LocalExecutorImpl implements LocalExecutor {
448
- private scope;
449
- private taskId;
449
+ /**
450
+ * P46a B2 — the SEEDED authority scope (the desktop's static command
451
+ * allowlist, no paths): what every spawn runs under until ITS task's
452
+ * TaskAuthorized arrives, what a task-less caller gets, and what
453
+ * `authorityScope()` reports (unchanged at wiring — its only production
454
+ * caller freezes it there). Never mutated by a TaskAuthorized.
455
+ */
456
+ private baseScope;
457
+ /**
458
+ * P46a B2 — PER-TASK authority scopes: each task's TaskAuthorized path scope
459
+ * merged over the seeded scope (`mergeAuthorityScope`), keyed by task id. A
460
+ * spawn reads its OWN task's scope, never a union; authority never
461
+ * accumulates across tasks. Replaces the singleton `this.scope`/`this.taskId`
462
+ * pair, which made the SECOND concurrent task's spawn run under the FIRST
463
+ * task's authorized paths (and mis-attributed its audit context).
464
+ */
465
+ private readonly scopeByTask;
450
466
  private readonly emitter;
451
467
  private readonly trackProgressEmitter?;
452
468
  private readonly bridge;
@@ -507,20 +523,33 @@ export declare class LocalExecutorImpl implements LocalExecutor {
507
523
  * is responsible for routing to `bridgeAuthorityErrorToShellRefusal` /
508
524
  * `HookBridge.bridgeAuthorityRefusal` per LOCK #C4-3.
509
525
  */
510
- enforceAuthority(action: AuthorityAction): Promise<void>;
526
+ enforceAuthority(action: AuthorityAction, taskId?: string | null): Promise<void>;
511
527
  /**
512
- * Read-only view of the current authority scope per master §9:1286.
528
+ * P46a B2 resolve the authority scope a caller runs under: the task's OWN
529
+ * merged scope once ITS TaskAuthorized arrived, else the seeded scope (before
530
+ * authorization, for a task this executor never saw authorized, and for a
531
+ * task-less caller). Never a union across tasks.
532
+ */
533
+ private scopeFor;
534
+ /**
535
+ * Read-only view of the SEEDED authority scope per master §9:1286 (P46a B2:
536
+ * `authorityScope()` keeps today's value at its only production caller — the
537
+ * continuation writer's clamp, frozen at wiring — which IS the seeded scope).
513
538
  * Returns a deep-frozen copy so callers cannot mutate the LE's state.
514
539
  */
515
540
  authorityScope(): Readonly<AuthorityScope>;
516
- enforceCommand(argv: string[]): void;
517
- enforceNetwork(): void;
518
- enforceWrite(p: string): Promise<string>;
519
- enforceRead(p: string): Promise<string>;
520
- safeWriteFile(p: string, data: Buffer | string): Promise<void>;
541
+ /** P46a B2 (Stage 1 r1 F7) — drop a task's merged scope when the task ends. */
542
+ forgetTaskScope(taskId: string): void;
543
+ /** P46a B2 — read-only view of ONE task's merged scope (the seeded scope when unauthorized). */
544
+ authorityScopeForTask(taskId: string): Readonly<AuthorityScope>;
545
+ enforceCommand(argv: string[], taskId?: string | null): void;
546
+ enforceNetwork(taskId?: string | null): void;
547
+ enforceWrite(p: string, taskId?: string | null): Promise<string>;
548
+ enforceRead(p: string, taskId?: string | null): Promise<string>;
549
+ safeWriteFile(p: string, data: Buffer | string, taskId?: string | null): Promise<void>;
521
550
  safeReadFile(p: string, opts?: {
522
551
  encoding?: BufferEncoding;
523
- }): Promise<string | Buffer>;
552
+ }, taskId?: string | null): Promise<string | Buffer>;
524
553
  spawnImplementor(args: SpawnArgs): Promise<ImplementorHandle>;
525
554
  spawnReviewer(_args: SpawnArgs): Promise<ReviewerHandle>;
526
555
  spawnHealthProbe(args: SpawnArgs): Promise<ProbeHandle>;
@@ -847,10 +876,15 @@ export declare class LocalExecutorImpl implements LocalExecutor {
847
876
  * carries a strict-monotonic `started_at`; `attemptEnd`/pass/fail carry `ended_at`.
848
877
  */
849
878
  private emitMergeGateStatus;
850
- /** Set the active taskId (production: CP-1.e on TASK_AUTHORIZED). */
851
- setActiveTaskId(taskId: string | null): void;
852
- /** Replace the active authority scope (production: CP-1.e on TASK_AUTHORIZED). */
879
+ /**
880
+ * Replace the SEEDED authority scope (test seam; production seeds it at
881
+ * construction via `initialScope`). P46a B2: per-task scopes are set only by
882
+ * a TaskAuthorized (`advanceAuthorityScope`) — use `setAuthorityScopeForTask`
883
+ * to simulate one in tests.
884
+ */
853
885
  setAuthorityScope(scope: AuthorityScope): void;
886
+ /** P46a B2 test seam — install ONE task's merged scope as a TaskAuthorized would. */
887
+ setAuthorityScopeForTask(taskId: string, scope: AuthorityScope): void;
854
888
  /** Expose emitter for §8.5 integration test introspection. */
855
889
  get emitterForTests(): ClassAEmitter;
856
890
  /** CP-12 W2.b — expose the per-track registry for idempotency introspection. */
@@ -859,15 +893,14 @@ export declare class LocalExecutorImpl implements LocalExecutor {
859
893
  get trackPayloadCountForTests(): number;
860
894
  /** @internal recurring lease owner count. */
861
895
  get trackHeartbeatCountForTests(): number;
862
- private contextOrNull;
863
896
  /**
864
897
  * Context resolver for ClassBConsumer emit paths (refusals + PolicyRejection).
865
- * Class B inbound packets MAY arrive before a TaskAuthorized has set
866
- * `this.taskId` (in fact, TaskAuthorized is the variant that SETS it). For
867
- * the signature_invalid / ulid_replay / policy_rejection / malformed
868
- * refusal-audit emit path we still need a valid envelope context, so we
869
- * fall back to `pending` when no task is active. CP-2 may refine this; for
870
- * CP-1.e the audit emit always succeeds with a deterministic placeholder.
898
+ * Class B inbound packets carry no task the executor could attribute a
899
+ * refusal to before they are verified (signature_invalid / ulid_replay /
900
+ * policy_rejection / malformed), and P46a B2 removed the singleton task id,
901
+ * so the refusal-audit emit uses the deterministic `pending` placeholder
902
+ * never another task's id. Spawn-attributed emits resolve their task from
903
+ * the per-spawn `args.taskId` (`lifecycleCtx`).
871
904
  */
872
905
  private contextOrFallback;
873
906
  }
@@ -18,6 +18,7 @@ export interface SpawnArgs {
18
18
  stdinPayload?: string;
19
19
  signal?: AbortSignal;
20
20
  taskId?: string;
21
+ webTurnActive?: boolean;
21
22
  lifecycleAudit?: 'active_task' | 'none';
22
23
  onProcessSpawned?: ProcessSpawnedHook;
23
24
  onProcessExited?: ProcessExitedHook;
@@ -411,9 +412,14 @@ export interface LocalExecutor {
411
412
  * `enforceRead` / `enforceNetwork` / `enforceCommand` based on `action.kind`.
412
413
  * Throws `AuthorityError` on refusal (master §9:1284).
413
414
  */
414
- enforceAuthority(action: AuthorityAction): Promise<void>;
415
+ enforceAuthority(action: AuthorityAction, taskId?: string | null): Promise<void>;
416
+ /** P46a B2 — release a task's merged authority scope once the task has ended (optional; Stage 1 r1 F7). */
417
+ forgetTaskScope?(taskId: string): void;
415
418
  ingestHookEvent(event: HookEvent): Promise<void>;
416
- /** Read-only view of the current TASK_AUTHORIZED.authorityScope. */
419
+ /**
420
+ * Read-only view of the SEEDED authority scope (P46a B2: per-task authorized
421
+ * scopes live on the executor keyed by task id; "no task" means this scope).
422
+ */
417
423
  authorityScope(): Readonly<AuthorityScope>;
418
424
  /**
419
425
  * CP-1.c STUB; CP-1.e wires real AppSync subscription + signature verification.
@@ -124,6 +124,22 @@ export declare class WorkspaceShadow {
124
124
  * authority; completion/discard removes the instance marker with the copy.
125
125
  */
126
126
  persistReviewedDiff(diff: readonly ShadowDiffFile[]): Promise<void>;
127
+ /**
128
+ * P46a C1 — the real tree's current content-hash + mode for a workspace-
129
+ * relative path, read exactly as the promote compare-and-set reads it
130
+ * (`readRealFileMetadata`; `{ hash: null, mode: null }` when absent). Used to
131
+ * record a promoted path's post-image and to attribute a later collision.
132
+ */
133
+ readRealMetadata(rel: string): Promise<{
134
+ hash: string | null;
135
+ mode: number | null;
136
+ }>;
137
+ /**
138
+ * P46a C2 — the real tree's current text content for a workspace-relative
139
+ * path (`null` when absent), for the retry brief's "files changed since your
140
+ * first attempt" diff. Bounded by `MAX_REVIEW_FILE_BYTES`; never logged.
141
+ */
142
+ readRealFileText(rel: string): Promise<string | null>;
127
143
  /** Read the crash-durable reviewed artifact, or null for an unreviewed snapshot. */
128
144
  readReviewedDiff(): Promise<ShadowDiffFile[] | null>;
129
145
  /**