@kynver-app/runtime 0.1.39 → 0.1.47

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 (117) hide show
  1. package/README.md +15 -0
  2. package/dist/auto-complete.d.ts +60 -0
  3. package/dist/bounded-build/admission.d.ts +30 -0
  4. package/dist/bounded-build/constants.d.ts +10 -0
  5. package/dist/bounded-build/exec.d.ts +26 -0
  6. package/dist/bounded-build/index.d.ts +6 -0
  7. package/dist/bounded-build/meminfo.d.ts +5 -0
  8. package/dist/bounded-build/node-options.d.ts +9 -0
  9. package/dist/bounded-build/systemd-wrap.d.ts +17 -0
  10. package/dist/callback-headers.d.ts +2 -0
  11. package/dist/callbacks.d.ts +38 -0
  12. package/dist/cleanup-cli.d.ts +1 -0
  13. package/dist/cleanup-dir-size.d.ts +4 -0
  14. package/dist/cleanup-execute.d.ts +4 -0
  15. package/dist/cleanup-guards.d.ts +18 -0
  16. package/dist/cleanup-scan.d.ts +14 -0
  17. package/dist/cleanup-types.d.ts +56 -0
  18. package/dist/cleanup-worktree-index.d.ts +13 -0
  19. package/dist/cleanup.d.ts +5 -0
  20. package/dist/cli.d.ts +3 -0
  21. package/dist/cli.js +1398 -199
  22. package/dist/cli.js.map +4 -4
  23. package/dist/command-center-contract-cli.d.ts +1 -0
  24. package/dist/completion-ack.d.ts +10 -0
  25. package/dist/completion-response.d.ts +15 -0
  26. package/dist/config.d.ts +61 -0
  27. package/dist/daemon.d.ts +5 -0
  28. package/dist/disk-gate.d.ts +9 -0
  29. package/dist/dispatch.d.ts +16 -0
  30. package/dist/doctor/doctor.types.d.ts +25 -0
  31. package/dist/doctor/index.d.ts +4 -0
  32. package/dist/doctor/runtime-takeover-cli.d.ts +1 -0
  33. package/dist/doctor/runtime-takeover.d.ts +3 -0
  34. package/dist/doctor/runtime-takeover.probes.d.ts +37 -0
  35. package/dist/exit-classify.d.ts +12 -0
  36. package/dist/exited-salvage.d.ts +22 -0
  37. package/dist/finalize.d.ts +16 -0
  38. package/dist/fortress-engagement-gate.d.ts +5 -0
  39. package/dist/git.d.ts +37 -0
  40. package/dist/github-repo.d.ts +5 -0
  41. package/dist/harness-verify-cli.d.ts +1 -0
  42. package/dist/harness-verify.d.ts +19 -0
  43. package/dist/heartbeat.d.ts +22 -0
  44. package/dist/index.d.ts +33 -0
  45. package/dist/index.js +1733 -202
  46. package/dist/index.js.map +4 -4
  47. package/dist/installed-package-versions.d.ts +6 -0
  48. package/dist/landing-contract-gate.d.ts +24 -0
  49. package/dist/landing-gate.d.ts +24 -0
  50. package/dist/lease-renewal.d.ts +15 -0
  51. package/dist/model-routing-task-enrich.d.ts +8 -0
  52. package/dist/model-routing.d.ts +29 -0
  53. package/dist/monitor/index.d.ts +7 -0
  54. package/dist/monitor/monitor-cli.d.ts +9 -0
  55. package/dist/monitor/monitor-loop.d.ts +1 -0
  56. package/dist/monitor/monitor-spawn.d.ts +18 -0
  57. package/dist/monitor/monitor.classify.d.ts +15 -0
  58. package/dist/monitor/monitor.service.d.ts +17 -0
  59. package/dist/monitor/monitor.store.d.ts +6 -0
  60. package/dist/monitor/monitor.task-lease.d.ts +11 -0
  61. package/dist/monitor/monitor.terminal.d.ts +11 -0
  62. package/dist/monitor/monitor.types.d.ts +74 -0
  63. package/dist/package-version.d.ts +5 -0
  64. package/dist/path-values.d.ts +5 -0
  65. package/dist/paths.d.ts +7 -0
  66. package/dist/pipeline-dispatch.d.ts +7 -0
  67. package/dist/pipeline-tick.d.ts +45 -0
  68. package/dist/plan-persist/agentos-api.d.ts +28 -0
  69. package/dist/plan-persist/body-hash.d.ts +3 -0
  70. package/dist/plan-persist/drain.d.ts +7 -0
  71. package/dist/plan-persist/errors.d.ts +9 -0
  72. package/dist/plan-persist/handoff.d.ts +7 -0
  73. package/dist/plan-persist/idempotency.d.ts +2 -0
  74. package/dist/plan-persist/index.d.ts +8 -0
  75. package/dist/plan-persist/outbox-store.d.ts +18 -0
  76. package/dist/plan-persist/paths.d.ts +8 -0
  77. package/dist/plan-persist/persist.d.ts +10 -0
  78. package/dist/plan-persist/readback.d.ts +17 -0
  79. package/dist/plan-persist/types.d.ts +91 -0
  80. package/dist/plan-persist-cli.d.ts +3 -0
  81. package/dist/plan-progress-daemon-sync.d.ts +7 -0
  82. package/dist/plan-progress-sync.d.ts +21 -0
  83. package/dist/plan-progress.d.ts +10 -0
  84. package/dist/pr-handoff/index.d.ts +4 -0
  85. package/dist/pr-handoff/pr-handoff-assess.d.ts +26 -0
  86. package/dist/pr-handoff/pr-handoff-gh.d.ts +44 -0
  87. package/dist/pr-handoff/pr-handoff.d.ts +8 -0
  88. package/dist/pr-handoff/pr-handoff.types.d.ts +45 -0
  89. package/dist/prompt.d.ts +14 -0
  90. package/dist/providers/claude.d.ts +4 -0
  91. package/dist/providers/cursor-windows.d.ts +7 -0
  92. package/dist/providers/cursor.d.ts +11 -0
  93. package/dist/providers/model-preflight.d.ts +31 -0
  94. package/dist/providers/registry.d.ts +4 -0
  95. package/dist/providers/types.d.ts +32 -0
  96. package/dist/redact.d.ts +1 -0
  97. package/dist/resource-gate.d.ts +53 -0
  98. package/dist/retry-limits.d.ts +8 -0
  99. package/dist/run-store.d.ts +30 -0
  100. package/dist/shell-command-outcome.d.ts +32 -0
  101. package/dist/stale-reconcile.d.ts +25 -0
  102. package/dist/status.d.ts +161 -0
  103. package/dist/stream.d.ts +20 -0
  104. package/dist/supervisor.d.ts +25 -0
  105. package/dist/sweep.d.ts +1 -0
  106. package/dist/util.d.ts +22 -0
  107. package/dist/validate.d.ts +5 -0
  108. package/dist/vercel/index.d.ts +3 -0
  109. package/dist/vercel/vercel-evidence.d.ts +48 -0
  110. package/dist/vercel/vercel-github-status.d.ts +19 -0
  111. package/dist/vercel/vercel-url.d.ts +16 -0
  112. package/dist/worker-env.d.ts +15 -0
  113. package/dist/worker-lifecycle.d.ts +28 -0
  114. package/dist/worker-ops.d.ts +20 -0
  115. package/dist/workspace-runtime-config.d.ts +8 -0
  116. package/dist/worktree.d.ts +4 -0
  117. package/package.json +8 -4
@@ -0,0 +1,48 @@
1
+ import { type GitHubCommitStatusRow, type GitHubStatusState, type GitHubVercelStatusContext } from "./vercel-github-status.js";
2
+ import { type ClassifiedVercelUrl } from "./vercel-url.js";
3
+ export type VercelEvidenceStatus = "ready" | "building" | "error" | "unavailable" | "not_run";
4
+ export interface VercelEvidenceResult {
5
+ status: VercelEvidenceStatus;
6
+ previewUrl: string | null;
7
+ deploymentUrl: string | null;
8
+ summary: string | null;
9
+ observedAt: string | null;
10
+ /** True when `vercel inspect` was not run (dashboard URL or trusted GitHub state). */
11
+ inspectSkipped: boolean;
12
+ inspectReason: string | null;
13
+ githubState: GitHubStatusState | null;
14
+ vercelContext: string | null;
15
+ }
16
+ export interface VercelInspectCommandResult {
17
+ ok: boolean;
18
+ exitCode: number | null;
19
+ stdout: string;
20
+ stderr: string;
21
+ error: string | null;
22
+ }
23
+ export type RunVercelInspect = (target: string, waitSeconds: number) => VercelInspectCommandResult;
24
+ /**
25
+ * Resolve the CLI inspect target. Never returns a vercel.com dashboard page URL.
26
+ */
27
+ export declare function resolveVercelInspectTarget(rawUrl: string | null | undefined): {
28
+ target: string | null;
29
+ classified: ClassifiedVercelUrl | null;
30
+ reason: string | null;
31
+ };
32
+ export declare function evidenceFromGitHubVercelStatus(statuses: GitHubCommitStatusRow[] | null | undefined, options?: {
33
+ observedAt?: string;
34
+ }): VercelEvidenceResult;
35
+ export interface CollectVercelEvidenceInput {
36
+ statuses?: GitHubCommitStatusRow[] | null;
37
+ /** When false, never shell out to the Vercel CLI (GitHub status only). */
38
+ allowInspect?: boolean;
39
+ waitSeconds?: number;
40
+ runInspect?: RunVercelInspect;
41
+ observedAt?: string;
42
+ }
43
+ /**
44
+ * Prefer GitHub Vercel StatusContext.state for gates. Run `vercel inspect` only when
45
+ * inspectable (deployment host or id) and GitHub state is not already terminal success.
46
+ */
47
+ export declare function collectVercelEvidence(input: CollectVercelEvidenceInput): VercelEvidenceResult;
48
+ export type { GitHubVercelStatusContext };
@@ -0,0 +1,19 @@
1
+ export type GitHubStatusState = "success" | "pending" | "failure" | "error" | "unknown";
2
+ export interface GitHubCommitStatusRow {
3
+ context?: string | null;
4
+ state?: string | null;
5
+ target_url?: string | null;
6
+ description?: string | null;
7
+ }
8
+ export interface GitHubVercelStatusContext {
9
+ context: string;
10
+ state: GitHubStatusState;
11
+ targetUrl: string | null;
12
+ description: string | null;
13
+ deploymentId: string | null;
14
+ previewUrl: string | null;
15
+ dashboardUrl: string | null;
16
+ }
17
+ export declare function normalizeGitHubStatusState(state: unknown): GitHubStatusState;
18
+ export declare function isVercelStatusContext(context: unknown): boolean;
19
+ export declare function pickVercelStatusContext(statuses: GitHubCommitStatusRow[] | null | undefined): GitHubVercelStatusContext | null;
@@ -0,0 +1,16 @@
1
+ export type VercelUrlKind = "deployment_host" | "dashboard" | "deployment_id" | "unknown";
2
+ export interface ClassifiedVercelUrl {
3
+ kind: VercelUrlKind;
4
+ /** Original URL when it is a usable preview/deployment host. */
5
+ previewUrl: string | null;
6
+ /** Argument suitable for `vercel inspect` (id or host URL), never a dashboard page URL. */
7
+ inspectTarget: string | null;
8
+ /** Deployment id extracted from dashboard paths when present. */
9
+ deploymentId: string | null;
10
+ }
11
+ /**
12
+ * Classify a Vercel-related URL from GitHub commit status target_url.
13
+ * `vercel inspect` accepts deployment ids and `*.vercel.app` hosts — not vercel.com dashboard links.
14
+ */
15
+ export declare function classifyVercelUrl(raw: string): ClassifiedVercelUrl;
16
+ export declare function isDashboardVercelUrl(raw: string): boolean;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Worker spawn env scrub — harness workers must not inherit host deployment secrets.
3
+ */
4
+ /** Exact env keys that must never reach a worker child process. */
5
+ export declare const FORBIDDEN_WORKER_ENV_KEYS: readonly ["ANTHROPIC_API_KEY", "ANALYST_API_KEY", "RECRUITER_API_KEY", "AUTH_SECRET", "NEXTAUTH_SECRET", "DATABASE_URL", "PRODUCTION_DATABASE_URL", "REDIS_URL", "GOOGLE_CLIENT_SECRET", "GITHUB_CLIENT_SECRET", "KYNVER_API_KEY", "KYNVER_SERVICE_SECRET", "KYNVER_RUNTIME_SECRET", "OPENCLAW_CRON_SECRET", "QSTASH_TOKEN", "QSTASH_CURRENT_SIGNING_KEY", "QSTASH_NEXT_SIGNING_KEY", "TOOL_SECRETS_KEK", "TOOL_EXECUTOR_DISPATCH_SECRET", "CLOUDFLARE_API_TOKEN", "STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "STRIPE_IDENTITY_WEBHOOK_SECRET", "VOYAGE_API_KEY", "PERPLEXITY_API_KEY", "FRED_API_KEY", "FMP_API_KEY", "CURSOR_API_KEY"];
6
+ export declare function isForbiddenWorkerEnvKey(key: string): boolean;
7
+ export declare function listForbiddenWorkerEnvKeys(env: NodeJS.ProcessEnv): string[];
8
+ export declare function scrubWorkerEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
9
+ export interface WorkerEnvAudit {
10
+ forbiddenPresent: string[];
11
+ safe: boolean;
12
+ }
13
+ export declare function auditWorkerEnv(env: NodeJS.ProcessEnv): WorkerEnvAudit;
14
+ /** @deprecated Use {@link scrubWorkerEnv} — kept for existing imports from git.ts */
15
+ export declare function scrubClaudeEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
@@ -0,0 +1,28 @@
1
+ import type { HarnessWorkerRecord, RawHarnessWorkerStatus } from "./status.js";
2
+ export interface CompletionSnapshot {
3
+ finalResult?: unknown;
4
+ prUrl?: string | null;
5
+ summary?: string | null;
6
+ }
7
+ export declare function isCompletionAcknowledged(worker: HarnessWorkerRecord): boolean;
8
+ export declare function completionSnapshotFromStatus(status: RawHarnessWorkerStatus): CompletionSnapshot;
9
+ /**
10
+ * Persist local terminal lifecycle after AgentOS acknowledges harness completion.
11
+ * Prevents a later PID reuse or still-running wrapper from re-reporting the worker
12
+ * as `running` once the board task has advanced.
13
+ */
14
+ export declare function persistCompletionAcknowledged(worker: HarnessWorkerRecord, status: RawHarnessWorkerStatus, opts?: {
15
+ source?: string;
16
+ }): void;
17
+ /**
18
+ * When the board task has left `running` but the local worker still looks live
19
+ * (common after server-side completion reconcile), mirror the terminal lifecycle
20
+ * on disk so harness status matches AgentOS.
21
+ */
22
+ export declare function syncCompletionAcknowledgedFromOperatorTick(runId: string, operatorTick: unknown): Array<{
23
+ worker: string;
24
+ taskId: string;
25
+ taskStatus: string;
26
+ }>;
27
+ /** Reload helper for callers that already hold a worker name. */
28
+ export declare function acknowledgeWorkerIfBoardTaskAdvanced(runId: string, workerName: string, operatorTick: unknown): boolean;
@@ -0,0 +1,20 @@
1
+ export declare function tryCompleteWorker(args: Record<string, string | boolean>): Promise<{
2
+ ok: boolean;
3
+ skipped?: boolean;
4
+ reason?: string;
5
+ nextAction?: string;
6
+ httpStatus?: number;
7
+ response?: unknown;
8
+ completionBlocked?: boolean;
9
+ prHandoff?: {
10
+ prUrl?: string;
11
+ created?: boolean;
12
+ };
13
+ }>;
14
+ export declare function completeWorker(args: Record<string, string | boolean>): Promise<void>;
15
+ export declare function workerStatus(args: Record<string, string | boolean>): void;
16
+ export declare function buildRunBoard(runId: string): Record<string, unknown>;
17
+ export declare function publishHarnessBoardSnapshot(args: Record<string, string | boolean>, source: string): Promise<Record<string, unknown> | null>;
18
+ export declare function runStatus(args: Record<string, string | boolean>): void;
19
+ export declare function tailWorker(args: Record<string, string | boolean>): void;
20
+ export declare function stopWorker(args: Record<string, string | boolean>): void;
@@ -0,0 +1,8 @@
1
+ export interface WorkspaceRuntimePreferences {
2
+ maxConcurrentWorkers: number | null;
3
+ }
4
+ /**
5
+ * Pull the Command Center worker cap each pipeline tick so the daemon honors
6
+ * workspace settings without restarting or editing ~/.kynver/config.json.
7
+ */
8
+ export declare function fetchWorkspaceRuntimePreferences(agentOsId: string, args: Record<string, string | boolean>): Promise<WorkspaceRuntimePreferences | null>;
@@ -0,0 +1,4 @@
1
+ import { loadRun, runDirectory, saveRun } from "./run-store.js";
2
+ export declare function createRun(args: Record<string, string | boolean>): void;
3
+ export declare function listRuns(): void;
4
+ export { loadRun, saveRun, runDirectory };
package/package.json CHANGED
@@ -1,26 +1,30 @@
1
1
  {
2
2
  "name": "@kynver-app/runtime",
3
- "version": "0.1.39",
3
+ "version": "0.1.47",
4
4
  "description": "Kynver AgentOS local execution runtime and CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
7
8
  "bin": {
8
9
  "kynver": "./dist/cli.js"
9
10
  },
10
11
  "exports": {
11
12
  ".": {
13
+ "types": "./dist/index.d.ts",
12
14
  "import": "./dist/index.js",
13
15
  "default": "./dist/index.js"
14
- }
16
+ },
17
+ "./package.json": "./package.json"
15
18
  },
16
19
  "files": [
17
20
  "dist/**",
18
21
  "README.md"
19
22
  ],
20
23
  "scripts": {
21
- "build": "esbuild src/cli.ts src/index.ts --bundle --platform=node --format=esm --packages=external --outdir=dist --sourcemap",
24
+ "build": "esbuild src/cli.ts src/index.ts --bundle --platform=node --format=esm --packages=external --outdir=dist --sourcemap && tsc -p tsconfig.json --emitDeclarationOnly && node scripts/chmod-cli-bin.mjs",
22
25
  "typecheck": "tsc -p tsconfig.json --noEmit",
23
- "test": "vitest run --config vitest.config.ts"
26
+ "test": "vitest run --config vitest.config.ts",
27
+ "prepublishOnly": "node ../../scripts/npm-publish-guard.mjs"
24
28
  },
25
29
  "engines": {
26
30
  "node": ">=18"