@kynver-app/runtime 0.2.23 → 0.2.24
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/README.md +52 -18
- package/dist/bootstrap.d.ts +48 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +73 -65
- package/dist/daemon-keeper.d.ts +32 -0
- package/dist/doctor/runner-install.d.ts +86 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +95 -87
- package/dist/orchestration-providers/inventory.d.ts +27 -4
- package/dist/providers/model-preflight.d.ts +8 -0
- package/dist/providers/openai-compatible-response.d.ts +23 -0
- package/dist/providers/openai-compatible-runner.d.ts +1 -0
- package/dist/providers/openai-compatible.d.ts +46 -0
- package/dist/server/cleanup.js +14 -14
- package/dist/server/default-repo.js +1 -1
- package/dist/server/model-routing.js +4 -4
- package/dist/server/monitor.js +7 -7
- package/dist/server/orchestration.d.ts +1 -1
- package/dist/server/orchestration.js +1 -1
- package/dist/server/worker-policy.d.ts +1 -1
- package/dist/server/worker-policy.js +2 -2
- package/dist/status.d.ts +3 -1
- package/dist/stream.d.ts +13 -0
- package/dist/worker-provider-policy.d.ts +21 -4
- package/dist/worker-usage.d.ts +20 -0
- package/dist/worktree.d.ts +33 -0
- package/package.json +3 -2
package/dist/daemon-keeper.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A child that dies nonzero this fast with a config-shaped error message will
|
|
3
|
+
* die identically on every respawn — a bad `~/.kynver/config.json` must not
|
|
4
|
+
* become an infinite keeper crash loop (respawn → same error → backoff → …).
|
|
5
|
+
*/
|
|
6
|
+
export declare const KEEPER_PERMANENT_FAILURE_WINDOW_MS = 10000;
|
|
7
|
+
export interface KeeperChildFailureVerdict {
|
|
8
|
+
permanent: boolean;
|
|
9
|
+
/** First stderr line that matched a permanent pattern (for the operator). */
|
|
10
|
+
matchedLine?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decide whether a child exit is a permanent configuration failure (stop
|
|
14
|
+
* respawning) or transient (keep exponential backoff). Permanent requires ALL
|
|
15
|
+
* of: a nonzero exit code (signals are transient — OOM killer etc.), death
|
|
16
|
+
* inside the startup grace window, and stderr matching a known config-error
|
|
17
|
+
* class. Anything else keeps the resilient default: respawn with backoff.
|
|
18
|
+
*/
|
|
19
|
+
export declare function classifyKeeperChildFailure(input: {
|
|
20
|
+
exitCode: number | null;
|
|
21
|
+
exitSignal: NodeJS.Signals | null;
|
|
22
|
+
uptimeMs: number;
|
|
23
|
+
stderrTail: string;
|
|
24
|
+
}): KeeperChildFailureVerdict;
|
|
25
|
+
/**
|
|
26
|
+
* Remediation-formatted error for a missing daemon/keeper argument (modeled
|
|
27
|
+
* on `formatAgentOsIdValidationError`): what is missing, where it normally
|
|
28
|
+
* comes from (`~/.kynver/config.json`), and the command that sets it up. The
|
|
29
|
+
* leading `missing --…` token is load-bearing — the keeper's permanent
|
|
30
|
+
* config-error classifier and legacy log greps both key on it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatMissingDaemonArgError(flag: "--run" | "--agent-os-id"): string;
|
|
1
33
|
export declare function resolveKeeperStallMs(flag: string | boolean | undefined, env?: NodeJS.ProcessEnv): number;
|
|
2
34
|
/**
|
|
3
35
|
* Supervision is the DEFAULT for `kynver daemon`. Opt out only when an
|
|
@@ -1,2 +1,86 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type KynverUserConfig } from "../config.js";
|
|
2
|
+
import type { DoctorCheck, DoctorSection, RunnerInstallDoctorReport } from "./doctor.types.js";
|
|
3
|
+
/** Repo base-ref probe result: can a new run be cut from this checkout? */
|
|
4
|
+
export interface RepoBaseRefProbe {
|
|
5
|
+
originMainOk: boolean;
|
|
6
|
+
/** Remote default branch (e.g. `origin/master`) when origin/main is absent. */
|
|
7
|
+
remoteHead: string | null;
|
|
8
|
+
remoteHeadOk: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Probe `origin/main` (what runs are cut from) with the remote-HEAD fallback. */
|
|
11
|
+
export declare function probeRepoBaseRef(repo: string): RepoBaseRefProbe;
|
|
12
|
+
/** Pure builder so tests can pin all three verdicts without a git fixture. */
|
|
13
|
+
export declare function buildRepoBaseRefCheck(repo: string, probe: RepoBaseRefProbe): DoctorCheck;
|
|
14
|
+
/** What the configured worker provider needs on PATH, plus probe results. */
|
|
15
|
+
export interface ProviderCliProbe {
|
|
16
|
+
provider: string;
|
|
17
|
+
/** Acceptable binaries (any one satisfies), in preference order. */
|
|
18
|
+
binaries: string[];
|
|
19
|
+
foundBinary: string | null;
|
|
20
|
+
/** Best-effort `<bin> --version` health probe (warn-only). */
|
|
21
|
+
versionProbe: {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
detail: string;
|
|
24
|
+
} | null;
|
|
25
|
+
knownProvider: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Probe the configured worker provider's CLI on PATH (+ cheap health check). */
|
|
28
|
+
export declare function probeProviderCli(config?: KynverUserConfig): ProviderCliProbe;
|
|
29
|
+
/** Pure builder so tests can pin verdicts without spawning real provider CLIs. */
|
|
30
|
+
export declare function buildProviderCliSection(probe: ProviderCliProbe): DoctorSection;
|
|
31
|
+
export interface ApiLivenessProbe {
|
|
32
|
+
baseUrl: string | null;
|
|
33
|
+
version: {
|
|
34
|
+
kind: "ok";
|
|
35
|
+
status: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "http_error";
|
|
38
|
+
status: number;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "network";
|
|
41
|
+
detail: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "skipped";
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
46
|
+
credential: {
|
|
47
|
+
kind: "ok";
|
|
48
|
+
} | {
|
|
49
|
+
kind: "unauthorized";
|
|
50
|
+
} | {
|
|
51
|
+
kind: "forbidden";
|
|
52
|
+
} | {
|
|
53
|
+
kind: "http_error";
|
|
54
|
+
status: number;
|
|
55
|
+
} | {
|
|
56
|
+
kind: "network";
|
|
57
|
+
detail: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "skipped";
|
|
60
|
+
reason: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare const API_LIVENESS_TIMEOUT_MS = 5000;
|
|
64
|
+
/**
|
|
65
|
+
* Live probes: `GET /api/version` (is the URL a reachable Kynver at all?) and
|
|
66
|
+
* a credentialed `GET …/runner-credentials` (does this account/key still have
|
|
67
|
+
* access?). 401 vs 403 get distinct verdicts — revoked key vs gated access.
|
|
68
|
+
*/
|
|
69
|
+
export declare function probeApiLiveness(opts: {
|
|
70
|
+
baseUrl?: string;
|
|
71
|
+
agentOsId?: string;
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
fetchImpl?: typeof fetch;
|
|
74
|
+
timeoutMs?: number;
|
|
75
|
+
}): Promise<ApiLivenessProbe>;
|
|
76
|
+
/** Pure builder so tests can pin the 401/403/network verdicts without a server. */
|
|
77
|
+
export declare function buildApiLivenessSection(probe: ApiLivenessProbe): DoctorSection;
|
|
78
|
+
export declare function assessRunnerInstallReadiness(extraSections?: DoctorSection[]): RunnerInstallDoctorReport;
|
|
79
|
+
/**
|
|
80
|
+
* Full readiness report including the live API probes (`/api/version` + the
|
|
81
|
+
* credentialed runner-credential route). This is what `kynver doctor
|
|
82
|
+
* runner-install` runs; the sync `assessRunnerInstallReadiness` remains for
|
|
83
|
+
* offline/embedded callers.
|
|
84
|
+
*/
|
|
85
|
+
export declare function assessRunnerInstallReadinessAsync(): Promise<RunnerInstallDoctorReport>;
|
|
86
|
+
export declare function runRunnerInstallDoctorCliAsync(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -25,14 +25,17 @@ export { MEMORY_LANE_PREVIEW_CHARS, buildChatMemoryShadowPreview, buildLegacyCha
|
|
|
25
25
|
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";
|
|
26
26
|
export { WORKER_PERSONA_CATALOG, getWorkerPersonaCatalogEntry, getPersonaDispatchLane, getPersonaDefaultRoleLane, isKnownWorkerPersonaSlug, workerPersonaReviewSlugs, workerPersonaLandingSlugs, type WorkerPersonaCatalogEntry, type WorkerPersonaCatalogSlug, type WorkerPersonaDispatchLane, type WorkerPersonaDefaultRoleLane, } from "./worker-persona-catalog.js";
|
|
27
27
|
export { assessPrHandoffRequirement, ensurePrReadyHandoff, extractPrUrlFromText, } from "./pr-handoff/index.js";
|
|
28
|
-
export { normalizeCursorModelAlias, preflightClaudeModel, preflightCodexModel, preflightCursorModel, } from "./providers/model-preflight.js";
|
|
28
|
+
export { normalizeCursorModelAlias, preflightClaudeModel, preflightCodexModel, preflightCursorModel, preflightOpenAiCompatibleModel, } from "./providers/model-preflight.js";
|
|
29
29
|
export { CODEX_DEFAULT_MODEL, codexProvider, buildCodexExecArgv } from "./providers/codex.js";
|
|
30
|
+
export { OPENAI_COMPATIBLE_PROVIDER, OPENAI_COMPATIBLE_SYSTEM_PROMPT, OpenAiCompatibleConfigError, buildOpenAiCompatibleChatRequest, buildOpenAiCompatibleRunnerConfig, openAiCompatibleProvider, resolveOpenAiCompatibleDefaultModel, resolveOpenAiCompatibleEndpoint, type OpenAiCompatibleChatRequest, type OpenAiCompatibleEndpoint, type OpenAiCompatibleRunnerConfig, } from "./providers/openai-compatible.js";
|
|
31
|
+
export { extractOpenAiCompatibleCompletion, type OpenAiCompatibleCompletion, type OpenAiCompatibleUsage, } from "./providers/openai-compatible-response.js";
|
|
32
|
+
export { resolveWorkerUsagePayload, type ResolveWorkerUsageInput, type WorkerUsagePayload, } from "./worker-usage.js";
|
|
30
33
|
export { HERMES_OPENAI_CODEX_DEFAULT_MODEL, hermesCodexProvider, buildHermesOpenAiCodexChatArgv, } from "./providers/hermes-codex.js";
|
|
31
34
|
export { classifyOpenAiCodexError, formatCronJobDeliveryFailure, formatOpenAiCodexFailureNotice, redactProviderErrorText, resolveOpenAiCodexRetryBudget, TRANSIENT_OPENAI_CODEX_ERROR_CLASSES, OPENAI_CODEX_PROVIDER, type ClassifiedOpenAiCodexError, type CodexFailureNoticeInput, type OpenAiCodexErrorClass, } from "./providers/openai-codex-resilience.js";
|
|
32
35
|
export * from "./cron/hermes-provider-notice.js";
|
|
33
36
|
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";
|
|
34
37
|
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";
|
|
35
|
-
export { DEFAULT_WORKER_PROVIDER, enforceCursorWorkerProvider, isClaudeFamilyProvider, preferCursorExecutor, resolveConfiguredWorkerProvider, taskAllowsClaudeWorker, type EnforceCursorWorkerProviderInput, } from "./worker-provider-policy.js";
|
|
38
|
+
export { DEFAULT_WORKER_PROVIDER, enforceCursorWorkerProvider, isClaudeFamilyProvider, normalizeWorkerProviderName, preferCursorExecutor, resolveConfiguredWorkerProvider, taskAllowsClaudeWorker, taskExpressesWorkerProviderPreference, type EnforceCursorWorkerProviderInput, } from "./worker-provider-policy.js";
|
|
36
39
|
export { parseExecutorRefRoutingIntent, executorRefRequestsNonCursorWorker, type ExecutorRefRoutingIntent, } from "./executor-ref-routing.js";
|
|
37
40
|
export { assessDispatchModelGuard, type DispatchModelGuardInput, type DispatchModelGuardResult, } from "./dispatch-model-guard.js";
|
|
38
41
|
export { GLOBAL_DEFAULT_MODEL, CURSOR_DEFAULT_MODEL, inferModelRoutingFromTask, resolveGlobalDefaultModel, resolveModelFallback, resolveWorkerLaunch, type ModelRoutingDecision, } from "./model-routing.js";
|