@quantiya/codevibe-core 2.0.0 → 2.0.1

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 (170) hide show
  1. package/dist/__tests__/cp-5-baseline-invariants.test.d.ts +1 -0
  2. package/dist/adapter/__tests__/capabilities.test.d.ts +1 -0
  3. package/dist/adapter/__tests__/contract-conformance.test.d.ts +1 -0
  4. package/dist/adapter/__tests__/packets.test.d.ts +1 -0
  5. package/dist/adapter/__tests__/progress.test.d.ts +1 -0
  6. package/dist/adapter/__tests__/registry.test.d.ts +1 -0
  7. package/dist/adapter/__tests__/smoke/claude.smoke.test.d.ts +1 -0
  8. package/dist/adapter/__tests__/smoke/codex.smoke.test.d.ts +1 -0
  9. package/dist/adapter/__tests__/smoke/gemini.smoke.test.d.ts +1 -0
  10. package/dist/adapter/capabilities.d.ts +68 -0
  11. package/dist/adapter/index.d.ts +7 -0
  12. package/dist/adapter/packets.d.ts +129 -0
  13. package/dist/adapter/progress.d.ts +93 -0
  14. package/dist/adapter/registry.d.ts +24 -0
  15. package/dist/adapter/types.d.ts +22 -0
  16. package/dist/appsync/__tests__/appsync-client-apply-user-decision.test.d.ts +1 -0
  17. package/dist/appsync/__tests__/appsync-client-classb.test.d.ts +1 -0
  18. package/dist/appsync/__tests__/appsync-client-planner.test.d.ts +1 -0
  19. package/dist/appsync/__tests__/appsync-client.test.d.ts +1 -0
  20. package/dist/appsync/appsync-client.d.ts +412 -0
  21. package/dist/appsync/index.d.ts +1 -1
  22. package/dist/appsync/queries.d.ts +15 -0
  23. package/dist/auth/__tests__/auth-telemetry.test.d.ts +1 -0
  24. package/dist/auth/auth-telemetry.d.ts +98 -5
  25. package/dist/companion-mode/__tests__/persist-preference.test.d.ts +1 -0
  26. package/dist/companion-mode/__tests__/resolve-agent.test.d.ts +1 -0
  27. package/dist/companion-mode/agent-picker.d.ts +9 -0
  28. package/dist/companion-mode/index.d.ts +55 -0
  29. package/dist/companion-mode/persist-preference.d.ts +24 -0
  30. package/dist/companion-mode/resolve-agent.d.ts +41 -0
  31. package/dist/index.d.ts +11 -3
  32. package/dist/index.js +243 -42
  33. package/dist/keychain/keychain-manager.d.ts +16 -2
  34. package/dist/local-executor/__tests__/authority-symlink-fixture.d.ts +15 -0
  35. package/dist/local-executor/__tests__/authority.test.d.ts +1 -0
  36. package/dist/local-executor/__tests__/class-a-emit.test.d.ts +1 -0
  37. package/dist/local-executor/__tests__/class-b-consumer.integration.test.d.ts +1 -0
  38. package/dist/local-executor/__tests__/class-b-consumer.test.d.ts +1 -0
  39. package/dist/local-executor/__tests__/hook-bridge.test.d.ts +1 -0
  40. package/dist/local-executor/__tests__/local-executor.integration.test.d.ts +1 -0
  41. package/dist/local-executor/__tests__/spawn.test.d.ts +1 -0
  42. package/dist/local-executor/__tests__/verification-runner.test.d.ts +1 -0
  43. package/dist/local-executor/authority.d.ts +29 -0
  44. package/dist/local-executor/class-a-emit.d.ts +138 -0
  45. package/dist/local-executor/class-b-consumer.d.ts +121 -0
  46. package/dist/local-executor/hook-bridge.d.ts +36 -0
  47. package/dist/local-executor/index.d.ts +8 -0
  48. package/dist/local-executor/local-executor-impl.d.ts +83 -0
  49. package/dist/local-executor/spawn.d.ts +6 -0
  50. package/dist/local-executor/types.d.ts +183 -0
  51. package/dist/local-executor/verification-gates/build.d.ts +6 -0
  52. package/dist/local-executor/verification-gates/deploy-preflight.d.ts +6 -0
  53. package/dist/local-executor/verification-gates/diff-sanity.d.ts +6 -0
  54. package/dist/local-executor/verification-gates/hostile-grep.d.ts +6 -0
  55. package/dist/local-executor/verification-gates/lint.d.ts +6 -0
  56. package/dist/local-executor/verification-gates/shell-runner.d.ts +40 -0
  57. package/dist/local-executor/verification-gates/source-traceability.d.ts +6 -0
  58. package/dist/local-executor/verification-gates/tests.d.ts +6 -0
  59. package/dist/local-executor/verification-gates/typecheck.d.ts +6 -0
  60. package/dist/local-executor/verification-runner.d.ts +28 -0
  61. package/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +1 -0
  62. package/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +1 -0
  63. package/dist/orchestration/__tests__/setup-save.test.d.ts +1 -0
  64. package/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +1 -0
  65. package/dist/orchestration/__tests__/setup-telemetry.test.d.ts +1 -0
  66. package/dist/orchestration/__tests__/setup-test-agents.test.d.ts +1 -0
  67. package/dist/orchestration/__tests__/setup-types.test.d.ts +1 -0
  68. package/dist/orchestration/__tests__/setup-wizard.test.d.ts +1 -0
  69. package/dist/orchestration/__tests__/v1-options.test.d.ts +1 -0
  70. package/dist/orchestration/detect-agents.d.ts +2 -1
  71. package/dist/orchestration/index.d.ts +1 -0
  72. package/dist/orchestration/orchestration-cli.d.ts +4 -1
  73. package/dist/orchestration/setup-bootstrap.d.ts +146 -0
  74. package/dist/orchestration/setup-failure-recourse.d.ts +23 -0
  75. package/dist/orchestration/setup-save.d.ts +47 -0
  76. package/dist/orchestration/setup-seat-picker.d.ts +72 -0
  77. package/dist/orchestration/setup-telemetry.d.ts +54 -0
  78. package/dist/orchestration/setup-test-agents.d.ts +108 -0
  79. package/dist/orchestration/setup-types.d.ts +140 -0
  80. package/dist/orchestration/setup-wizard.d.ts +57 -0
  81. package/dist/orchestration/v1-options.d.ts +97 -0
  82. package/dist/orchestration-shell/__tests__/cli-authority-bridge.test.d.ts +1 -0
  83. package/dist/orchestration-shell/__tests__/cli-planner-stack.test.d.ts +1 -0
  84. package/dist/orchestration-shell/__tests__/cli-singleton-enforcement.test.d.ts +1 -0
  85. package/dist/orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts +1 -0
  86. package/dist/orchestration-shell/__tests__/components.test.d.ts +1 -0
  87. package/dist/orchestration-shell/__tests__/emit-shell-event.test.d.ts +1 -0
  88. package/dist/orchestration-shell/__tests__/gate-prompts.test.d.ts +1 -0
  89. package/dist/orchestration-shell/__tests__/hostile-grep.test.d.ts +1 -0
  90. package/dist/orchestration-shell/__tests__/mode-selection.test.d.ts +1 -0
  91. package/dist/orchestration-shell/__tests__/process-markers.test.d.ts +1 -0
  92. package/dist/orchestration-shell/__tests__/reducer.test.d.ts +1 -0
  93. package/dist/orchestration-shell/__tests__/runOrchestrationShell-classify-dispatch.test.d.ts +1 -0
  94. package/dist/orchestration-shell/__tests__/runOrchestrationShell-planner-wiring.test.d.ts +1 -0
  95. package/dist/orchestration-shell/__tests__/runOrchestrationShell-signal.test.d.ts +1 -0
  96. package/dist/orchestration-shell/__tests__/runOrchestrationShell.test.d.ts +1 -0
  97. package/dist/orchestration-shell/__tests__/slash-router.test.d.ts +1 -0
  98. package/dist/orchestration-shell/__tests__/sticky-preference.test.d.ts +1 -0
  99. package/dist/orchestration-shell/cli.d.ts +96 -0
  100. package/dist/orchestration-shell/cli.js +8309 -0
  101. package/dist/orchestration-shell/cohort-flag.d.ts +16 -0
  102. package/dist/orchestration-shell/components/CodeVibeLogo.d.ts +2 -0
  103. package/dist/orchestration-shell/components/ConversationPane.d.ts +7 -0
  104. package/dist/orchestration-shell/components/GatePromptEntry.d.ts +9 -0
  105. package/dist/orchestration-shell/components/InputBar.d.ts +41 -0
  106. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +63 -0
  107. package/dist/orchestration-shell/components/StatusBar.d.ts +7 -0
  108. package/dist/orchestration-shell/components/nodes/AdvisoryEntry.d.ts +8 -0
  109. package/dist/orchestration-shell/components/nodes/GateStatusNode.d.ts +8 -0
  110. package/dist/orchestration-shell/components/nodes/PlannerDecisionEntry.d.ts +8 -0
  111. package/dist/orchestration-shell/components/nodes/ReviewerQuorumStatusNode.d.ts +8 -0
  112. package/dist/orchestration-shell/components/nodes/SlashOutputEntry.d.ts +8 -0
  113. package/dist/orchestration-shell/components/nodes/SubagentEventEntry.d.ts +8 -0
  114. package/dist/orchestration-shell/components/nodes/UserMessageEntry.d.ts +8 -0
  115. package/dist/orchestration-shell/emit-shell-event.d.ts +64 -0
  116. package/dist/orchestration-shell/gate-prompts.d.ts +123 -0
  117. package/dist/orchestration-shell/index.d.ts +100 -0
  118. package/dist/orchestration-shell/ink-runtime.d.ts +64 -0
  119. package/dist/orchestration-shell/mode-selection.d.ts +46 -0
  120. package/dist/orchestration-shell/non-tty-fallback.d.ts +46 -0
  121. package/dist/orchestration-shell/process-markers.d.ts +12 -0
  122. package/dist/orchestration-shell/reducer.d.ts +8 -0
  123. package/dist/orchestration-shell/slash-router.d.ts +45 -0
  124. package/dist/orchestration-shell/sticky-preference.d.ts +24 -0
  125. package/dist/orchestration-shell/store.d.ts +17 -0
  126. package/dist/orchestration-shell/types.d.ts +417 -0
  127. package/dist/planner/__tests__/cache-clarification-bypass.test.d.ts +1 -0
  128. package/dist/planner/__tests__/cache.test.d.ts +1 -0
  129. package/dist/planner/__tests__/client.test.d.ts +1 -0
  130. package/dist/planner/__tests__/health-machine-transitions.test.d.ts +1 -0
  131. package/dist/planner/__tests__/types-zod.test.d.ts +1 -0
  132. package/dist/planner/adapter.d.ts +16 -0
  133. package/dist/planner/cache.d.ts +35 -0
  134. package/dist/planner/client.d.ts +103 -0
  135. package/dist/planner/health-state.d.ts +24 -0
  136. package/dist/planner/index.d.ts +5 -0
  137. package/dist/planner/types.d.ts +113 -0
  138. package/dist/session/__tests__/session-resume-service-keys.test.d.ts +1 -0
  139. package/dist/session/session-rekey.d.ts +40 -0
  140. package/dist/session/session-resume.d.ts +25 -0
  141. package/dist/structural-summary/__tests__/__fixtures__/fixture-helpers.d.ts +11 -0
  142. package/dist/structural-summary/__tests__/assembler.test.d.ts +1 -0
  143. package/dist/structural-summary/__tests__/generator.test.d.ts +1 -0
  144. package/dist/structural-summary/__tests__/language-detect.test.d.ts +1 -0
  145. package/dist/structural-summary/__tests__/manifest-parsers/cargo.test.d.ts +1 -0
  146. package/dist/structural-summary/__tests__/manifest-parsers/gomod.test.d.ts +1 -0
  147. package/dist/structural-summary/__tests__/manifest-parsers/gradle.test.d.ts +1 -0
  148. package/dist/structural-summary/__tests__/manifest-parsers/index.test.d.ts +1 -0
  149. package/dist/structural-summary/__tests__/manifest-parsers/npm.test.d.ts +1 -0
  150. package/dist/structural-summary/__tests__/manifest-parsers/podfile.test.d.ts +1 -0
  151. package/dist/structural-summary/__tests__/manifest-parsers/pyproject.test.d.ts +1 -0
  152. package/dist/structural-summary/__tests__/opt-in-store.test.d.ts +1 -0
  153. package/dist/structural-summary/__tests__/privacy-filter.test.d.ts +1 -0
  154. package/dist/structural-summary/__tests__/safe-file-read.test.d.ts +1 -0
  155. package/dist/structural-summary/__tests__/user-ignore-matcher.test.d.ts +1 -0
  156. package/dist/structural-summary/__tests__/walker.test.d.ts +1 -0
  157. package/dist/structural-summary/generator.d.ts +8 -0
  158. package/dist/structural-summary/index.d.ts +7 -0
  159. package/dist/structural-summary/manifest-parsers/cargo.d.ts +3 -0
  160. package/dist/structural-summary/manifest-parsers/index.d.ts +7 -0
  161. package/dist/structural-summary/manifest-parsers/npm.d.ts +3 -0
  162. package/dist/structural-summary/manifest-parsers/other.d.ts +17 -0
  163. package/dist/structural-summary/opt-in-store.d.ts +24 -0
  164. package/dist/structural-summary/privacy-filter.d.ts +110 -0
  165. package/dist/structural-summary/safe-file-read.d.ts +11 -0
  166. package/dist/structural-summary/types.d.ts +215 -0
  167. package/dist/structural-summary/user-ignore-matcher.d.ts +9 -0
  168. package/dist/structural-summary/walker.d.ts +20 -0
  169. package/dist/types/events.d.ts +17 -2
  170. package/package.json +17 -3
@@ -0,0 +1,55 @@
1
+ import { DetectableAgent } from '../orchestration/detect-agents';
2
+ import type { ShellEventEmit } from '../orchestration-shell/emit-shell-event';
3
+ import type { Session } from '../types';
4
+ export declare class NoAgentInstalledError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ export interface CompanionArgs {
8
+ /** Optional `--agent <kind>` CLI override. */
9
+ agent?: DetectableAgent;
10
+ /** Args to pass through to the agent wrapper. */
11
+ passthrough: string[];
12
+ /** When set, clears the persisted preference before resolving. */
13
+ forgetAgent?: boolean;
14
+ /**
15
+ * Session context for §3 emitShellEvent fan-out. When provided
16
+ * together with `emitter`, MODE_SELECTED is emitted before the exec
17
+ * handoff. When either is omitted, the emit is skipped — Companion
18
+ * Mode is functional without it because the cohort flag gates every
19
+ * emit anyway (CP-1.a default OFF). Per Stage 1 r1 HIGH-3.
20
+ */
21
+ session?: Session;
22
+ /**
23
+ * Bound emitter (typically `createShellEventEmitter(appsyncClient)`).
24
+ * Required for the MODE_SELECTED emit when `session` is also set.
25
+ */
26
+ emitter?: (args: ShellEventEmit) => Promise<void>;
27
+ /** Test seam — override the `execFileSync` handoff. */
28
+ execFile?: (binPath: string, args: string[], options: {
29
+ stdio: 'inherit';
30
+ }) => void;
31
+ /** Test seam — override `detectInstalledAgents`. */
32
+ detect?: () => DetectableAgent[];
33
+ /** Test seam — override bin-path resolver (real impl uses `command -v`). */
34
+ resolveBinPath?: (kind: DetectableAgent) => string | null;
35
+ /**
36
+ * Test seam — override the `<wrapper> --version` 2s health-probe
37
+ * (§4 line 280). Real impl spawns the wrapper with a SIGKILL on
38
+ * timeout. Per Stage 2 r1 Codex MEDIUM-2.
39
+ */
40
+ versionProbe?: (binPath: string) => Promise<boolean>;
41
+ }
42
+ /**
43
+ * §4 LOCK lines 232-273. Detect → resolve → persist → exec.
44
+ *
45
+ * On a TTY with multiple agents, this calls `pickAgent` for the
46
+ * interactive readline picker. The function does NOT mount the Ink
47
+ * TUI — Companion Mode does not need it (the picker hands terminal
48
+ * control directly to the wrapper).
49
+ *
50
+ * NOTE: the function returns when the test seam `execFile` is
51
+ * provided; in production the `execFileSync` call replaces the process
52
+ * (`stdio: 'inherit'`) so `process.exit(0)` is unreachable but kept
53
+ * as a defensive fallback (§4 line 273).
54
+ */
55
+ export declare function runCompanionMode(args: CompanionArgs): Promise<void>;
@@ -0,0 +1,24 @@
1
+ export declare function companionPreferenceFilePath(): string;
2
+ export interface CompanionPreference {
3
+ lastAgent: 'CLAUDE' | 'GEMINI' | 'CODEX';
4
+ lastUsedAt: string;
5
+ }
6
+ /**
7
+ * §4 lines 304-316 LOCK. Reads + validates the preference file.
8
+ * Returns `null` on every failure mode named in the design:
9
+ * - file missing
10
+ * - loose permissions (any group/world bits set)
11
+ * - malformed JSON
12
+ * - schema mismatch
13
+ */
14
+ export declare function readCompanionPreference(): Promise<CompanionPreference | null>;
15
+ /**
16
+ * Writes the preference file with mode 0600. Creates parent dir if
17
+ * missing. Self-heals loose perms (writes 0o600 explicitly on every
18
+ * write).
19
+ */
20
+ export declare function persistCompanionPreference(pref: CompanionPreference): Promise<void>;
21
+ /**
22
+ * Clears the preference file (used by `--forget-agent` flag per §4).
23
+ */
24
+ export declare function clearCompanionPreference(): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { DetectableAgent } from '../orchestration/detect-agents';
2
+ export interface DetectedAgent {
3
+ kind: DetectableAgent;
4
+ binPath: string;
5
+ healthy: boolean;
6
+ }
7
+ export interface ResolveAgentArgs {
8
+ /** Healthy agents detected on PATH. */
9
+ healthy: DetectedAgent[];
10
+ /** `--agent` CLI flag override (if any). */
11
+ flag?: DetectableAgent;
12
+ /** Persisted preference from `readCompanionPreference()` (if any). */
13
+ preferred?: DetectableAgent;
14
+ }
15
+ export interface ResolveAgentResult {
16
+ /** When a single resolved agent exists. */
17
+ agent?: DetectedAgent;
18
+ /** When multiple healthy agents exist and the picker should run. */
19
+ needsPicker?: {
20
+ healthy: DetectedAgent[];
21
+ defaultIndex: number;
22
+ };
23
+ /** When the flag asked for an agent that's not healthy. */
24
+ flagMissing?: {
25
+ requested: DetectableAgent;
26
+ };
27
+ }
28
+ /**
29
+ * §4 resolution order LOCK:
30
+ * 1. flag > preference > picker > single-agent fast-path
31
+ *
32
+ * - If `flag` is set and a matching healthy agent exists → return it.
33
+ * - If `flag` is set and no matching healthy agent → `flagMissing`.
34
+ * - Single-agent fast-path: exactly 1 healthy agent → return it
35
+ * (regardless of preference).
36
+ * - Multiple healthy + `preferred` set + matches → picker with that
37
+ * row pre-selected (caller may decide to auto-accept).
38
+ * - Multiple healthy + no preference → picker with first row
39
+ * pre-selected.
40
+ */
41
+ export declare function resolveAgent(args: ResolveAgentArgs): ResolveAgentResult;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { KeychainManager, keychainManager, KeychainError } from './keychain';
2
2
  export { CryptoService, cryptoService, CryptoError, ENCRYPTION_VERSION } from './crypto';
3
- export { AppSyncClient, DownloadUrlResponse } from './appsync';
3
+ export { AppSyncClient, AppSyncGraphQLError, DownloadUrlResponse } from './appsync';
4
4
  export { queries, mutations, subscriptions } from './appsync';
5
5
  export { AuthService, authService } from './auth';
6
6
  export { runAuthCli } from './auth';
@@ -13,8 +13,16 @@ export { parseInteractivePrompt, normalizeSnapshot, } from './prompt-parser';
13
13
  export type { ParsedInteractivePrompt, PromptKind, InteractivePromptOption, } from './prompt-parser';
14
14
  export { resumeOrCreateSession, prepareSessionEncryption, rekeySessionForNewDevices, startDeviceKeyWatcher, registerDeviceEncryptionKey, } from './session';
15
15
  export type { ResumeOrCreateSessionInput, ResumeOrCreateSessionResult } from './session';
16
- export { detectInstalledAgents, pushDetectedAgents, applyPerSessionOrchestrationOverride, runOrchestrationCli, } from './orchestration';
17
- export type { DetectableAgent } from './orchestration';
16
+ export { detectInstalledAgents, pushDetectedAgents, applyPerSessionOrchestrationOverride, runOrchestrationCli, V1_ORCHESTRATION_PROMPT_KIND, V1_ORCHESTRATION_OPTIONS, mapOptionNumberToUserDecisionKind, mapOptionToUserDecisionKind, } from './orchestration';
17
+ export type { DetectableAgent, V1OrchestrationOption, V1UserDecisionKind, } from './orchestration';
18
18
  export * as Reviewer from './reviewer';
19
19
  export * as AuditKeys from './audit-keys';
20
20
  export * from './types';
21
+ export * as Planner from './planner';
22
+ export * as StructuralSummary from './structural-summary';
23
+ export { runOrchestrationShell } from './orchestration-shell';
24
+ export { runCompanionMode } from './companion-mode';
25
+ export { pickMode, TierError } from './orchestration-shell';
26
+ export { emitShellEvent, createShellEventEmitter } from './orchestration-shell';
27
+ export { processMarkers, withRoleMarker } from './orchestration-shell';
28
+ export type { Mode, Tier, PlannerDecision, AgentKind, PlannerHealthState, OrchestrationState, OrchestrationAction, ConversationEntry, RunningTaskState, ReviewerSeatState, GateState, ExecutionEventEntry, RefusalEventEntry, BypassEventEntry, MobileEventEntry, EventStreamEntry, QueuedTask, PendingClarification, LastModeFile, } from './orchestration-shell';