@kynver-app/runtime 0.1.172 → 0.2.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 (58) hide show
  1. package/README.md +12 -1
  2. package/dist/chat/command-auth-proof.js +1 -1
  3. package/dist/cli.js +59 -58
  4. package/dist/completion-response.d.ts +1 -1
  5. package/dist/config.d.ts +2 -0
  6. package/dist/context-budget-receipt.d.ts +96 -0
  7. package/dist/daemon-heartbeat.d.ts +7 -0
  8. package/dist/daemon-supervision/index.d.ts +1 -0
  9. package/dist/daemon-supervision/setup.d.ts +10 -1
  10. package/dist/daemon-supervision/supervision-health.d.ts +20 -0
  11. package/dist/daemon-supervision/verify.d.ts +1 -0
  12. package/dist/dispatch-model-guard.d.ts +26 -0
  13. package/dist/dispatch-resource-gate.d.ts +20 -0
  14. package/dist/doctor/context-envelope-cli.d.ts +1 -0
  15. package/dist/doctor/context-envelope.d.ts +13 -0
  16. package/dist/doctor/context-envelope.probes.d.ts +25 -0
  17. package/dist/doctor/context-envelope.types.d.ts +42 -0
  18. package/dist/doctor/github-readiness.d.ts +16 -0
  19. package/dist/doctor/index.d.ts +3 -0
  20. package/dist/doctor/node-runtime-cli.d.ts +6 -0
  21. package/dist/doctor/node-runtime.d.ts +19 -0
  22. package/dist/doctor/runtime-takeover-deploy-evidence.d.ts +9 -0
  23. package/dist/doctor/runtime-takeover.probes.d.ts +5 -0
  24. package/dist/executor-ref-routing.d.ts +14 -0
  25. package/dist/factory-steer-delivery.d.ts +7 -0
  26. package/dist/index.d.ts +11 -1
  27. package/dist/index.js +85 -75
  28. package/dist/landing/land-pr-check-classify.d.ts +11 -0
  29. package/dist/model-routing.d.ts +1 -1
  30. package/dist/node-runtime-policy.d.ts +25 -0
  31. package/dist/node-runtime-policy.js +1 -0
  32. package/dist/paths.d.ts +1 -1
  33. package/dist/prompt.d.ts +36 -2
  34. package/dist/providers/claude.d.ts +2 -0
  35. package/dist/providers/cursor.d.ts +2 -0
  36. package/dist/providers/types.d.ts +4 -0
  37. package/dist/review-head-reconcile.d.ts +17 -0
  38. package/dist/run-store.d.ts +6 -0
  39. package/dist/runner-boundary/index.d.ts +6 -0
  40. package/dist/runner-boundary/runner-boundary.dispatch-guard.d.ts +4 -0
  41. package/dist/runner-boundary/runner-boundary.forge-legacy-migration.d.ts +23 -0
  42. package/dist/runner-boundary/runner-boundary.harness-root.d.ts +17 -0
  43. package/dist/runner-boundary/runner-boundary.resolve.d.ts +4 -0
  44. package/dist/runner-boundary/runner-boundary.run-guard.d.ts +12 -0
  45. package/dist/runner-boundary/runner-boundary.types.d.ts +31 -0
  46. package/dist/runner-config-backfill.d.ts +18 -0
  47. package/dist/runtime-identity.d.ts +9 -0
  48. package/dist/runtime-memory-envelope.d.ts +16 -0
  49. package/dist/security-review-environment.d.ts +27 -0
  50. package/dist/server/cleanup.js +14 -14
  51. package/dist/server/default-repo.js +1 -1
  52. package/dist/server/monitor.js +7 -7
  53. package/dist/server/worker-policy.d.ts +2 -0
  54. package/dist/server/worker-policy.js +1 -1
  55. package/dist/status.d.ts +9 -0
  56. package/dist/supervisor.d.ts +2 -0
  57. package/dist/worker-execution-mode.d.ts +5 -0
  58. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  /** Parsed outcome from POST /harness/completion (AgentOS handleHarnessWorkerCompletion). */
2
- export type HarnessCompletionRouteOutcome = "review_scheduled" | "review_already_scheduled" | "needs_attention" | "mirror_only" | "task_not_found" | "task_not_harness" | "skipped_terminal_task" | "closed" | "dispatched" | "dispatch_already_done" | "blocked" | "reviewer_no_parent" | "landing_no_parent";
2
+ export type HarnessCompletionRouteOutcome = "review_scheduled" | "review_already_scheduled" | "needs_attention" | "mirror_only" | "task_not_found" | "task_not_harness" | "skipped_terminal_task" | "closed" | "dispatched" | "dispatch_already_done" | "steer_restart_required" | "blocked" | "reviewer_no_parent" | "landing_no_parent";
3
3
  export interface HarnessCompletionResponseSummary {
4
4
  routeOutcome: HarnessCompletionRouteOutcome | null;
5
5
  /** True when the board task should have moved into review (or already was). */
package/dist/config.d.ts CHANGED
@@ -21,6 +21,8 @@ export interface KynverUserConfig {
21
21
  daemonSupervisionOwner?: "keeper" | "systemd";
22
22
  /** Physical box pool for capacity snapshots (`forge` | `ghost`). Set via `kynver setup --box-kind`. */
23
23
  boxKind?: "ghost" | "forge";
24
+ /** Stable runner id for lease attribution and cross-box dispatch guards. */
25
+ runnerId?: string;
24
26
  /** Stable physical box id for capacity snapshots, e.g. `forge:travelcase`. */
25
27
  boxId?: string;
26
28
  /**
@@ -0,0 +1,96 @@
1
+ /** Pure context-budget receipt schema — no AgentOS/app dependencies. */
2
+ export declare const RUNTIME_CONTEXT_BUDGET_RECEIPT_SCHEMA_VERSION: "runtime-context-budget-receipt.v1";
3
+ export declare const RUNTIME_CONTEXT_BUDGET_RECEIPT_V2_SCHEMA_VERSION: "runtime-context-budget-receipt.v2";
4
+ export type RuntimeContextBudgetReceiptSchemaVersion = typeof RUNTIME_CONTEXT_BUDGET_RECEIPT_SCHEMA_VERSION | typeof RUNTIME_CONTEXT_BUDGET_RECEIPT_V2_SCHEMA_VERSION;
5
+ export type ContextEnvelopeMode = "routine" | "review" | "ops" | "debug" | "handoff";
6
+ export type ContextBudgetReceiptSurface = "chat_default" | "context_envelope" | "harness_worker" | "runtime_prompt" | "mcp_tool_context" | "agentos_handoff" | "operator_debug" | "full_expansion";
7
+ export type RuntimeContextSection = "instruction_policy" | "persona" | "task_envelope" | "active_state" | "memory_preview" | "memory_quality" | "recent_failures" | "onboarding" | "structural";
8
+ export type RuntimeContextRehydrationKind = "memory" | "task" | "plan" | "active_state" | "source";
9
+ export interface RuntimeContextRehydrationRoute {
10
+ handle: string;
11
+ kind: RuntimeContextRehydrationKind;
12
+ }
13
+ export interface RuntimeContextSectionReceipt {
14
+ section: RuntimeContextSection;
15
+ chars: number;
16
+ estimatedTokens: number;
17
+ fingerprint?: string | null;
18
+ selectedSlugs?: string[];
19
+ omittedCount?: number;
20
+ duplicatesCollapsed?: number;
21
+ policyFingerprint?: string | null;
22
+ rehydrationRoutes?: RuntimeContextRehydrationRoute[];
23
+ }
24
+ export type RuntimeContextActiveStateLookupKind = "pr" | "branch" | "deploy" | "daemon" | "task" | "worker";
25
+ export type RuntimeContextActiveStateLookupStatus = "used" | "missing" | "error";
26
+ export interface RuntimeContextActiveStateLookup {
27
+ kind: RuntimeContextActiveStateLookupKind;
28
+ handle: string;
29
+ status: RuntimeContextActiveStateLookupStatus;
30
+ }
31
+ export interface UsefulContextCoverage {
32
+ requiredOperatingRuleSlugsPresent: string[];
33
+ requiredOperatingRuleDenominator: number;
34
+ activeTaskHandlePresent: boolean;
35
+ planHandlePresent: boolean;
36
+ selectedHandles: string[];
37
+ omittedHandles: string[];
38
+ expansionRoutes: string[];
39
+ memoryQualityTraceId?: string | null;
40
+ }
41
+ export interface RuntimeContextBudgetReceipt {
42
+ schemaVersion: typeof RUNTIME_CONTEXT_BUDGET_RECEIPT_SCHEMA_VERSION;
43
+ agentOsId: string;
44
+ taskId: string;
45
+ planId: string | null;
46
+ personaSlug: string | null;
47
+ mode: ContextEnvelopeMode;
48
+ generatedAt: string;
49
+ totalChars: number;
50
+ estimatedTokens: number;
51
+ duplicatesCollapsed: number;
52
+ omittedCount: number;
53
+ activeStateLookups: RuntimeContextActiveStateLookup[];
54
+ sections: RuntimeContextSectionReceipt[];
55
+ }
56
+ export interface RuntimeContextBudgetReceiptV2 extends Omit<RuntimeContextBudgetReceipt, "schemaVersion" | "agentOsId" | "taskId"> {
57
+ schemaVersion: typeof RUNTIME_CONTEXT_BUDGET_RECEIPT_V2_SCHEMA_VERSION;
58
+ surface: ContextBudgetReceiptSurface;
59
+ agentOsId: string | null;
60
+ taskId: string | null;
61
+ finalSerializedChars: number;
62
+ finalSerializedTokens: number;
63
+ usefulContextCoverage: UsefulContextCoverage;
64
+ budgetSatisfied: boolean;
65
+ overBudgetReason: string | null;
66
+ }
67
+ /** Deterministic chars → token estimate (4 UTF-16 code units per token, ceiling). */
68
+ export declare function estimateTokensFromChars(chars: number): number;
69
+ export declare function sectionReceiptFromMarkdown(section: RuntimeContextSection, markdown: string | null | undefined, extras?: Partial<Pick<RuntimeContextSectionReceipt, "fingerprint" | "selectedSlugs" | "omittedCount" | "duplicatesCollapsed" | "policyFingerprint" | "rehydrationRoutes">>): RuntimeContextSectionReceipt;
70
+ export declare function finalizeReceiptTotals(sections: RuntimeContextSectionReceipt[], overrides?: {
71
+ duplicatesCollapsed?: number;
72
+ omittedCount?: number;
73
+ }): Pick<RuntimeContextBudgetReceipt, "totalChars" | "estimatedTokens" | "duplicatesCollapsed" | "omittedCount">;
74
+ export interface BuildContextBudgetReceiptV2Input {
75
+ surface: ContextBudgetReceiptSurface;
76
+ agentOsId?: string | null;
77
+ taskId?: string | null;
78
+ planId?: string | null;
79
+ personaSlug?: string | null;
80
+ mode: ContextEnvelopeMode;
81
+ generatedAt: string;
82
+ finalSerializedChars: number;
83
+ sections: RuntimeContextSectionReceipt[];
84
+ usefulContextCoverage: UsefulContextCoverage;
85
+ activeStateLookups?: RuntimeContextActiveStateLookup[];
86
+ duplicatesCollapsed?: number;
87
+ omittedCount?: number;
88
+ budgetSatisfied?: boolean;
89
+ overBudgetReason?: string | null;
90
+ }
91
+ export declare function buildContextBudgetReceiptV2(input: BuildContextBudgetReceiptV2Input): RuntimeContextBudgetReceiptV2;
92
+ export declare function upgradeReceiptToV2(v1: RuntimeContextBudgetReceipt, input: Omit<BuildContextBudgetReceiptV2Input, "sections" | "mode" | "generatedAt"> & {
93
+ mode?: ContextEnvelopeMode;
94
+ generatedAt?: string;
95
+ }): RuntimeContextBudgetReceiptV2;
96
+ export declare function isRuntimeContextBudgetReceiptV2(receipt: RuntimeContextBudgetReceipt | RuntimeContextBudgetReceiptV2): receipt is RuntimeContextBudgetReceiptV2;
@@ -1,3 +1,4 @@
1
+ import { type RuntimeIdentityV1 } from "./runtime-identity.js";
1
2
  export interface DaemonHeartbeat {
2
3
  observedAt: string;
3
4
  pid: number;
@@ -5,6 +6,12 @@ export interface DaemonHeartbeat {
5
6
  agentOsId: string;
6
7
  /** Active server-delivered instruction bundle version (M6); additive. */
7
8
  instructionBundleVersion?: string;
9
+ /**
10
+ * Versioned runtime identity (Node 24 migration N2b); additive. Absent on
11
+ * pre-N2b payloads — consumers MUST map absence to `unknown`, never
12
+ * `compatible`.
13
+ */
14
+ runtimeIdentity?: RuntimeIdentityV1;
8
15
  }
9
16
  export declare function daemonHeartbeatPath(agentOsId: string): string;
10
17
  /** Best-effort atomic write (temp + rename). Never throws. */
@@ -3,3 +3,4 @@ export { buildDaemonSupervisionPolicy, defaultSupervisionOwner, formatSupervisio
3
3
  export { applyDaemonSupervisionSetup, defaultSystemdUserUnitPath, isSystemdSupervisionInstalled, supervisionOwnerForDoctor, type DaemonSupervisionSetupResult, } from "./setup.js";
4
4
  export { ensureDaemonSupervisionForStart, formatSystemdDelegationGuidance, shouldDelegateStartToSystemd, summarizeSupervisionForStart, type EnsureDaemonSupervisionInput, type EnsureDaemonSupervisionResult, } from "./start.js";
5
5
  export { assessDaemonSupervisionChecks, type AssessDaemonSupervisionOptions, type DaemonSupervisionVerifyCheck, } from "./verify.js";
6
+ export { assessSupervisionHealth, type SupervisionHealth } from "./supervision-health.js";
@@ -8,7 +8,16 @@ export interface DaemonSupervisionSetupResult {
8
8
  envChanged: boolean;
9
9
  configUpdated: boolean;
10
10
  }
11
+ export interface DaemonSupervisionPersistIdentity {
12
+ agentOsId: string;
13
+ runId: string;
14
+ }
15
+ export interface DaemonSupervisionConfigIdentity extends DaemonSupervisionPersistIdentity {
16
+ owner: DaemonSupervisionOwner;
17
+ }
18
+ /** Partial ~/.kynver/config.json updates for restart/watchdog supervision identity. */
19
+ export declare function buildDaemonSupervisionConfigUpdates(config: KynverUserConfig, identity: DaemonSupervisionConfigIdentity): Partial<KynverUserConfig>;
11
20
  export declare function defaultSystemdUserUnitPath(): string;
12
21
  export declare function isSystemdSupervisionInstalled(): boolean;
13
- export declare function applyDaemonSupervisionSetup(config: KynverUserConfig, args?: Record<string, string | boolean>, hostKind?: SupportedHostKind): DaemonSupervisionSetupResult;
22
+ export declare function applyDaemonSupervisionSetup(config: KynverUserConfig, args?: Record<string, string | boolean>, hostKind?: SupportedHostKind, identity?: DaemonSupervisionPersistIdentity): DaemonSupervisionSetupResult;
14
23
  export declare function supervisionOwnerForDoctor(config: KynverUserConfig, hostKind: SupportedHostKind): DaemonSupervisionOwner;
@@ -0,0 +1,20 @@
1
+ import type { KynverUserConfig } from "../config.js";
2
+ import type { DaemonSupervisionOwner } from "./policy.js";
3
+ export interface SupervisionHealthOptions {
4
+ envFilePath?: string;
5
+ /** Injectable for tests. */
6
+ systemdUnitActive?: () => boolean;
7
+ }
8
+ export interface SupervisionHealth {
9
+ owner: DaemonSupervisionOwner | null;
10
+ daemonPresentSignal: boolean;
11
+ systemdUnitInstalled: boolean;
12
+ systemdUnitActive: boolean;
13
+ /** True when restart policy is persisted or inferable from a healthy supervised daemon. */
14
+ effectivelyConfigured: boolean;
15
+ }
16
+ /**
17
+ * Infer whether a keeper/systemd-owned daemon is already healthy on this host,
18
+ * so doctor checks avoid stale warnings on upgraded installs.
19
+ */
20
+ export declare function assessSupervisionHealth(config: KynverUserConfig, options?: SupervisionHealthOptions): SupervisionHealth;
@@ -2,6 +2,7 @@ import type { KynverUserConfig } from "../config.js";
2
2
  export interface AssessDaemonSupervisionOptions {
3
3
  /** Override for tests; defaults to ~/.kynver/.env */
4
4
  envFilePath?: string;
5
+ systemdUnitActive?: () => boolean;
5
6
  }
6
7
  export interface DaemonSupervisionVerifyCheck {
7
8
  id: string;
@@ -0,0 +1,26 @@
1
+ import type { ModelRoutingDecision } from "./model-routing.js";
2
+ export interface DispatchModelGuardInput {
3
+ task?: Record<string, unknown> | null;
4
+ routing: ModelRoutingDecision;
5
+ explicitProvider?: string | null;
6
+ explicitModel?: string | null;
7
+ }
8
+ export interface DispatchModelGuardResult {
9
+ ok: boolean;
10
+ error?: string;
11
+ requested?: {
12
+ provider?: string;
13
+ model?: string;
14
+ source: string;
15
+ };
16
+ resolved?: {
17
+ provider: string;
18
+ model?: string;
19
+ rule: string;
20
+ };
21
+ }
22
+ /**
23
+ * Block spawn when the board row (or CLI) requested a non-Cursor provider/model
24
+ * but routing resolved to Cursor — silent downgrade is worse than an explicit skip.
25
+ */
26
+ export declare function assessDispatchModelGuard(input: DispatchModelGuardInput): DispatchModelGuardResult;
@@ -0,0 +1,20 @@
1
+ import { type WorkspaceRuntimePreferences } from "./workspace-runtime-config.js";
2
+ import { type ObserveResourceGateInput, type RunnerResourceGateShape } from "./resource-gate.js";
3
+ interface DispatchResourceGateDependencies {
4
+ fetchPreferences: (agentOsId: string, args: Record<string, string | boolean>) => Promise<WorkspaceRuntimePreferences | null>;
5
+ configuredOverride: (preferences: WorkspaceRuntimePreferences | null | undefined, env?: NodeJS.ProcessEnv) => number | undefined;
6
+ observe: (input: ObserveResourceGateInput) => RunnerResourceGateShape;
7
+ }
8
+ /**
9
+ * Resolve interactive dispatch capacity from the same workspace preference as
10
+ * the keeper daemon. Local config/env/auto sizing remains the fallback when
11
+ * the workspace has no authoritative Ghost cap; Forge ignores the workspace
12
+ * override through configuredMaxWorkersOverrideForBox.
13
+ */
14
+ export declare function observeInteractiveDispatchResourceGate(input: {
15
+ runId: string;
16
+ agentOsId: string;
17
+ args: Record<string, string | boolean>;
18
+ env?: NodeJS.ProcessEnv;
19
+ }, dependencies?: DispatchResourceGateDependencies): Promise<RunnerResourceGateShape>;
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare function runContextEnvelopeDoctorCli(args: Record<string, string | boolean>): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { type ContextEnvelopeDoctorProbes } from "./context-envelope.probes.js";
2
+ import type { ContextEnvelopeDoctorReport } from "./context-envelope.types.js";
3
+ /** Stable non-existent anchor for fail-closed probe — never a real row id. */
4
+ export declare const CONTEXT_ENVELOPE_SMOKE_MISSING_ANCHOR_ID = "00000000-0000-4000-8000-000000000001";
5
+ export interface AssessContextEnvelopeDoctorInput {
6
+ slug?: string;
7
+ agentOsId?: string;
8
+ baseUrl?: string;
9
+ taskId?: string;
10
+ apiKey?: string;
11
+ }
12
+ export declare function assessContextEnvelopeDoctor(input?: AssessContextEnvelopeDoctorInput, probes?: ContextEnvelopeDoctorProbes): Promise<ContextEnvelopeDoctorReport>;
13
+ export declare function redactContextEnvelopeDoctorReport(report: ContextEnvelopeDoctorReport, secret?: string): ContextEnvelopeDoctorReport;
@@ -0,0 +1,25 @@
1
+ export interface HttpJsonResult {
2
+ ok: boolean;
3
+ status: number;
4
+ response: unknown;
5
+ }
6
+ export interface ContextEnvelopeDoctorProbeConfig {
7
+ slug: string;
8
+ agentOsId: string;
9
+ baseUrl: string;
10
+ apiKey?: string;
11
+ runnerSecret?: string;
12
+ }
13
+ export interface ContextEnvelopeDoctorProbes {
14
+ loadConfig(): {
15
+ slug: string;
16
+ agentOsId: string;
17
+ baseUrl: string;
18
+ apiKey?: string;
19
+ };
20
+ resolveRunnerSecret(agentOsId: string, baseUrl: string): Promise<string | null>;
21
+ fetchContextEnvelope(config: ContextEnvelopeDoctorProbeConfig, anchorType: string, anchorId: string): Promise<HttpJsonResult>;
22
+ fetchTasks(config: ContextEnvelopeDoctorProbeConfig, limit?: number): Promise<HttpJsonResult>;
23
+ fetchRetrieveTelemetryDiagnostic(config: ContextEnvelopeDoctorProbeConfig): Promise<HttpJsonResult>;
24
+ }
25
+ export declare function defaultContextEnvelopeDoctorProbes(): ContextEnvelopeDoctorProbes;
@@ -0,0 +1,42 @@
1
+ import type { DoctorSection } from "./doctor.types.js";
2
+ /** Redacted operator summary for a live context-envelope smoke probe. */
3
+ export interface ContextEnvelopeSmokeSummary {
4
+ slug: string;
5
+ agentOsId: string;
6
+ taskId: string;
7
+ anchor: {
8
+ type: string;
9
+ id: string;
10
+ exists: boolean;
11
+ title: string | null;
12
+ status: string | null;
13
+ };
14
+ personaSlug: string | null;
15
+ memoryCount: number;
16
+ operatingRuleCount: number;
17
+ withinBudget: boolean;
18
+ projection: string | null;
19
+ mode: string | null;
20
+ contractVersion: string | null;
21
+ serializedBytes: number | null;
22
+ }
23
+ export interface ContextEnvelopeTelemetrySummary {
24
+ slug: string;
25
+ status: string;
26
+ summary: string;
27
+ eventCount: number | null;
28
+ retrieveCount: number | null;
29
+ }
30
+ export interface ContextEnvelopeDoctorReport {
31
+ command: "doctor context-envelope";
32
+ ready: boolean;
33
+ summary: string;
34
+ counts: {
35
+ pass: number;
36
+ warn: number;
37
+ fail: number;
38
+ };
39
+ sections: DoctorSection[];
40
+ envelopeSummary: ContextEnvelopeSmokeSummary | null;
41
+ telemetryDiagnostic: ContextEnvelopeTelemetrySummary | null;
42
+ }
@@ -0,0 +1,16 @@
1
+ import type { CommandProbeResult } from "./runtime-takeover.probes.js";
2
+ export type GitHubReadinessSource = "env" | "gh-cli" | "missing";
3
+ export interface GitHubReadinessProbe {
4
+ envGithubToken?: boolean;
5
+ envGhToken?: boolean;
6
+ ghAuthToken(): CommandProbeResult;
7
+ }
8
+ export interface GitHubReadinessResult {
9
+ viable: boolean;
10
+ source: GitHubReadinessSource;
11
+ summary: string;
12
+ }
13
+ /**
14
+ * Read-only GitHub auth probe for doctor checks. Never prints or persists tokens.
15
+ */
16
+ export declare function probeGitHubReadiness(probe: GitHubReadinessProbe): GitHubReadinessResult;
@@ -2,3 +2,6 @@ export type { DoctorCheck, DoctorCheckStatus, DoctorSection, RuntimeTakeoverDoct
2
2
  export { assessRuntimeTakeoverReadiness, } from "./runtime-takeover.js";
3
3
  export { defaultRuntimeTakeoverProbes, type CommandProbeResult, type RuntimeTakeoverProbes, } from "./runtime-takeover.probes.js";
4
4
  export { runRuntimeTakeoverDoctorCli } from "./runtime-takeover-cli.js";
5
+ export { assessContextEnvelopeDoctor, redactContextEnvelopeDoctorReport, CONTEXT_ENVELOPE_SMOKE_MISSING_ANCHOR_ID, } from "./context-envelope.js";
6
+ export type { ContextEnvelopeDoctorReport, ContextEnvelopeSmokeSummary, ContextEnvelopeTelemetrySummary, } from "./context-envelope.types.js";
7
+ export { runContextEnvelopeDoctorCli } from "./context-envelope-cli.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `kynver doctor node-runtime [--json]` — report-only in N2b: always exits 0
3
+ * so nothing can gate on it before the N2d guard swap; the verdict lives in
4
+ * the printed report.
5
+ */
6
+ export declare function runNodeRuntimeDoctorCli(): void;
@@ -0,0 +1,19 @@
1
+ import { type NodeRuntimePolicyVerdict } from "../node-runtime-policy.js";
2
+ import type { RuntimeIdentityV1 } from "../runtime-identity.js";
3
+ export interface NodeRuntimeDoctorReport {
4
+ command: "doctor node-runtime";
5
+ contractVersion: 1;
6
+ nodeVersion: string;
7
+ requiredRange: string;
8
+ status: NodeRuntimePolicyVerdict["status"];
9
+ remediation: string | null;
10
+ platform: NodeJS.Platform;
11
+ arch: string;
12
+ runtimePackageVersion: string;
13
+ buildIdentity: string | null;
14
+ }
15
+ export declare function buildNodeRuntimeDoctorReport(options?: {
16
+ nodeVersion?: string;
17
+ requiredRange?: string;
18
+ identity?: RuntimeIdentityV1;
19
+ }): NodeRuntimeDoctorReport;
@@ -0,0 +1,9 @@
1
+ import type { DoctorSection } from "./doctor.types.js";
2
+ import { type GitHubReadinessProbe } from "./github-readiness.js";
3
+ import type { RuntimeTakeoverProbes } from "./runtime-takeover.probes.js";
4
+ /**
5
+ * Optional deploy-evidence checks for merge-gate / PR handoff workflows.
6
+ * Core runtime takeover does not require Vercel CLI or VERCEL_TOKEN when GitHub
7
+ * commit-status evidence is viable.
8
+ */
9
+ export declare function assessDeployEvidence(probes: RuntimeTakeoverProbes, githubProbe: GitHubReadinessProbe): DoctorSection;
@@ -36,5 +36,10 @@ export interface RuntimeTakeoverProbes {
36
36
  legacyOpenclawHarnessRoot(): string;
37
37
  pathExists(target: string): boolean;
38
38
  pathWritable(target: string): boolean;
39
+ ghAuthToken(): CommandProbeResult;
40
+ /** When false, GitHub/Vercel deploy-evidence checks are advisory-only skips. */
41
+ deployEvidenceNeedsGithub?(): boolean;
42
+ /** Injectable systemd active probe for supervision checks. */
43
+ systemdDaemonActive?(): boolean;
39
44
  }
40
45
  export declare const defaultRuntimeTakeoverProbes: RuntimeTakeoverProbes;
@@ -0,0 +1,14 @@
1
+ /** Parse provider/model intent encoded in board `executorRef` strings. */
2
+ export interface ExecutorRefRoutingIntent {
3
+ provider?: string;
4
+ model?: string;
5
+ lane?: string;
6
+ rule: string;
7
+ }
8
+ /**
9
+ * Best-effort decode of model/provider intent from task executorRef.
10
+ * Supports `harness-lane:{lane}:{model}` and `provider:{name}[:{model}]`.
11
+ */
12
+ export declare function parseExecutorRefRoutingIntent(executorRef: string | null | undefined): ExecutorRefRoutingIntent | null;
13
+ /** True when executorRef encodes a non-Cursor worker provider/model request. */
14
+ export declare function executorRefRequestsNonCursorWorker(executorRef: string | null | undefined): boolean;
@@ -0,0 +1,7 @@
1
+ import type { HarnessWorkerRecord } from "./status.js";
2
+ export declare function pollAndInterruptForHarnessSteers(input: {
3
+ runId: string;
4
+ worker: HarnessWorkerRecord;
5
+ baseUrl: string;
6
+ secret: string;
7
+ }): Promise<boolean>;
package/dist/index.d.ts CHANGED
@@ -19,7 +19,8 @@ export { isEngagementRequiredSkip } from "./fortress-engagement-gate.js";
19
19
  export { assessWorkerLandingContract, landingContractAttentionReason, type WorkerLandingContract, type WorkerLandingContractVerdict, type TargetPrReconciliation, } from "./landing-contract-gate.js";
20
20
  export { assessExitedWorkerSalvage, type ExitedSalvageAssessment, type ExitedSalvageKind, } from "./exited-salvage.js";
21
21
  export { persistExitedWorkerHandoffCapture, resolveExitedWorkerFinalResult, type ExitedHandoffCapture, type ExitedHandoffCaptureSource, } from "./exited-worker-handoff-capture.js";
22
- export { buildPrompt } from "./prompt.js";
22
+ export { buildPrompt, buildPromptWithReceipt, RUNTIME_PROMPT_ENFORCEMENT, type BuildPromptInput, } from "./prompt.js";
23
+ export { RUNTIME_CONTEXT_BUDGET_RECEIPT_SCHEMA_VERSION, RUNTIME_CONTEXT_BUDGET_RECEIPT_V2_SCHEMA_VERSION, buildContextBudgetReceiptV2, estimateTokensFromChars, finalizeReceiptTotals, isRuntimeContextBudgetReceiptV2, sectionReceiptFromMarkdown, upgradeReceiptToV2, type BuildContextBudgetReceiptV2Input, type ContextBudgetReceiptSurface, type ContextEnvelopeMode, type RuntimeContextActiveStateLookup, type RuntimeContextActiveStateLookupKind, type RuntimeContextActiveStateLookupStatus, type RuntimeContextBudgetReceipt, type RuntimeContextBudgetReceiptSchemaVersion, type RuntimeContextBudgetReceiptV2, type RuntimeContextRehydrationKind, type RuntimeContextRehydrationRoute, type RuntimeContextSection, type RuntimeContextSectionReceipt, type UsefulContextCoverage, } from "./context-budget-receipt.js";
23
24
  export { canonicalJsonStringify, computeInstructionBundleVersion, deriveInstructionBundleKeyId, parseRawEd25519Key, isSignedInstructionBundleShape, PINNED_INSTRUCTION_BUNDLE_PUBLIC_KEYS, resolveInstructionBundlePublicKey, verifyInstructionBundleSignatureWithKey, verifySignedInstructionBundle, EMBEDDED_INSTRUCTION_BUNDLE, EMBEDDED_INSTRUCTION_BUNDLE_VERSION, getActiveInstructionBundle, getActiveInstructionBundleSource, getActiveInstructionBundleVersion, setActiveInstructionBundle, resolveInstructionText, resolvePolicyThreshold, resolveBundlePersona, ensureInstructionBundle, instructionBundleCachePath, loadInstructionBundleCache, saveInstructionBundleCache, INSTRUCTION_BUNDLE_REFRESH_TTL_MS, type InstructionBundle, type InstructionBundleContent, type InstructionBundlePersona, type SignedInstructionBundle, type InstructionBundleSource, type InstructionBundleVerifyResult, type EnsureInstructionBundleOptions, type EnsureInstructionBundleResult, } from "./instruction-bundle/index.js";
24
25
  export { WORKER_PERSONA_CATALOG, getWorkerPersonaCatalogEntry, getPersonaDispatchLane, getPersonaDefaultRoleLane, isKnownWorkerPersonaSlug, workerPersonaReviewSlugs, workerPersonaLandingSlugs, type WorkerPersonaCatalogEntry, type WorkerPersonaCatalogSlug, type WorkerPersonaDispatchLane, type WorkerPersonaDefaultRoleLane, } from "./worker-persona-catalog.js";
25
26
  export { assessPrHandoffRequirement, ensurePrReadyHandoff, extractPrUrlFromText, } from "./pr-handoff/index.js";
@@ -31,8 +32,13 @@ export * from "./cron/hermes-provider-notice.js";
31
32
  export { buildOrchestrationProviderInventory, classifyOrchestrationRisk, compareProviderCandidates, getOrchestrationProviderCapability, listOrchestrationProviderCapabilities, probeClaudeOAuthBinding, probeCodexOAuthBinding, probeCursorOAuthBinding, probeHermesCliAdapter, probeHermesOpenAiCodexBinding, probeOrchestrationProviderBinding, providerCapableForRisk, resolveCodexOrchestrationAdapter, resolveOrchestrationRouting, selectCheapestCapableProvider, sanitizeOrchestrationAudit, orchestrationAuditForWorkerJson, getAdapterContextContract, listAdapterContextContracts, type AdapterContextCapability, type AdapterContextContract, type AdapterContextContractId, type CodexOrchestrationAdapterStatus, type CodexOrchestrationPath, type HermesCliAdapterStatus, type HermesOpenAiCodexBindingStatus, type OrchestrationAuthSource, type OrchestrationCloudApiCredits, type OrchestrationCostTier, type OrchestrationProviderBindingStatus, type OrchestrationProviderCapability, type OrchestrationProviderId, type OrchestrationProviderInventory, type OrchestrationRiskClass, type OrchestrationRoutingAudit, type OrchestrationRoutingDecision, } from "./orchestration-providers/index.js";
32
33
  export { ORCHESTRATION_POLICY_MODES, ORCHESTRATION_ACTION_KINDS, ORCHESTRATION_POLICY_DECISIONS, resolveOrchestrationPolicyMode, isOrchestrationEnforceTasksEnabled, buildForegroundHarnessIdempotencyKey, evaluateOrchestrationPolicy, type OrchestrationPolicyMode, type OrchestrationActionKind, type OrchestrationPolicyDecision, type OrchestrationPolicyEvaluateInput, type OrchestrationPolicyEvaluateResult, } from "./orchestration-enforcement/index.js";
33
34
  export { DEFAULT_WORKER_PROVIDER, enforceCursorWorkerProvider, isClaudeFamilyProvider, preferCursorExecutor, resolveConfiguredWorkerProvider, taskAllowsClaudeWorker, type EnforceCursorWorkerProviderInput, } from "./worker-provider-policy.js";
35
+ export { parseExecutorRefRoutingIntent, executorRefRequestsNonCursorWorker, type ExecutorRefRoutingIntent, } from "./executor-ref-routing.js";
36
+ export { assessDispatchModelGuard, type DispatchModelGuardInput, type DispatchModelGuardResult, } from "./dispatch-model-guard.js";
37
+ export { GLOBAL_DEFAULT_MODEL, CURSOR_DEFAULT_MODEL, inferModelRoutingFromTask, resolveGlobalDefaultModel, resolveModelFallback, resolveWorkerLaunch, type ModelRoutingDecision, } from "./model-routing.js";
34
38
  export { redactHarness } from "./redact.js";
35
39
  export { scrubWorkerEnv, scrubClaudeEnv, auditWorkerEnv, listForbiddenWorkerEnvKeys, isForbiddenWorkerEnvKey, FORBIDDEN_WORKER_ENV_KEYS, type WorkerEnvAudit, } from "./worker-env.js";
40
+ export { KYNVER_NO_PROD_DB_CREDENTIALS_ENV, REVIEW_WORKER_EXTRA_FORBIDDEN_ENV_KEYS, ProductionDatabaseCredentialBlockedError, assertProductionDatabaseResolutionAllowed, auditReviewWorkerCredentialScope, buildWorkerSpawnEnv, isNoProdCredentialReviewEnvironment, type BuildWorkerSpawnEnvOptions, type ReviewWorkerCredentialScopeAudit, } from "./security-review-environment.js";
41
+ export { isHarnessExpertReviewWorker } from "./harness-expert-review.js";
36
42
  export { discoverProductionDbEnvFilePaths, expandHomePath } from "./db-credential-env-paths.js";
37
43
  export { applyProductionDatabaseToProcess, readProductionDbKeysFromEnvFile, resolveProductionDatabaseUrl, type DbCredentialResolution, type DbCredentialFailure, type DbCredentialSource, type ResolveProductionDatabaseResult, type ResolveProductionDatabaseOptions, } from "./db-credential-resolver.js";
38
44
  export { safeDatabaseUrlHint } from "./db-url-hint.js";
@@ -71,3 +77,7 @@ export { persistPlan, drainPlanOutbox, listOutboxItems, formatPlanOutboxHandoffB
71
77
  export { classifyVercelUrl, collectVercelEvidence, evidenceFromGitHubVercelStatus, isDashboardVercelUrl, isInspectableVercelTarget, isVercelStatusContext, pickVercelStatusContext, resolveVercelInspectTarget, type CollectVercelEvidenceInput, type GitHubCommitStatusRow, type VercelEvidenceResult, type VercelEvidenceStatus, } from "./vercel/index.js";
72
78
  export { validateJobEnvelope, type LocalCodexJobEnvelope, type LocalCodexJobToolPolicy, type JobEnvelopeValidationError, type JobEnvelopeValidationResult, } from "./byoc/job-envelope.js";
73
79
  export { verifyLocalCodexGoldenPath, formatGoldenPathFailureNotice, type GoldenPathCheckCode, type GoldenPathAuditEvidence, type GoldenPathOptions, type GoldenPathResult, } from "./byoc/m6-golden-path.js";
80
+ export { AGENT_RUNTIME_ENVELOPE_SCHEMA_VERSION, AGENT_RUNTIME_ENVELOPE_SCHEMA_VERSION_V2, AGENT_RUNTIME_ENVELOPE_SCHEMA_VERSIONS, isAgentRuntimeEnvelopeSchemaVersion, resolveRuntimeEnvelopeWriterConfig, runtimeEnvelopeV2Enabled, type AgentRuntimeEnvelopeSchemaVersion, type RuntimeEnvelopeFlagSource, type RuntimeEnvelopeWriterConfig, } from "./runtime-memory-envelope.js";
81
+ export { evaluateNodeRuntimePolicy, KYNVER_NODE_PATCH_FLOOR, PUBLISHED_NODE_RANGE, PRIVATE_ROOT_NODE_RANGE, type NodeRuntimePolicyStatus, type NodeRuntimePolicyVerdict, } from "./node-runtime-policy.js";
82
+ export { buildRuntimeIdentity, type RuntimeIdentityV1 } from "./runtime-identity.js";
83
+ export { buildNodeRuntimeDoctorReport, type NodeRuntimeDoctorReport } from "./doctor/node-runtime.js";