@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.
- package/dist/__tests__/cp-5-baseline-invariants.test.d.ts +1 -0
- package/dist/adapter/__tests__/capabilities.test.d.ts +1 -0
- package/dist/adapter/__tests__/contract-conformance.test.d.ts +1 -0
- package/dist/adapter/__tests__/packets.test.d.ts +1 -0
- package/dist/adapter/__tests__/progress.test.d.ts +1 -0
- package/dist/adapter/__tests__/registry.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/claude.smoke.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/codex.smoke.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/gemini.smoke.test.d.ts +1 -0
- package/dist/adapter/capabilities.d.ts +68 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/packets.d.ts +129 -0
- package/dist/adapter/progress.d.ts +93 -0
- package/dist/adapter/registry.d.ts +24 -0
- package/dist/adapter/types.d.ts +22 -0
- package/dist/appsync/__tests__/appsync-client-apply-user-decision.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-classb.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-planner.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client.test.d.ts +1 -0
- package/dist/appsync/appsync-client.d.ts +412 -0
- package/dist/appsync/index.d.ts +1 -1
- package/dist/appsync/queries.d.ts +15 -0
- package/dist/auth/__tests__/auth-telemetry.test.d.ts +1 -0
- package/dist/auth/auth-telemetry.d.ts +98 -5
- package/dist/companion-mode/__tests__/persist-preference.test.d.ts +1 -0
- package/dist/companion-mode/__tests__/resolve-agent.test.d.ts +1 -0
- package/dist/companion-mode/agent-picker.d.ts +9 -0
- package/dist/companion-mode/index.d.ts +55 -0
- package/dist/companion-mode/persist-preference.d.ts +24 -0
- package/dist/companion-mode/resolve-agent.d.ts +41 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +243 -42
- package/dist/keychain/keychain-manager.d.ts +16 -2
- package/dist/local-executor/__tests__/authority-symlink-fixture.d.ts +15 -0
- package/dist/local-executor/__tests__/authority.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-a-emit.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-b-consumer.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-b-consumer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/hook-bridge.test.d.ts +1 -0
- package/dist/local-executor/__tests__/local-executor.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/spawn.test.d.ts +1 -0
- package/dist/local-executor/__tests__/verification-runner.test.d.ts +1 -0
- package/dist/local-executor/authority.d.ts +29 -0
- package/dist/local-executor/class-a-emit.d.ts +138 -0
- package/dist/local-executor/class-b-consumer.d.ts +121 -0
- package/dist/local-executor/hook-bridge.d.ts +36 -0
- package/dist/local-executor/index.d.ts +8 -0
- package/dist/local-executor/local-executor-impl.d.ts +83 -0
- package/dist/local-executor/spawn.d.ts +6 -0
- package/dist/local-executor/types.d.ts +183 -0
- package/dist/local-executor/verification-gates/build.d.ts +6 -0
- package/dist/local-executor/verification-gates/deploy-preflight.d.ts +6 -0
- package/dist/local-executor/verification-gates/diff-sanity.d.ts +6 -0
- package/dist/local-executor/verification-gates/hostile-grep.d.ts +6 -0
- package/dist/local-executor/verification-gates/lint.d.ts +6 -0
- package/dist/local-executor/verification-gates/shell-runner.d.ts +40 -0
- package/dist/local-executor/verification-gates/source-traceability.d.ts +6 -0
- package/dist/local-executor/verification-gates/tests.d.ts +6 -0
- package/dist/local-executor/verification-gates/typecheck.d.ts +6 -0
- package/dist/local-executor/verification-runner.d.ts +28 -0
- package/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-save.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-telemetry.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-test-agents.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-types.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-wizard.test.d.ts +1 -0
- package/dist/orchestration/__tests__/v1-options.test.d.ts +1 -0
- package/dist/orchestration/detect-agents.d.ts +2 -1
- package/dist/orchestration/index.d.ts +1 -0
- package/dist/orchestration/orchestration-cli.d.ts +4 -1
- package/dist/orchestration/setup-bootstrap.d.ts +146 -0
- package/dist/orchestration/setup-failure-recourse.d.ts +23 -0
- package/dist/orchestration/setup-save.d.ts +47 -0
- package/dist/orchestration/setup-seat-picker.d.ts +72 -0
- package/dist/orchestration/setup-telemetry.d.ts +54 -0
- package/dist/orchestration/setup-test-agents.d.ts +108 -0
- package/dist/orchestration/setup-types.d.ts +140 -0
- package/dist/orchestration/setup-wizard.d.ts +57 -0
- package/dist/orchestration/v1-options.d.ts +97 -0
- package/dist/orchestration-shell/__tests__/cli-authority-bridge.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-planner-stack.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-singleton-enforcement.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/components.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/emit-shell-event.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-prompts.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/hostile-grep.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/mode-selection.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/process-markers.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reducer.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-classify-dispatch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-planner-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-signal.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/slash-router.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/sticky-preference.test.d.ts +1 -0
- package/dist/orchestration-shell/cli.d.ts +96 -0
- package/dist/orchestration-shell/cli.js +8309 -0
- package/dist/orchestration-shell/cohort-flag.d.ts +16 -0
- package/dist/orchestration-shell/components/CodeVibeLogo.d.ts +2 -0
- package/dist/orchestration-shell/components/ConversationPane.d.ts +7 -0
- package/dist/orchestration-shell/components/GatePromptEntry.d.ts +9 -0
- package/dist/orchestration-shell/components/InputBar.d.ts +41 -0
- package/dist/orchestration-shell/components/OrchestrationApp.d.ts +63 -0
- package/dist/orchestration-shell/components/StatusBar.d.ts +7 -0
- package/dist/orchestration-shell/components/nodes/AdvisoryEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/GateStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/PlannerDecisionEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/ReviewerQuorumStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/SlashOutputEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/SubagentEventEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/UserMessageEntry.d.ts +8 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +64 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +123 -0
- package/dist/orchestration-shell/index.d.ts +100 -0
- package/dist/orchestration-shell/ink-runtime.d.ts +64 -0
- package/dist/orchestration-shell/mode-selection.d.ts +46 -0
- package/dist/orchestration-shell/non-tty-fallback.d.ts +46 -0
- package/dist/orchestration-shell/process-markers.d.ts +12 -0
- package/dist/orchestration-shell/reducer.d.ts +8 -0
- package/dist/orchestration-shell/slash-router.d.ts +45 -0
- package/dist/orchestration-shell/sticky-preference.d.ts +24 -0
- package/dist/orchestration-shell/store.d.ts +17 -0
- package/dist/orchestration-shell/types.d.ts +417 -0
- package/dist/planner/__tests__/cache-clarification-bypass.test.d.ts +1 -0
- package/dist/planner/__tests__/cache.test.d.ts +1 -0
- package/dist/planner/__tests__/client.test.d.ts +1 -0
- package/dist/planner/__tests__/health-machine-transitions.test.d.ts +1 -0
- package/dist/planner/__tests__/types-zod.test.d.ts +1 -0
- package/dist/planner/adapter.d.ts +16 -0
- package/dist/planner/cache.d.ts +35 -0
- package/dist/planner/client.d.ts +103 -0
- package/dist/planner/health-state.d.ts +24 -0
- package/dist/planner/index.d.ts +5 -0
- package/dist/planner/types.d.ts +113 -0
- package/dist/session/__tests__/session-resume-service-keys.test.d.ts +1 -0
- package/dist/session/session-rekey.d.ts +40 -0
- package/dist/session/session-resume.d.ts +25 -0
- package/dist/structural-summary/__tests__/__fixtures__/fixture-helpers.d.ts +11 -0
- package/dist/structural-summary/__tests__/assembler.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/generator.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/language-detect.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/cargo.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/gomod.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/gradle.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/index.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/npm.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/podfile.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/pyproject.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/opt-in-store.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/privacy-filter.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/safe-file-read.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/user-ignore-matcher.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/walker.test.d.ts +1 -0
- package/dist/structural-summary/generator.d.ts +8 -0
- package/dist/structural-summary/index.d.ts +7 -0
- package/dist/structural-summary/manifest-parsers/cargo.d.ts +3 -0
- package/dist/structural-summary/manifest-parsers/index.d.ts +7 -0
- package/dist/structural-summary/manifest-parsers/npm.d.ts +3 -0
- package/dist/structural-summary/manifest-parsers/other.d.ts +17 -0
- package/dist/structural-summary/opt-in-store.d.ts +24 -0
- package/dist/structural-summary/privacy-filter.d.ts +110 -0
- package/dist/structural-summary/safe-file-read.d.ts +11 -0
- package/dist/structural-summary/types.d.ts +215 -0
- package/dist/structural-summary/user-ignore-matcher.d.ts +9 -0
- package/dist/structural-summary/walker.d.ts +20 -0
- package/dist/types/events.d.ts +17 -2
- package/package.json +17 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AgentKind, ProcessRole } from '../local-executor/types';
|
|
2
|
+
import type { ProbeResult, ProbeRole } from './types';
|
|
3
|
+
export interface AdapterCapabilities {
|
|
4
|
+
agentKind: AgentKind;
|
|
5
|
+
installed: boolean;
|
|
6
|
+
authHealth: 'ok' | 'expired' | 'unknown' | 'unauthorized';
|
|
7
|
+
quotaHealth: 'ok' | 'low' | 'exhausted' | 'unknown';
|
|
8
|
+
supportedRoles: ProcessRole[];
|
|
9
|
+
supportedTools: string[];
|
|
10
|
+
modelTier: 'free' | 'pro' | 'enterprise' | 'unknown';
|
|
11
|
+
repoAccess: 'workspace' | 'workspace_plus_git' | 'unknown';
|
|
12
|
+
knownLimitations: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const SUPPORTED_TOOLS: Record<AgentKind, string[]>;
|
|
15
|
+
export type ProbeFn = (agent: AgentKind, role: ProbeRole) => Promise<ProbeResult>;
|
|
16
|
+
export declare class CapabilityRegistry {
|
|
17
|
+
private readonly cache;
|
|
18
|
+
private probeFn;
|
|
19
|
+
constructor(probeFn?: ProbeFn);
|
|
20
|
+
/**
|
|
21
|
+
* Wire the probe callback post-construction. Used by
|
|
22
|
+
* `createDefaultAdapterRegistry` (or a follow-up wave's factory
|
|
23
|
+
* refactor) when the registry construction order forces
|
|
24
|
+
* CapabilityRegistry to exist before AdapterRegistry.
|
|
25
|
+
*/
|
|
26
|
+
setProbeFn(fn: ProbeFn): void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the cached capability record for `agent`. If no cached
|
|
29
|
+
* record exists, returns a default record derived from
|
|
30
|
+
* `detectInstalledAgents()` with all dimensions 'unknown' except
|
|
31
|
+
* `installed` (from PATH).
|
|
32
|
+
*
|
|
33
|
+
* NEVER throws — the §6.3 / §7.4 fail-fast machinery relies on
|
|
34
|
+
* `get()` always returning a populated 9-field record so the
|
|
35
|
+
* dispatcher can branch on `installed` / `authHealth` /
|
|
36
|
+
* `quotaHealth` without first-call special-casing. The first
|
|
37
|
+
* per-spawn auth re-check (`refreshCapabilities` at registry.ts:98)
|
|
38
|
+
* upgrades the 'unknown' → concrete values before the assert.
|
|
39
|
+
*/
|
|
40
|
+
get(agent: AgentKind): AdapterCapabilities;
|
|
41
|
+
/**
|
|
42
|
+
* Refresh the capability record for `agent` by running the
|
|
43
|
+
* configured probe. Per LOCK #C5-C-2:
|
|
44
|
+
* - `auth_probe` within 5 minutes of the last probe is a no-op
|
|
45
|
+
* (returns cached record without re-probing).
|
|
46
|
+
* - `health_probe` / `model_probe` always re-run.
|
|
47
|
+
*
|
|
48
|
+
* Throws if no probe callback has been wired (fail-loud — better
|
|
49
|
+
* than silently returning a default record on a degraded-health
|
|
50
|
+
* call site).
|
|
51
|
+
*/
|
|
52
|
+
refresh(agent: AgentKind, role: ProbeRole): Promise<AdapterCapabilities>;
|
|
53
|
+
/**
|
|
54
|
+
* High-level refresh that satisfies §3 row 43 test (7) verbatim —
|
|
55
|
+
* re-runs BOTH the auth probe AND the quota (model) probe and
|
|
56
|
+
* returns the merged record. `installed` is sticky (NOT re-probed
|
|
57
|
+
* from PATH) per LOCK #C5-C-2 case (a). The 5-min cache gate at
|
|
58
|
+
* LOCK #C5-C-2 case (c) applies only to the auth-probe leg —
|
|
59
|
+
* `model_probe` always re-runs because quota state changes faster
|
|
60
|
+
* than the auth window.
|
|
61
|
+
*
|
|
62
|
+
* Production call sites that need a complete refresh (shell-start
|
|
63
|
+
* baseline, on-demand "force-refresh" from mobile or `/codevibe-test
|
|
64
|
+
* agents`) should call this method rather than driving the
|
|
65
|
+
* role-specific `refresh` primitive twice.
|
|
66
|
+
*/
|
|
67
|
+
refreshCapabilities(agent: AgentKind): Promise<AdapterCapabilities>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { AdapterCapabilities, } from './capabilities';
|
|
2
|
+
export { CapabilityRegistry } from './capabilities';
|
|
3
|
+
export type { AcceptedPacketReceipt, AdapterErrorDetails, AdapterPacket, BoundedPlannerContext, ContinuationPacket, ReviewerPacket, TaskPacket, } from './packets';
|
|
4
|
+
export { AdapterError } from './packets';
|
|
5
|
+
export type { AdapterProgressCommandIntent, AdapterProgressEnvelope, AdapterProgressFailureSignal, AdapterProgressFileChange, AdapterProgressHooks, AdapterProgressToolUse, } from './progress';
|
|
6
|
+
export { AdapterRegistry, createDefaultAdapterRegistry } from './registry';
|
|
7
|
+
export type { AgentAdapter, ProbeResult, ProbeRole, } from './types';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { AuthorityScope } from '../local-executor/authority';
|
|
2
|
+
import type { AgentKind, ProcessRole } from '../local-executor/types';
|
|
3
|
+
import type { ReviewerRole } from '../reviewer/types';
|
|
4
|
+
export type AdapterPacket = TaskPacket | ContinuationPacket | ReviewerPacket | BoundedPlannerContext;
|
|
5
|
+
export interface TaskPacket {
|
|
6
|
+
kind: 'task';
|
|
7
|
+
taskId: string;
|
|
8
|
+
agentKind: AgentKind;
|
|
9
|
+
repoState: {
|
|
10
|
+
workingDir: string;
|
|
11
|
+
gitBranch: string | null;
|
|
12
|
+
gitDirtyDigest: string | null;
|
|
13
|
+
};
|
|
14
|
+
writeScope: AuthorityScope;
|
|
15
|
+
plannerDecisionId: string | null;
|
|
16
|
+
structuralSummaryDigest: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ContinuationPacket {
|
|
19
|
+
kind: 'continuation';
|
|
20
|
+
taskId: string;
|
|
21
|
+
fromAgentKind: AgentKind;
|
|
22
|
+
toAgentKind: AgentKind;
|
|
23
|
+
repoState: {
|
|
24
|
+
workingDir: string;
|
|
25
|
+
gitBranch: string | null;
|
|
26
|
+
gitDirtyDigest: string | null;
|
|
27
|
+
};
|
|
28
|
+
packetUri: string;
|
|
29
|
+
fidelityNote: string | null;
|
|
30
|
+
}
|
|
31
|
+
export interface ReviewerPacket {
|
|
32
|
+
kind: 'reviewer';
|
|
33
|
+
agentKind: AgentKind;
|
|
34
|
+
gateId: string;
|
|
35
|
+
seatId: number;
|
|
36
|
+
role: ReviewerRole;
|
|
37
|
+
artifact: {
|
|
38
|
+
contentHash: string;
|
|
39
|
+
uri: string;
|
|
40
|
+
mime: string;
|
|
41
|
+
};
|
|
42
|
+
lineageRefs: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface BoundedPlannerContext {
|
|
45
|
+
kind: 'bounded_planner_context';
|
|
46
|
+
agentKind: AgentKind;
|
|
47
|
+
plannerDecisionId: string;
|
|
48
|
+
packetUri: string;
|
|
49
|
+
}
|
|
50
|
+
export interface AcceptedPacketReceipt {
|
|
51
|
+
receiptId: string;
|
|
52
|
+
packetKind: AdapterPacket['kind'];
|
|
53
|
+
packetHashSha256: string;
|
|
54
|
+
acceptedAt: string;
|
|
55
|
+
agentKind: AgentKind;
|
|
56
|
+
processRole: ProcessRole;
|
|
57
|
+
}
|
|
58
|
+
export type AdapterErrorDetails = {
|
|
59
|
+
kind: 'unregistered_agent';
|
|
60
|
+
agent: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'agent_unavailable';
|
|
63
|
+
agent: AgentKind;
|
|
64
|
+
reason: 'not_installed' | 'auth_expired' | 'auth_unauthorized' | 'quota_exhausted' | 'unknown';
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'malformed_packet';
|
|
67
|
+
variant: AdapterPacket['kind'];
|
|
68
|
+
missingFields: string[];
|
|
69
|
+
agent: AgentKind;
|
|
70
|
+
};
|
|
71
|
+
export declare class AdapterError extends Error {
|
|
72
|
+
readonly details: AdapterErrorDetails;
|
|
73
|
+
constructor(details: AdapterErrorDetails);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Validate a TaskPacket. REQUIRED fields per §8.1:
|
|
77
|
+
* - kind === 'task'
|
|
78
|
+
* - taskId (non-empty string)
|
|
79
|
+
* - agentKind (CLAUDE | GEMINI | CODEX)
|
|
80
|
+
* - repoState.workingDir (non-empty string)
|
|
81
|
+
* - repoState.gitBranch (string | null)
|
|
82
|
+
* - repoState.gitDirtyDigest (string | null)
|
|
83
|
+
* - writeScope (AuthorityScope — 5 fields)
|
|
84
|
+
* - plannerDecisionId (string | null)
|
|
85
|
+
* - structuralSummaryDigest (string | null)
|
|
86
|
+
*
|
|
87
|
+
* Returns the input narrowed to `TaskPacket` on success; throws AdapterError
|
|
88
|
+
* with `variant: 'task'` on failure.
|
|
89
|
+
*/
|
|
90
|
+
export declare function validateTaskPacket(packet: unknown): TaskPacket;
|
|
91
|
+
/**
|
|
92
|
+
* Validate a ContinuationPacket. REQUIRED fields per §8.1:
|
|
93
|
+
* - kind === 'continuation'
|
|
94
|
+
* - taskId, fromAgentKind, toAgentKind
|
|
95
|
+
* - repoState.{workingDir,gitBranch,gitDirtyDigest}
|
|
96
|
+
* - packetUri (non-empty string)
|
|
97
|
+
* - fidelityNote (string | null)
|
|
98
|
+
*/
|
|
99
|
+
export declare function validateContinuationPacket(packet: unknown): ContinuationPacket;
|
|
100
|
+
/**
|
|
101
|
+
* Validate a ReviewerPacket. REQUIRED fields per §8.1:
|
|
102
|
+
* - kind === 'reviewer'
|
|
103
|
+
* - agentKind, gateId, seatId (number)
|
|
104
|
+
* - role (ReviewerRole snake_case wire form per `reviewer/types.ts:52`)
|
|
105
|
+
* - artifact.{contentHash,uri,mime}
|
|
106
|
+
* - lineageRefs (string[])
|
|
107
|
+
*/
|
|
108
|
+
export declare function validateReviewerPacket(packet: unknown): ReviewerPacket;
|
|
109
|
+
/**
|
|
110
|
+
* Validate a BoundedPlannerContext. REQUIRED fields per §8.1:
|
|
111
|
+
* - kind === 'bounded_planner_context'
|
|
112
|
+
* - agentKind
|
|
113
|
+
* - plannerDecisionId (non-empty string)
|
|
114
|
+
* - packetUri (non-empty string)
|
|
115
|
+
*/
|
|
116
|
+
export declare function validateBoundedPlannerContext(packet: unknown): BoundedPlannerContext;
|
|
117
|
+
/**
|
|
118
|
+
* Top-level dispatcher per LOCK #C5-D-3. Inspects `packet.kind` and routes
|
|
119
|
+
* to the variant-specific validator. Unknown `kind` (or missing/non-string)
|
|
120
|
+
* throws `AdapterError({ kind: 'malformed_packet', variant: <closest-known>,
|
|
121
|
+
* missingFields: ['kind'], agent: UNKNOWN_AGENT_SENTINEL })`.
|
|
122
|
+
*
|
|
123
|
+
* For the unknown-kind case we widen the `variant` discriminant with a
|
|
124
|
+
* `'task'` fallback (the most common variant) so the closed-set
|
|
125
|
+
* `AdapterErrorDetails.malformed_packet.variant` type still type-checks.
|
|
126
|
+
* The `missingFields: ['kind']` entry tells audit consumers that the
|
|
127
|
+
* discriminator itself was bad.
|
|
128
|
+
*/
|
|
129
|
+
export declare function validateAdapterPacket(packet: unknown): AdapterPacket;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AuthorityScope } from '../local-executor/authority';
|
|
2
|
+
import type { AgentKind, FailureClass, ProcessExitedInfo, ProcessRole, ProcessSpawnedInfo } from '../local-executor/types';
|
|
3
|
+
import type { AcceptedPacketReceipt } from './packets';
|
|
4
|
+
export type AdapterProgressEnvelope = AdapterProgressToolUse | AdapterProgressCommandIntent | AdapterProgressFileChange | AdapterProgressFailureSignal;
|
|
5
|
+
export interface AdapterProgressToolUse {
|
|
6
|
+
envelope_kind: 'ADAPTER_PROGRESS_TOOL_USE';
|
|
7
|
+
pid: number;
|
|
8
|
+
agentKind: AgentKind;
|
|
9
|
+
processRole: ProcessRole;
|
|
10
|
+
toolName: string;
|
|
11
|
+
toolInputDigest: string;
|
|
12
|
+
emittedAt: string;
|
|
13
|
+
coalesceCount: number;
|
|
14
|
+
}
|
|
15
|
+
export interface AdapterProgressCommandIntent {
|
|
16
|
+
envelope_kind: 'ADAPTER_PROGRESS_COMMAND_INTENT';
|
|
17
|
+
pid: number;
|
|
18
|
+
agentKind: AgentKind;
|
|
19
|
+
processRole: ProcessRole;
|
|
20
|
+
commandTextDigest: string;
|
|
21
|
+
requestedAuthorityScope: AuthorityScope;
|
|
22
|
+
emittedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AdapterProgressFileChange {
|
|
25
|
+
envelope_kind: 'ADAPTER_PROGRESS_FILE_CHANGE';
|
|
26
|
+
pid: number;
|
|
27
|
+
agentKind: AgentKind;
|
|
28
|
+
processRole: ProcessRole;
|
|
29
|
+
filePathRelative: string;
|
|
30
|
+
changeKind: 'created' | 'modified' | 'deleted';
|
|
31
|
+
byteDelta: number;
|
|
32
|
+
emittedAt: string;
|
|
33
|
+
coalesceCount: number;
|
|
34
|
+
}
|
|
35
|
+
export interface AdapterProgressFailureSignal {
|
|
36
|
+
envelope_kind: 'ADAPTER_PROGRESS_FAILURE_SIGNAL';
|
|
37
|
+
pid: number;
|
|
38
|
+
agentKind: AgentKind;
|
|
39
|
+
processRole: ProcessRole;
|
|
40
|
+
failureClass: FailureClass;
|
|
41
|
+
signalReason: string;
|
|
42
|
+
emittedAt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface AdapterProgressHooks {
|
|
45
|
+
onSpawned: (info: ProcessSpawnedInfo & {
|
|
46
|
+
packetReceipt: AcceptedPacketReceipt;
|
|
47
|
+
}) => void;
|
|
48
|
+
onExited: (info: ProcessExitedInfo) => void;
|
|
49
|
+
}
|
|
50
|
+
export declare function canonicalJsonStringify(value: unknown): string;
|
|
51
|
+
export declare function sha256OfCanonicalJson(value: unknown): string;
|
|
52
|
+
export declare function isAbsoluteFilePath(p: string): boolean;
|
|
53
|
+
export interface AdapterProgressSink {
|
|
54
|
+
emit(envelope: AdapterProgressEnvelope): void;
|
|
55
|
+
}
|
|
56
|
+
export declare class ProgressCoalescer {
|
|
57
|
+
private readonly sink;
|
|
58
|
+
private tokens;
|
|
59
|
+
private lastRefillMs;
|
|
60
|
+
private readonly pending;
|
|
61
|
+
private readonly nowMs;
|
|
62
|
+
private readonly setTimeoutFn;
|
|
63
|
+
private readonly clearTimeoutFn;
|
|
64
|
+
constructor(sink: AdapterProgressSink, opts?: {
|
|
65
|
+
now?: () => number;
|
|
66
|
+
setTimeoutFn?: (cb: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
67
|
+
clearTimeoutFn?: (h: ReturnType<typeof setTimeout>) => void;
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Submit a progress envelope. Routes by `envelope_kind`:
|
|
71
|
+
* - ToolUse / FileChange → coalesce within 200ms window.
|
|
72
|
+
* - CommandIntent / FailureSignal → emit immediately (no coalesce).
|
|
73
|
+
* In all cases the rate-limit token bucket gates the actual sink.emit().
|
|
74
|
+
* On rate-limit exhaustion the envelope is dropped silently (the drop
|
|
75
|
+
* is permanent — `coalesceCount` does NOT roll over to a future slot;
|
|
76
|
+
* the audit downstream interprets the count on a coalesced envelope as
|
|
77
|
+
* "≥ N occurrences in the window" per §9.3, and a gap as drops).
|
|
78
|
+
*/
|
|
79
|
+
submit(envelope: AdapterProgressEnvelope): void;
|
|
80
|
+
/**
|
|
81
|
+
* Flush any open coalescing windows immediately. Call at process-exit
|
|
82
|
+
* cleanup to avoid losing pending coalesced envelopes. Idempotent.
|
|
83
|
+
*/
|
|
84
|
+
flush(): void;
|
|
85
|
+
private refillTokens;
|
|
86
|
+
private consumeToken;
|
|
87
|
+
private emitWithRateLimit;
|
|
88
|
+
private coalesceToolUseOrFileChange;
|
|
89
|
+
private emitCoalescedSlot;
|
|
90
|
+
}
|
|
91
|
+
export declare const PROGRESS_COALESCE_WINDOW_MS = 200;
|
|
92
|
+
export declare const PROGRESS_RATE_LIMIT_EVENTS_PER_SECOND = 10;
|
|
93
|
+
export declare const PROGRESS_RATE_LIMIT_BURST = 20;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AuthorityScope } from '../local-executor/authority';
|
|
2
|
+
import type { AgentKind, ImplementorHandle, ProcessRole } from '../local-executor/types';
|
|
3
|
+
import { ReviewerRegistry } from '../reviewer/registry';
|
|
4
|
+
import type { ReviewerSpec } from '../reviewer/provider';
|
|
5
|
+
import type { ReviewerVerdict } from '../reviewer/types';
|
|
6
|
+
import { CapabilityRegistry, type AdapterCapabilities } from './capabilities';
|
|
7
|
+
import { type AcceptedPacketReceipt, type AdapterPacket, type ContinuationPacket, type TaskPacket } from './packets';
|
|
8
|
+
import type { AdapterProgressHooks } from './progress';
|
|
9
|
+
import type { AgentAdapter, ProbeResult, ProbeRole } from './types';
|
|
10
|
+
export declare class AdapterRegistry implements AgentAdapter {
|
|
11
|
+
private readonly scope;
|
|
12
|
+
private readonly reviewers;
|
|
13
|
+
private readonly capabilityRegistry;
|
|
14
|
+
constructor(scope: AuthorityScope, reviewers: ReviewerRegistry, capabilityRegistry: CapabilityRegistry);
|
|
15
|
+
capabilities(agent: AgentKind): AdapterCapabilities;
|
|
16
|
+
acceptPacket(packet: AdapterPacket, processRole: ProcessRole): AcceptedPacketReceipt;
|
|
17
|
+
launchImplementor(scope: AuthorityScope, packet: TaskPacket | ContinuationPacket, hooks: AdapterProgressHooks): Promise<ImplementorHandle>;
|
|
18
|
+
evaluateReviewer(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
19
|
+
probe(agent: AgentKind, role: ProbeRole): Promise<ProbeResult>;
|
|
20
|
+
refreshCapabilities(agent: AgentKind, role?: ProbeRole): Promise<AdapterCapabilities>;
|
|
21
|
+
private assertAgentAvailable;
|
|
22
|
+
private spawnArgsForProbe;
|
|
23
|
+
}
|
|
24
|
+
export declare function createDefaultAdapterRegistry(scope: AuthorityScope): AdapterRegistry;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AuthorityScope } from '../local-executor/authority';
|
|
2
|
+
import type { AgentKind, FailureClass, ImplementorHandle, ProcessRole } from '../local-executor/types';
|
|
3
|
+
import type { ReviewerSpec } from '../reviewer/provider';
|
|
4
|
+
import type { ReviewerVerdict } from '../reviewer/types';
|
|
5
|
+
import type { AdapterCapabilities } from './capabilities';
|
|
6
|
+
import type { AcceptedPacketReceipt, AdapterPacket, ContinuationPacket, TaskPacket } from './packets';
|
|
7
|
+
import type { AdapterProgressHooks } from './progress';
|
|
8
|
+
export type ProbeRole = 'health_probe' | 'auth_probe' | 'model_probe';
|
|
9
|
+
export interface ProbeResult {
|
|
10
|
+
exitCode: number;
|
|
11
|
+
failureClass: FailureClass;
|
|
12
|
+
stdout: string;
|
|
13
|
+
stderr: string;
|
|
14
|
+
runtimeMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentAdapter {
|
|
17
|
+
capabilities(agent: AgentKind): AdapterCapabilities;
|
|
18
|
+
acceptPacket(packet: AdapterPacket, processRole: ProcessRole): AcceptedPacketReceipt;
|
|
19
|
+
launchImplementor(scope: AuthorityScope, packet: TaskPacket | ContinuationPacket, hooks: AdapterProgressHooks): Promise<ImplementorHandle>;
|
|
20
|
+
evaluateReviewer(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
21
|
+
probe(agent: AgentKind, role: ProbeRole): Promise<ProbeResult>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|