@quantiya/codevibe-claude-plugin 2.0.42 → 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 (19) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/node_modules/@quantiya/codevibe-core/dist/index.js +446 -437
  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 +52 -20
  6. package/node_modules/@quantiya/codevibe-core/dist/local-executor/types.d.ts +7 -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 +1190 -359
  9. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/InputBar.d.ts +1 -0
  10. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/gate-decision-submit.d.ts +26 -5
  11. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +17 -0
  12. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/non-tty-fallback.d.ts +1 -1
  13. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +223 -51
  14. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/reducer.d.ts +7 -0
  15. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/slash-routes/continuation.d.ts +5 -0
  16. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/task-label.d.ts +25 -0
  17. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/types.d.ts +83 -0
  18. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  19. 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;
@@ -446,8 +446,23 @@ export interface LocalExecutorImplDeps {
446
446
  }
447
447
  export declare function makeEmptyScope(): AuthorityScope;
448
448
  export declare class LocalExecutorImpl implements LocalExecutor {
449
- private scope;
450
- 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;
451
466
  private readonly emitter;
452
467
  private readonly trackProgressEmitter?;
453
468
  private readonly bridge;
@@ -508,20 +523,33 @@ export declare class LocalExecutorImpl implements LocalExecutor {
508
523
  * is responsible for routing to `bridgeAuthorityErrorToShellRefusal` /
509
524
  * `HookBridge.bridgeAuthorityRefusal` per LOCK #C4-3.
510
525
  */
511
- enforceAuthority(action: AuthorityAction): Promise<void>;
526
+ enforceAuthority(action: AuthorityAction, taskId?: string | null): Promise<void>;
512
527
  /**
513
- * 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).
514
538
  * Returns a deep-frozen copy so callers cannot mutate the LE's state.
515
539
  */
516
540
  authorityScope(): Readonly<AuthorityScope>;
517
- enforceCommand(argv: string[]): void;
518
- enforceNetwork(): void;
519
- enforceWrite(p: string): Promise<string>;
520
- enforceRead(p: string): Promise<string>;
521
- 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>;
522
550
  safeReadFile(p: string, opts?: {
523
551
  encoding?: BufferEncoding;
524
- }): Promise<string | Buffer>;
552
+ }, taskId?: string | null): Promise<string | Buffer>;
525
553
  spawnImplementor(args: SpawnArgs): Promise<ImplementorHandle>;
526
554
  spawnReviewer(_args: SpawnArgs): Promise<ReviewerHandle>;
527
555
  spawnHealthProbe(args: SpawnArgs): Promise<ProbeHandle>;
@@ -848,10 +876,15 @@ export declare class LocalExecutorImpl implements LocalExecutor {
848
876
  * carries a strict-monotonic `started_at`; `attemptEnd`/pass/fail carry `ended_at`.
849
877
  */
850
878
  private emitMergeGateStatus;
851
- /** Set the active taskId (production: CP-1.e on TASK_AUTHORIZED). */
852
- setActiveTaskId(taskId: string | null): void;
853
- /** 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
+ */
854
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;
855
888
  /** Expose emitter for §8.5 integration test introspection. */
856
889
  get emitterForTests(): ClassAEmitter;
857
890
  /** CP-12 W2.b — expose the per-track registry for idempotency introspection. */
@@ -860,15 +893,14 @@ export declare class LocalExecutorImpl implements LocalExecutor {
860
893
  get trackPayloadCountForTests(): number;
861
894
  /** @internal recurring lease owner count. */
862
895
  get trackHeartbeatCountForTests(): number;
863
- private contextOrNull;
864
896
  /**
865
897
  * Context resolver for ClassBConsumer emit paths (refusals + PolicyRejection).
866
- * Class B inbound packets MAY arrive before a TaskAuthorized has set
867
- * `this.taskId` (in fact, TaskAuthorized is the variant that SETS it). For
868
- * the signature_invalid / ulid_replay / policy_rejection / malformed
869
- * refusal-audit emit path we still need a valid envelope context, so we
870
- * fall back to `pending` when no task is active. CP-2 may refine this; for
871
- * 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`).
872
904
  */
873
905
  private contextOrFallback;
874
906
  }
@@ -412,9 +412,14 @@ export interface LocalExecutor {
412
412
  * `enforceRead` / `enforceNetwork` / `enforceCommand` based on `action.kind`.
413
413
  * Throws `AuthorityError` on refusal (master §9:1284).
414
414
  */
415
- 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;
416
418
  ingestHookEvent(event: HookEvent): Promise<void>;
417
- /** 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
+ */
418
423
  authorityScope(): Readonly<AuthorityScope>;
419
424
  /**
420
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
  /**