refactor: update all consumers to import from @uncaged/workflow
- workflow-utils, workflow-meta: import workflow types from @uncaged/workflow - adapter-cursor, adapter-hermes: same - cli: same - core: remove workflow re-exports, no longer depends on @uncaged/workflow Phase 5+6 of #320, Testing: #323
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*"
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rslib/core": "^0.21.3",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { AgentConfig, AgentFn, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { AgentConfig } from "@uncaged/nerve-core";
|
||||
import { type Result, type SpawnEnv, type SpawnError, ok, spawnSafe } from "@uncaged/nerve-core";
|
||||
import type { AgentFn, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
export type CursorAgentMode = "plan" | "ask" | "default";
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*"
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rslib/core": "^0.21.3",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { AgentConfig, AgentFn, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { AgentConfig } from "@uncaged/nerve-core";
|
||||
import { type Result, type SpawnEnv, type SpawnError, ok, spawnSafe } from "@uncaged/nerve-core";
|
||||
import type { AgentFn, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
/**
|
||||
* Spawns a non-interactive `hermes chat` invocation with YOLO enabled, argv-only
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/nerve-store": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"citty": "^0.1.6",
|
||||
"picomatch": "^4.0.2",
|
||||
"yaml": "^2.8.3"
|
||||
@@ -31,7 +32,6 @@
|
||||
"@rslib/core": "^0.21.3",
|
||||
"@types/node": "^22.0.0",
|
||||
"@uncaged/nerve-daemon": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"vitest": "^4.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ describe("buildWorkflowScaffold", () => {
|
||||
expect(roleMainIndexTs).toContain("my-workflow started");
|
||||
});
|
||||
|
||||
it("root index contains WorkflowDefinition import from nerve-core", () => {
|
||||
it("root index contains WorkflowDefinition import from @uncaged/workflow", () => {
|
||||
const { indexTs } = buildWorkflowScaffold("test");
|
||||
expect(indexTs).toContain("WorkflowDefinition");
|
||||
expect(indexTs).toContain("@uncaged/nerve-core");
|
||||
expect(indexTs).toContain("@uncaged/workflow");
|
||||
});
|
||||
|
||||
it("root index wires moderator with ThreadContext and END", () => {
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
* E2E-style tests for `nerve create workflow` and `nerve create sense`.
|
||||
*/
|
||||
|
||||
import { execFile } from "node:child_process";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { dirname, join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
import { defineCommand, runCommand } from "citty";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
@@ -12,6 +15,23 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { createCommand } from "../commands/create.js";
|
||||
import { initCommand } from "../commands/init.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const requireFromHere = createRequire(import.meta.url);
|
||||
|
||||
/**
|
||||
* Default init pins `@uncaged/workflow` to npm `latest`, but that package is not published yet.
|
||||
* Install from the monorepo workspace so `pnpm run build` can resolve workflow types.
|
||||
*/
|
||||
async function installWorkspaceWithLocalWorkflow(nerveRoot: string): Promise<void> {
|
||||
const pkgPath = join(nerveRoot, "package.json");
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as { dependencies: Record<string, string> };
|
||||
const wfRoot = dirname(requireFromHere.resolve("@uncaged/workflow/package.json"));
|
||||
pkg.dependencies["@uncaged/workflow"] = `file:${wfRoot}`;
|
||||
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
||||
await execFileAsync("pnpm", ["install", "--no-frozen-lockfile"], { cwd: nerveRoot });
|
||||
await execFileAsync("pnpm", ["run", "build"], { cwd: nerveRoot });
|
||||
}
|
||||
|
||||
const testRootCommand = defineCommand({
|
||||
meta: { name: "nerve", description: "e2e-create" },
|
||||
subCommands: {
|
||||
@@ -128,7 +148,8 @@ describe("e2e create", () => {
|
||||
fakeHome = mkdtempSync(join(tmpdir(), "nerve-create-e2e-"));
|
||||
const nerveRoot = join(fakeHome, ".uncaged-nerve");
|
||||
|
||||
await runTestCli(fakeHome, ["init", "--force"]);
|
||||
await runTestCli(fakeHome, ["init", "--force", "--skip-install"]);
|
||||
await installWorkspaceWithLocalWorkflow(nerveRoot);
|
||||
|
||||
const wf = await runTestCli(fakeHome, ["create", "workflow", "e2e-flow"]);
|
||||
expect(wf.exitCode).toBe(0);
|
||||
@@ -153,7 +174,8 @@ describe("e2e create", () => {
|
||||
fakeHome = mkdtempSync(join(tmpdir(), "nerve-create-e2e-"));
|
||||
const nerveRoot = join(fakeHome, ".uncaged-nerve");
|
||||
|
||||
await runTestCli(fakeHome, ["init", "--force"]);
|
||||
await runTestCli(fakeHome, ["init", "--force", "--skip-install"]);
|
||||
await installWorkspaceWithLocalWorkflow(nerveRoot);
|
||||
|
||||
const sense = await runTestCli(fakeHome, ["create", "sense", "e2e-sense"]);
|
||||
expect(sense.exitCode).toBe(0);
|
||||
|
||||
@@ -31,8 +31,8 @@ export function buildWorkflowScaffold(name: string): WorkflowScaffoldFiles {
|
||||
}
|
||||
|
||||
function buildWorkflowIndexTs(name: string): string {
|
||||
return `import type { ThreadContext, WorkflowDefinition } from "@uncaged/nerve-core";
|
||||
import { END } from "@uncaged/nerve-core";
|
||||
return `import type { ThreadContext, WorkflowDefinition } from "@uncaged/workflow";
|
||||
import { END } from "@uncaged/workflow";
|
||||
|
||||
import { mainRole } from "./roles/main/index.js";
|
||||
|
||||
@@ -56,7 +56,7 @@ export default workflow;
|
||||
}
|
||||
|
||||
function buildWorkflowMainRoleIndexTs(name: string): string {
|
||||
return `import type { RoleResult, ThreadContext } from "@uncaged/nerve-core";
|
||||
return `import type { RoleResult, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
/**
|
||||
* Main role — implement LLM calls, scripts, HTTP, etc.
|
||||
|
||||
@@ -54,6 +54,7 @@ const PACKAGE_JSON = `${JSON.stringify(
|
||||
dependencies: {
|
||||
"@uncaged/nerve-core": "latest",
|
||||
"@uncaged/nerve-daemon": "latest",
|
||||
"@uncaged/workflow": "latest",
|
||||
zod: "^4.3.6",
|
||||
},
|
||||
devDependencies: {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { DEFAULT_ENGINE_MAX_ROUNDS, isPlainRecord, parseNerveConfig } from "@uncaged/nerve-core";
|
||||
import { isPlainRecord, parseNerveConfig } from "@uncaged/nerve-core";
|
||||
import { DEFAULT_ENGINE_MAX_ROUNDS } from "@uncaged/workflow";
|
||||
import { defineCommand } from "citty";
|
||||
import { stringify } from "yaml";
|
||||
|
||||
|
||||
@@ -20,12 +20,8 @@ import type {
|
||||
SenseInfo,
|
||||
WorkflowStatus,
|
||||
} from "@uncaged/nerve-core";
|
||||
import {
|
||||
DEFAULT_ENGINE_MAX_ROUNDS,
|
||||
isPlainRecord,
|
||||
isSenseInfo,
|
||||
isWorkflowStatus,
|
||||
} from "@uncaged/nerve-core";
|
||||
import { isPlainRecord, isSenseInfo, isWorkflowStatus } from "@uncaged/nerve-core";
|
||||
import { DEFAULT_ENGINE_MAX_ROUNDS } from "@uncaged/workflow";
|
||||
|
||||
import { getCliDaemonApiToken, getCliDaemonHost } from "./cli-global.js";
|
||||
import { HttpTransport } from "./http-transport.js";
|
||||
|
||||
@@ -6,12 +6,8 @@ import type {
|
||||
SenseInfo,
|
||||
WorkflowStatus,
|
||||
} from "@uncaged/nerve-core";
|
||||
import {
|
||||
DEFAULT_ENGINE_MAX_ROUNDS,
|
||||
isPlainRecord,
|
||||
isSenseInfo,
|
||||
isWorkflowStatus,
|
||||
} from "@uncaged/nerve-core";
|
||||
import { isPlainRecord, isSenseInfo, isWorkflowStatus } from "@uncaged/nerve-core";
|
||||
import { DEFAULT_ENGINE_MAX_ROUNDS } from "@uncaged/workflow";
|
||||
|
||||
function normalizeBaseUrl(host: string): string {
|
||||
const t = host.trim();
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"yaml": "^2.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Extract layer types — parses agent raw string output into typed meta (RFC-003).
|
||||
*/
|
||||
/** Structured meta validation descriptor for `ExtractFn`; concrete validators are provider-defined. */
|
||||
export type Schema<T> = {
|
||||
readonly witness: T | null;
|
||||
};
|
||||
export type ExtractFn<T> = (raw: string, schema: Schema<T>) => Promise<T>;
|
||||
export declare class ExtractError extends Error {
|
||||
readonly raw: string;
|
||||
readonly causeError: Error | null;
|
||||
constructor(message: string, detail: {
|
||||
raw: string;
|
||||
causeError: Error | null;
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=agent.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uGAAuG;AACvG,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1E,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE;CAO/E"}
|
||||
Vendored
-63
@@ -1,63 +0,0 @@
|
||||
import { type DropOverflowConfig, type QueueOverflowConfig, type WorkflowConfig } from "@uncaged/workflow";
|
||||
import { type Result } from "./util.js";
|
||||
export type { DropOverflowConfig, QueueOverflowConfig, WorkflowConfig };
|
||||
export type SenseConfig = {
|
||||
group: string;
|
||||
throttle: number | null;
|
||||
timeout: number | null;
|
||||
gracePeriod: number | null;
|
||||
/** Polling interval (ms). When set, the sense is triggered periodically. */
|
||||
interval: number | null;
|
||||
/** Other sense names whose successful computes schedule this sense (kernel reverse-index). */
|
||||
on: string[];
|
||||
};
|
||||
/** Optional HTTP control plane. When `port` is null, the HTTP server is not started. */
|
||||
export type NerveApiConfig = {
|
||||
port: number | null;
|
||||
/** When set, HTTP API requires `Authorization: Bearer <token>`. */
|
||||
token: string | null;
|
||||
/** Bind address (e.g. `127.0.0.1`, `0.0.0.0`). Meaningful when `port` is set. */
|
||||
host: string;
|
||||
};
|
||||
/** Adapter factory input (model, timeout); used by adapter packages (RFC-003). */
|
||||
export type AgentConfig = {
|
||||
/** Adapter id (e.g. `cursor`, `hermes`, `echo`) — informational for factories that branch on type. */
|
||||
type: string;
|
||||
/** Model id or `"auto"` for adapter defaults. */
|
||||
model: string;
|
||||
/** Wall-clock cap in milliseconds, or `null` for adapter-specific default. */
|
||||
timeout: number | null;
|
||||
};
|
||||
/** Global extract provider for typed meta from agent raw output (RFC-003). */
|
||||
export type ExtractConfig = {
|
||||
provider: string;
|
||||
model: string;
|
||||
};
|
||||
/**
|
||||
* Optional shell side effect after a successful sense `compute()`.
|
||||
* Executed in the sense worker (`spawn` with `shell: true`, cwd = nerve root).
|
||||
* Workflows are started only via CLI / daemon IPC, not from sense compute results.
|
||||
*/
|
||||
export type SenseTrigger = {
|
||||
command: string;
|
||||
};
|
||||
export type NerveConfig = {
|
||||
/** Engine-wide default max moderator rounds (e.g. CLI workflow trigger when omitted). */
|
||||
maxRounds: number;
|
||||
senses: Record<string, SenseConfig>;
|
||||
workflows: Record<string, WorkflowConfig>;
|
||||
api: NerveApiConfig;
|
||||
/** Global extract defaults; `null` when the section is omitted. */
|
||||
extract: ExtractConfig | null;
|
||||
};
|
||||
export type KnowledgeConfig = {
|
||||
include: ReadonlyArray<string>;
|
||||
exclude: ReadonlyArray<string>;
|
||||
};
|
||||
export declare function parseNerveConfig(raw: string): Result<NerveConfig>;
|
||||
/**
|
||||
* Parse `knowledge.yaml` at the repo root (RFC-003 Knowledge Layer).
|
||||
* `include` / `exclude` entries are glob patterns resolved against the repo root.
|
||||
*/
|
||||
export declare function parseKnowledgeYaml(raw: string): Result<KnowledgeConfig>;
|
||||
//# sourceMappingURL=config.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KA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AAc,CAAC;IACpB,mEAAmE;IACnE,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAuQF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAwDjE;AAoBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,CA8BvE"}
|
||||
@@ -1,14 +1,26 @@
|
||||
import { parse } from "yaml";
|
||||
|
||||
import {
|
||||
DEFAULT_ENGINE_MAX_ROUNDS,
|
||||
type DropOverflowConfig,
|
||||
type QueueOverflowConfig,
|
||||
type WorkflowConfig,
|
||||
} from "@uncaged/workflow/public-types";
|
||||
import { type Result, err, isPlainRecord, ok, parseDurationStringToMs } from "./util.js";
|
||||
|
||||
export type { DropOverflowConfig, QueueOverflowConfig, WorkflowConfig };
|
||||
/**
|
||||
* Workflow queue/runtime limits parsed from nerve.yaml.
|
||||
* Shapes match the standalone workflow package — core must not depend on it (#320).
|
||||
*/
|
||||
export type DropOverflowConfig = {
|
||||
concurrency: number;
|
||||
overflow: "drop";
|
||||
};
|
||||
|
||||
export type QueueOverflowConfig = {
|
||||
concurrency: number;
|
||||
overflow: "queue";
|
||||
maxQueue: number;
|
||||
};
|
||||
|
||||
export type WorkflowConfig = DropOverflowConfig | QueueOverflowConfig;
|
||||
|
||||
/** Engine-wide fallback when nerve.yaml omits max_rounds (keep in sync with workflow package default). */
|
||||
export const DEFAULT_ENGINE_MAX_ROUNDS = 100;
|
||||
|
||||
export type SenseConfig = {
|
||||
group: string;
|
||||
|
||||
Vendored
-120
@@ -1,120 +0,0 @@
|
||||
/**
|
||||
* Daemon Unix-socket IPC protocol (CLI → daemon).
|
||||
* Newline-delimited JSON: one request object per line from the client,
|
||||
* one response object per line from the daemon.
|
||||
*/
|
||||
import type { SenseInfo } from "./sense.js";
|
||||
/** Runtime status of a registered workflow (for listing / observability). */
|
||||
export type WorkflowStatus = {
|
||||
name: string;
|
||||
activeThreads: number;
|
||||
/** Run IDs currently executing (same identifiers accepted by kill-workflow). */
|
||||
activeRunIds: string[];
|
||||
queuedThreads: number;
|
||||
config: {
|
||||
concurrency: number;
|
||||
overflow: string;
|
||||
};
|
||||
};
|
||||
/** Public health payload for HTTP / IPC. */
|
||||
export type HealthInfo = {
|
||||
ok: boolean;
|
||||
version: string;
|
||||
uptime: number;
|
||||
startedAt: string;
|
||||
hostname: string;
|
||||
};
|
||||
/** Client → daemon: start a workflow run. */
|
||||
export type DaemonIpcTriggerWorkflowRequest = {
|
||||
type: "trigger-workflow";
|
||||
workflow: string;
|
||||
prompt: string;
|
||||
maxRounds: number;
|
||||
dryRun: boolean;
|
||||
};
|
||||
/** Client → daemon: run a sense compute on demand. */
|
||||
export type DaemonIpcTriggerSenseRequest = {
|
||||
type: "trigger-sense";
|
||||
sense: string;
|
||||
};
|
||||
/** Client → daemon: list registered senses. */
|
||||
export type DaemonIpcListSensesRequest = {
|
||||
type: "list-senses";
|
||||
};
|
||||
/** Client → daemon: kill a running or queued workflow thread by runId. */
|
||||
export type DaemonIpcKillWorkflowRequest = {
|
||||
type: "kill-workflow";
|
||||
runId: string;
|
||||
};
|
||||
/** Client → daemon: list registered workflows and queue/active counts. */
|
||||
export type DaemonIpcListWorkflowsRequest = {
|
||||
type: "list-workflows";
|
||||
};
|
||||
/** Client → daemon: public health snapshot. */
|
||||
export type DaemonIpcHealthRequest = {
|
||||
type: "health";
|
||||
};
|
||||
/** Union of all JSON requests the daemon IPC server accepts. */
|
||||
export type DaemonIpcRequest = DaemonIpcTriggerWorkflowRequest | DaemonIpcTriggerSenseRequest | DaemonIpcListSensesRequest | DaemonIpcKillWorkflowRequest | DaemonIpcListWorkflowsRequest | DaemonIpcHealthRequest;
|
||||
/** Successful trigger / trigger-sense reply (no body). */
|
||||
export type DaemonIpcTriggerOkResponse = {
|
||||
ok: true;
|
||||
};
|
||||
export type DaemonIpcErrorResponse = {
|
||||
ok: false;
|
||||
error: string;
|
||||
};
|
||||
/** Replies for trigger-workflow and trigger-sense. */
|
||||
export type DaemonIpcTriggerResponse = DaemonIpcTriggerOkResponse | DaemonIpcErrorResponse;
|
||||
/** Reply for list-senses. */
|
||||
export type DaemonIpcListSensesResponse = {
|
||||
ok: true;
|
||||
senses: SenseInfo[];
|
||||
} | DaemonIpcErrorResponse;
|
||||
/** Reply for list-workflows. */
|
||||
export type DaemonIpcListWorkflowsResponse = {
|
||||
ok: true;
|
||||
workflows: WorkflowStatus[];
|
||||
} | DaemonIpcErrorResponse;
|
||||
/** Reply for health. */
|
||||
export type DaemonIpcHealthResponse = {
|
||||
ok: true;
|
||||
health: HealthInfo;
|
||||
} | DaemonIpcErrorResponse;
|
||||
/** Any JSON response the daemon may write on the IPC socket. */
|
||||
export type DaemonIpcResponse = DaemonIpcTriggerOkResponse | DaemonIpcErrorResponse | DaemonIpcListSensesResponse | DaemonIpcListWorkflowsResponse | DaemonIpcHealthResponse;
|
||||
export type DaemonTransportTriggerResult = {
|
||||
ok: true;
|
||||
} | {
|
||||
ok: false;
|
||||
error: string;
|
||||
};
|
||||
export type DaemonTransportWorkflowLaunch = {
|
||||
prompt: string;
|
||||
maxRounds: number;
|
||||
dryRun: boolean;
|
||||
};
|
||||
/**
|
||||
* Abstraction over daemon control plane (Unix socket IPC today, HTTP in Phase 2).
|
||||
* Implementations live in CLI / tools; the daemon kernel uses shared handler logic.
|
||||
*/
|
||||
export type DaemonTransport = {
|
||||
health(): Promise<HealthInfo>;
|
||||
listSenses(): Promise<SenseInfo[]>;
|
||||
listWorkflows(): Promise<WorkflowStatus[]>;
|
||||
triggerSense(name: string): Promise<DaemonTransportTriggerResult>;
|
||||
/** When `launch` is null, implementations use engine defaults (empty prompt, default max rounds, dryRun false). */
|
||||
triggerWorkflow(name: string, launch: DaemonTransportWorkflowLaunch | null): Promise<DaemonTransportTriggerResult>;
|
||||
/** Kill a running or queued workflow thread by `runId` (same field as IPC `kill-workflow`). */
|
||||
killWorkflow(runId: string): Promise<DaemonTransportTriggerResult>;
|
||||
};
|
||||
/**
|
||||
* Parse a single line of JSON into a {@link DaemonIpcRequest}, or null if invalid.
|
||||
* Kept in core with the request types so CLI and daemon stay aligned at compile time.
|
||||
*/
|
||||
export declare function parseDaemonIpcRequest(line: string): DaemonIpcRequest | null;
|
||||
/** Type guard for JSON {@link SenseInfo} payloads from daemon HTTP/IPC. */
|
||||
export declare function isSenseInfo(value: unknown): value is SenseInfo;
|
||||
/** Type guard for JSON {@link WorkflowStatus} payloads from daemon HTTP/IPC. */
|
||||
export declare function isWorkflowStatus(value: unknown): value is WorkflowStatus;
|
||||
//# sourceMappingURL=daemon.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["daemon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAE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AAC;AAkBF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CA6B3E;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAU9D;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAaxE"}
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
export type { SenseConfig, DropOverflowConfig, QueueOverflowConfig, WorkflowConfig, NerveApiConfig, AgentConfig, ExtractConfig, NerveConfig, SenseTrigger, } from "./config.js";
|
||||
export type { SenseInfo } from "./sense.js";
|
||||
export type { SenseComputeFn, SenseModule } from "./sense.js";
|
||||
export { senseTriggerLabels } from "./sense.js";
|
||||
export type { WorkflowMessage, RoleResult, Role, RoleMeta, StartStep, ThreadContext, WorkflowContext, AgentFn, RoleStep, ModeratorContext, Moderator, WorkflowDefinition, } from "@uncaged/workflow";
|
||||
export { START, END, DEFAULT_ENGINE_MAX_ROUNDS } from "@uncaged/workflow";
|
||||
export type { Schema, ExtractFn } from "./agent.js";
|
||||
export { ExtractError } from "./agent.js";
|
||||
export type { Result } from "./util.js";
|
||||
export { ok, err } from "./util.js";
|
||||
export { nerveCommandEnv, spawnSafe, type SpawnEnv, type SpawnError, type SpawnResult, type SpawnSafeOptions, } from "./util.js";
|
||||
export { parseNerveConfig } from "./config.js";
|
||||
export type { KnowledgeConfig } from "./config.js";
|
||||
export { parseKnowledgeYaml } from "./config.js";
|
||||
export { isPlainRecord } from "./util.js";
|
||||
export { parseSenseTrigger } from "./sense.js";
|
||||
export { isSenseInfo, isWorkflowStatus } from "./daemon.js";
|
||||
export type { WorkflowStatus, HealthInfo, DaemonIpcTriggerWorkflowRequest, DaemonIpcTriggerSenseRequest, DaemonIpcListSensesRequest, DaemonIpcKillWorkflowRequest, DaemonIpcListWorkflowsRequest, DaemonIpcHealthRequest, DaemonIpcRequest, DaemonIpcTriggerOkResponse, DaemonIpcErrorResponse, DaemonIpcTriggerResponse, DaemonIpcListSensesResponse, DaemonIpcListWorkflowsResponse, DaemonIpcHealthResponse, DaemonIpcResponse, } from "./daemon.js";
|
||||
export { parseDaemonIpcRequest } from "./daemon.js";
|
||||
export type { DaemonTransport, DaemonTransportTriggerResult, DaemonTransportWorkflowLaunch, } from "./daemon.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EACV,eAAe,EACf,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,EACf,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5D,YAAY,EACV,cAAc,EACd,UAAU,EACV,+BAA+B,EAC/B,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,8BAA8B,EAC9B,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EACV,eAAe,EACf,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,aAAa,CAAC"}
|
||||
@@ -1,8 +1,5 @@
|
||||
export type {
|
||||
SenseConfig,
|
||||
DropOverflowConfig,
|
||||
QueueOverflowConfig,
|
||||
WorkflowConfig,
|
||||
NerveApiConfig,
|
||||
AgentConfig,
|
||||
ExtractConfig,
|
||||
@@ -12,21 +9,6 @@ export type {
|
||||
export type { SenseInfo } from "./sense.js";
|
||||
export type { SenseComputeFn, SenseModule } from "./sense.js";
|
||||
export { senseTriggerLabels } from "./sense.js";
|
||||
export type {
|
||||
WorkflowMessage,
|
||||
RoleResult,
|
||||
Role,
|
||||
RoleMeta,
|
||||
StartStep,
|
||||
ThreadContext,
|
||||
WorkflowContext,
|
||||
AgentFn,
|
||||
RoleStep,
|
||||
ModeratorContext,
|
||||
Moderator,
|
||||
WorkflowDefinition,
|
||||
} from "@uncaged/workflow/public-types";
|
||||
export { START, END, DEFAULT_ENGINE_MAX_ROUNDS } from "@uncaged/workflow/public-types";
|
||||
export type { Schema, ExtractFn } from "./agent.js";
|
||||
export { ExtractError } from "./agent.js";
|
||||
export type { Result } from "./util.js";
|
||||
|
||||
Vendored
-39
@@ -1,39 +0,0 @@
|
||||
import type { SenseConfig, SenseTrigger } from "./config.js";
|
||||
import { type Result } from "./util.js";
|
||||
/** Runtime metadata for a sense (e.g. daemon list-senses IPC). */
|
||||
export type SenseInfo = {
|
||||
name: string;
|
||||
group: string;
|
||||
throttle: number | null;
|
||||
timeout: number | null;
|
||||
/** Declarative schedule (`interval` / `on`) for this sense (derived from nerve.yaml). */
|
||||
triggers: ReadonlyArray<string>;
|
||||
};
|
||||
/**
|
||||
* The function signature every sense `src/index.ts` must export as a named
|
||||
* `compute` export.
|
||||
*
|
||||
* Pure: no DB, no peers.
|
||||
* Returns the next sense state and an optional trigger (`trigger: null` means no side effect).
|
||||
*/
|
||||
export type SenseComputeFn<S = unknown> = (state: S) => Promise<{
|
||||
state: S;
|
||||
trigger: SenseTrigger | null;
|
||||
}>;
|
||||
/**
|
||||
* The full shape a sense module (`src/index.ts`) must export.
|
||||
*/
|
||||
export type SenseModule<S = unknown> = {
|
||||
compute: SenseComputeFn<S>;
|
||||
initialState: S;
|
||||
};
|
||||
/** Human-readable label for a sense schedule (`interval` and/or `on`). */
|
||||
export declare function labelSenseTrigger(slice: Pick<SenseConfig, "interval" | "on">): string;
|
||||
/**
|
||||
* Human-readable trigger labels for a sense from its `SenseConfig.interval` / `.on`.
|
||||
* Returns an empty array when the sense is missing or has no schedule.
|
||||
*/
|
||||
export declare function senseTriggerLabels(senseName: string, senses: Record<string, SenseConfig>): string[];
|
||||
/** Validates `{ command: string }` from Sense compute or IPC (`trigger` field). */
|
||||
export declare function parseSenseTrigger(value: unknown): Result<SenseTrigger>;
|
||||
//# sourceMappingURL=sense.d.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@@
|
||||
export type Result<T, E = Error> = {
|
||||
ok: true;
|
||||
value: T;
|
||||
} | {
|
||||
ok: false;
|
||||
error: E;
|
||||
};
|
||||
/** Compatible with `process.env` for `child_process.spawn`. */
|
||||
export type SpawnEnv = Record<string, string | undefined>;
|
||||
export type SpawnResult = {
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
exitCode: number;
|
||||
/** OS signal name (e.g. `"SIGTERM"`) when terminated by signal; otherwise `null`. */
|
||||
signal: string | null;
|
||||
};
|
||||
export type SpawnError = {
|
||||
kind: "non_zero_exit";
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
exitCode: number;
|
||||
signal: string | null;
|
||||
} | {
|
||||
kind: "timeout";
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
} | {
|
||||
kind: "spawn_failed";
|
||||
message: string;
|
||||
} | {
|
||||
kind: "aborted";
|
||||
};
|
||||
export type SpawnSafeOptions = {
|
||||
cwd: string | null;
|
||||
/** When null, merges {@link nerveCommandEnv} over `process.env`. When set, merges over that default. */
|
||||
env: SpawnEnv | null;
|
||||
timeoutMs: number | null;
|
||||
dryRun: boolean;
|
||||
/** When non-null, child is terminated on abort; if `timeoutMs` is also null, no internal wall-clock timer is used. */
|
||||
abortSignal: AbortSignal | null;
|
||||
};
|
||||
type SpawnSafeOptionsInput = SpawnSafeOptions | Omit<SpawnSafeOptions, "dryRun">;
|
||||
export declare function ok<T>(value: T): Result<T, never>;
|
||||
export declare function err<E = Error>(error: E): Result<never, E>;
|
||||
/**
|
||||
* Narrows `unknown` to a plain JSON-style object (not null, not array).
|
||||
* Use after `JSON.parse` / YAML / IPC when validating structure field-by-field.
|
||||
*/
|
||||
export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
|
||||
/**
|
||||
* Parse a duration string such as `5s`, `10m`, `1h` to milliseconds.
|
||||
* Used by `parseNerveConfig` sense/workflow duration fields.
|
||||
*/
|
||||
export declare function parseDurationStringToMs(value: string): Result<number>;
|
||||
/**
|
||||
* PATH and PNPM_HOME for running `pnpm` and `nerve` from workflow roles.
|
||||
* Uses the pnpm store home only (no npm user bin); binaries must resolve via PATH.
|
||||
*/
|
||||
export declare function nerveCommandEnv(): SpawnEnv;
|
||||
/**
|
||||
* Spawn a process with `shell: false` (argv only), default {@link nerveCommandEnv}, and optional timeout.
|
||||
* Returns `ok` only when the process exits with code 0.
|
||||
*/
|
||||
export declare function spawnSafe(command: string, args: ReadonlyArray<string>, options: SpawnSafeOptionsInput): Promise<Result<SpawnResult, SpawnError>>;
|
||||
export {};
|
||||
//# sourceMappingURL=util.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAEpF,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAA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mitter } from "node:events";
|
||||
|
||||
import type { NerveConfig, WorkflowConfig } from "@uncaged/nerve-core";
|
||||
import type { NerveConfig } from "@uncaged/nerve-core";
|
||||
import type { WorkflowConfig } from "@uncaged/workflow";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
type MockChild = EventEmitter & {
|
||||
|
||||
@@ -15,7 +15,8 @@ import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import type { NerveConfig, WorkflowConfig } from "@uncaged/nerve-core";
|
||||
import type { NerveConfig } from "@uncaged/nerve-core";
|
||||
import type { WorkflowConfig } from "@uncaged/workflow";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
type MockChild = EventEmitter & {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { createWorkerRuntime } from "@uncaged/workflow";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const fixturesDir = join(dirname(fileURLToPath(import.meta.url)), "fixtures");
|
||||
const echoWorkerPath = join(fixturesDir, "echo-worker.js");
|
||||
|
||||
@@ -18,6 +18,8 @@ import {
|
||||
|
||||
import { createLogStore } from "@uncaged/nerve-store";
|
||||
import type { LogStore } from "@uncaged/nerve-store";
|
||||
import { createWorkflowManager } from "@uncaged/workflow";
|
||||
import type { WorkflowManager } from "@uncaged/workflow";
|
||||
import { createDaemonHandlers } from "./daemon-handlers.js";
|
||||
import { createDaemonIpcServer } from "./daemon-ipc.js";
|
||||
import type { DaemonIpcServer } from "./daemon-ipc.js";
|
||||
@@ -36,8 +38,6 @@ import {
|
||||
import { createSenseScheduler } from "./sense-scheduler.js";
|
||||
import type { SenseScheduler } from "./sense-scheduler.js";
|
||||
import { createSenseWorkerPool, resolveWorkerScript } from "./worker-pool.js";
|
||||
import { createWorkflowManager } from "@uncaged/workflow";
|
||||
import type { WorkflowManager } from "@uncaged/workflow";
|
||||
|
||||
export type KernelHealth = {
|
||||
uptime: number;
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import type { ComputeMessage } from "./ipc.js";
|
||||
import {
|
||||
createWorkerRuntime,
|
||||
formatCapturedStderrTail,
|
||||
formatChildExitSummary,
|
||||
} from "@uncaged/workflow";
|
||||
import type { ComputeMessage } from "./ipc.js";
|
||||
|
||||
export function resolveWorkerScript(): string {
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"@uncaged/nerve-workflow-utils": "workspace:*",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole, decorateRole, onFail, withDryRun } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const committerMetaSchema = z.object({
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"@uncaged/nerve-workflow-utils": "workspace:*",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const reviewerMetaSchema = z.object({
|
||||
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* CAS blob store — sha256 content-addressable files under `data/blobs/`.
|
||||
*
|
||||
* Layout: `<root>/<2-hex-shard>/<62-hex-rest>` (RFC-001 §8).
|
||||
*/
|
||||
export type BlobStore = {
|
||||
/** Persist UTF-8 or raw bytes; returns lowercase hex sha256. Idempotent for identical content. */
|
||||
write: (content: string | Uint8Array | Buffer) => string;
|
||||
/** Returns bytes or null if the hash is invalid or no blob exists. Verifies digest matches path. */
|
||||
read: (hash: string) => Buffer | null;
|
||||
/** True when hash is well-formed and the blob file is present. */
|
||||
exists: (hash: string) => boolean;
|
||||
};
|
||||
/** @returns normalized lowercase hex or null if not a valid sha256 hex string */
|
||||
export declare function normalizeBlobHash(hash: string): string | null;
|
||||
export declare function createBlobStore(blobsRoot: string): BlobStore;
|
||||
//# sourceMappingURL=blob-store.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"blob-store.d.ts","sourceRoot":"","sources":["blob-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,MAAM,MAAM,SAAS,GAAG;IACtB,kGAAkG;IAClG,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,KAAK,MAAM,CAAC;IACzD,oGAAoG;IACpG,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACtC,kEAAkE;IAClE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACnC,CAAC;AAYF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAiBD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CA2C5D"}
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @uncaged/nerve-store — append-only log storage, cold-archive helpers, CAS blob store.
|
||||
*/
|
||||
export * from "./blob-store.js";
|
||||
export * from "./log-archive.js";
|
||||
export { createLogStore } from "./log-store.js";
|
||||
export type { GetThreadRoundsParams, LogEntry, LogQuery, LogStore, ThreadRoundRow, WorkflowRun, WorkflowRunStatus, } from "./log-store.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EACV,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
|
||||
Vendored
-32
@@ -1,32 +0,0 @@
|
||||
/** Log cold-archive helpers (RFC-001 §5.4) — UTC calendar days, JSONL export. */
|
||||
export declare const LOG_ARCHIVE_META_KEY = "archived_up_to";
|
||||
export declare const DEFAULT_LOG_RETENTION_MS: number;
|
||||
export type ArchiveLogsOptions = {
|
||||
/** Wall clock for retention boundary (default: `Date.now()`). */
|
||||
now?: number;
|
||||
/** Run `VACUUM` after archiving (outside the per-day transaction). */
|
||||
vacuum?: boolean;
|
||||
/** Max UTC days to process in one call (default: unlimited). */
|
||||
maxDays?: number;
|
||||
/** Override default 30-day retention (tests). */
|
||||
retentionMs?: number;
|
||||
};
|
||||
export type ArchiveLogsDayResult = {
|
||||
day: string;
|
||||
rowCount: number;
|
||||
filePath: string;
|
||||
};
|
||||
export type ArchiveLogsResult = {
|
||||
days: ArchiveLogsDayResult[];
|
||||
vacuumed: boolean;
|
||||
};
|
||||
export declare function utcDateStringFromMs(ms: number): string;
|
||||
export declare function assertValidUtcDay(day: string): void;
|
||||
export declare function utcDayStartMs(day: string): number;
|
||||
export declare function utcDayEndExclusiveMs(day: string): number;
|
||||
export declare function prevUtcDay(day: string): string;
|
||||
export declare function nextUtcDay(day: string): string;
|
||||
/** Last UTC calendar day D such that the exclusive end of D is ≤ boundaryMs. */
|
||||
export declare function lastArchivableUtcDay(boundaryMs: number): string;
|
||||
export declare function compareIsoDays(a: string, b: string): number;
|
||||
//# sourceMappingURL=log-archive.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"log-archive.d.ts","sourceRoot":"","sources":["log-archive.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAErD,eAAO,MAAM,wBAAwB,QAAkB,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,oBAAoB,EAAE,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEtD;AAiBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAI3D"}
|
||||
Vendored
-134
@@ -1,134 +0,0 @@
|
||||
/**
|
||||
* Log Store — append-only structured log storage backed by SQLite.
|
||||
*
|
||||
* Stores system, sense-scheduler (`sense_scheduler` source), sense, and workflow log entries in a single table.
|
||||
* Logs are data assets for audit/analysis — they MUST NOT feed back into scheduling or workflows as triggers.
|
||||
*
|
||||
* Also provides a `meta` key-value table for bookkeeping (e.g. archive watermarks).
|
||||
*/
|
||||
import type { ArchiveLogsOptions, ArchiveLogsResult } from "./log-archive.js";
|
||||
export { LOG_ARCHIVE_META_KEY } from "./log-archive.js";
|
||||
export type { ArchiveLogsDayResult, ArchiveLogsOptions, ArchiveLogsResult } from "./log-archive.js";
|
||||
export type LogEntry = {
|
||||
id?: number;
|
||||
source: string;
|
||||
type: string;
|
||||
refId: string | null;
|
||||
payload: string | null;
|
||||
timestamp: number;
|
||||
};
|
||||
export type LogQuery = {
|
||||
source?: string;
|
||||
type?: string;
|
||||
refId?: string;
|
||||
since?: number;
|
||||
until?: number;
|
||||
limit?: number;
|
||||
};
|
||||
export type WorkflowRunStatus = "queued" | "started" | "completed" | "failed" | "crashed" | "dropped" | "interrupted" | "killed";
|
||||
/** One row in the workflow_runs materialized table. */
|
||||
export type WorkflowRun = {
|
||||
runId: string;
|
||||
workflow: string;
|
||||
status: WorkflowRunStatus;
|
||||
timestamp: number;
|
||||
exitCode: number | null;
|
||||
};
|
||||
/** One role-produced workflow-message row with 1-based round index (ROW_NUMBER over role messages only). */
|
||||
export type ThreadRoundRow = {
|
||||
round: number;
|
||||
logId: number;
|
||||
timestamp: number;
|
||||
message: {
|
||||
role: string;
|
||||
content: string;
|
||||
meta: unknown;
|
||||
timestamp: number;
|
||||
};
|
||||
};
|
||||
/** Parameters for {@link LogStore.getThreadRounds}. */
|
||||
export type GetThreadRoundsParams = {
|
||||
/**
|
||||
* Exclusive upper bound on round index (1-based among role events).
|
||||
* Use `0` to include all rounds (subject to `limit`).
|
||||
*/
|
||||
before: number;
|
||||
/** Maximum rows returned from the DB (DESC by round). */
|
||||
limit: number;
|
||||
};
|
||||
export type LogStore = {
|
||||
append: (entry: Omit<LogEntry, "id">) => LogEntry;
|
||||
query: (filter?: LogQuery) => LogEntry[];
|
||||
getMeta: (key: string) => string | null;
|
||||
setMeta: (key: string, value: string) => void;
|
||||
/**
|
||||
* Append a workflow log event and atomically upsert the workflow_runs
|
||||
* materialized table — both in a single SQLite transaction (RFC-002 §6.2).
|
||||
*/
|
||||
upsertWorkflowRun: (entry: Omit<LogEntry, "id">, run: WorkflowRun) => LogEntry;
|
||||
/**
|
||||
* Alias for upsertWorkflowRun — append a log entry and update workflow_runs
|
||||
* in one atomic transaction.
|
||||
*/
|
||||
appendWithWorkflowUpdate: (entry: Omit<LogEntry, "id">, run: WorkflowRun) => LogEntry;
|
||||
/** Get the current materialized state of a specific workflow run. */
|
||||
getWorkflowRun: (runId: string) => WorkflowRun | null;
|
||||
/**
|
||||
* Get all workflow runs with status 'queued' or 'started'.
|
||||
* Optionally filter by workflow name.
|
||||
*/
|
||||
getActiveWorkflowRuns: (workflowName?: string) => WorkflowRun[];
|
||||
/**
|
||||
* Get all workflow runs regardless of status, sorted by timestamp descending.
|
||||
* Optionally filter by workflow name.
|
||||
*/
|
||||
getAllWorkflowRuns: (workflowName: string | null) => WorkflowRun[];
|
||||
/**
|
||||
* Get the trigger payload for a workflow run (stored in the 'started' log entry).
|
||||
* Returns null if not found.
|
||||
*/
|
||||
getTriggerPayload: (runId: string) => unknown;
|
||||
/**
|
||||
* Get all workflow CommandEvents for a specific run, ordered by id ASC.
|
||||
* @deprecated Use getThreadMessages for the new WorkflowMessage format.
|
||||
*/
|
||||
getThreadEvents: (runId: string) => Array<{
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
}>;
|
||||
/**
|
||||
* Get all WorkflowMessages for a specific run, ordered by id ASC.
|
||||
* Used for crash recovery to rebuild the message chain.
|
||||
*/
|
||||
getThreadMessages: (runId: string) => Array<{
|
||||
role: string;
|
||||
content: string;
|
||||
meta: unknown;
|
||||
timestamp: number;
|
||||
}>;
|
||||
/**
|
||||
* Count role command events for a run (excludes `thread_start`/`__start__` messages and invalid payloads).
|
||||
* Round indices for {@link getThreadRounds} are 1..count in chronological order.
|
||||
*/
|
||||
getThreadRoundCount: (runId: string) => number;
|
||||
/**
|
||||
* Role rounds for agent-oriented retrieval: each row is one `thread_command_event` or
|
||||
* `thread_workflow_message` whose JSON `type` is not `thread_start` and `role` is not `__start__`,
|
||||
* with `round` from ROW_NUMBER() OVER (ORDER BY id ASC). No schema migration — numbering is computed in SQL.
|
||||
*/
|
||||
getThreadRounds: (runId: string, params: GetThreadRoundsParams) => ThreadRoundRow[];
|
||||
/**
|
||||
* The workflow `__start__` message for a run (if persisted), as a {@link ThreadRoundRow}
|
||||
* with `round` 0 — not part of {@link getThreadRoundCount} / {@link getThreadRounds} numbering.
|
||||
*/
|
||||
getThreadStartMessage: (runId: string) => ThreadRoundRow | null;
|
||||
/**
|
||||
* Export logs older than the retention window to `data/archive/logs/YYYY-MM-DD.jsonl`,
|
||||
* then delete those rows and advance `meta.archived_up_to` in one transaction per day
|
||||
* (RFC-001 §5.4).
|
||||
*/
|
||||
archiveLogs: (options?: ArchiveLogsOptions) => ArchiveLogsResult;
|
||||
close: () => void;
|
||||
};
|
||||
export declare function createLogStore(dbPath: string): LogStore;
|
||||
//# sourceMappingURL=log-store.d.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"log-store.d.ts","sourceRoot":"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IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C;;;OAGG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACpF;;;OAGG;IACH,iBAAiB,EAAE,CACjB,KAAK,EAAE,MAAM,KACV,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChF;;;OAGG;IACH,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C;;;;OAIG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,cAAc,EAAE,CAAC;IACpF;;;OAGG;IACH,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,GAAG,IAAI,CAAC;IAChE;;;;OAIG;IACH,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,iBAAiB,CAAC;IACjE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AA4JF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAqbvD"}
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"@uncaged/nerve-role-committer": "workspace:*",
|
||||
"@uncaged/nerve-role-reviewer": "workspace:*",
|
||||
"@uncaged/nerve-workflow-utils": "workspace:*",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AgentFn, WorkflowDefinition } from "@uncaged/nerve-core";
|
||||
import { createCommitterRole } from "@uncaged/nerve-role-committer";
|
||||
import { createReviewerRole } from "@uncaged/nerve-role-reviewer";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, WorkflowDefinition } from "@uncaged/workflow";
|
||||
|
||||
import { moderator } from "./moderator.js";
|
||||
import type { SenseMeta } from "./moderator.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { END } from "@uncaged/nerve-core";
|
||||
import type { Moderator } from "@uncaged/nerve-core";
|
||||
import type { CommitterMeta } from "@uncaged/nerve-role-committer";
|
||||
import type { ReviewerMeta } from "@uncaged/nerve-role-reviewer";
|
||||
import { END } from "@uncaged/workflow";
|
||||
import type { Moderator } from "@uncaged/workflow";
|
||||
import type { CoderMeta } from "./roles/coder.js";
|
||||
import type { PlannerMeta } from "./roles/planner.js";
|
||||
import type { TesterMeta } from "./roles/tester.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const coderMetaSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const plannerMetaSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const testerMetaSchema = z.object({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AgentFn, WorkflowDefinition } from "@uncaged/nerve-core";
|
||||
import { createCommitterRole } from "@uncaged/nerve-role-committer";
|
||||
import { createReviewerRole } from "@uncaged/nerve-role-reviewer";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, WorkflowDefinition } from "@uncaged/workflow";
|
||||
|
||||
import { moderator } from "./moderator.js";
|
||||
import type { WorkflowMeta } from "./moderator.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { END } from "@uncaged/nerve-core";
|
||||
import type { Moderator } from "@uncaged/nerve-core";
|
||||
import type { CommitterMeta } from "@uncaged/nerve-role-committer";
|
||||
import type { ReviewerMeta } from "@uncaged/nerve-role-reviewer";
|
||||
import { END } from "@uncaged/workflow";
|
||||
import type { Moderator } from "@uncaged/workflow";
|
||||
import type { CoderMeta } from "./roles/coder.js";
|
||||
import type { PlannerMeta } from "./roles/planner.js";
|
||||
import type { TesterMeta } from "./roles/tester.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const coderMetaSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const plannerMetaSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
||||
import { createRole } from "@uncaged/nerve-workflow-utils";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import { z } from "zod";
|
||||
|
||||
export const testerMetaSchema = z.object({
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"@uncaged/nerve-adapter-cursor": "workspace:*",
|
||||
"@uncaged/nerve-adapter-hermes": "workspace:*",
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/workflow": "workspace:*",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { START, type ThreadContext } from "@uncaged/nerve-core";
|
||||
import { START, type ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
import { createLlmAdapter } from "../create-llm-adapter.js";
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
RoleMeta,
|
||||
ThreadContext,
|
||||
WorkflowDefinition,
|
||||
} from "@uncaged/nerve-core";
|
||||
import { END, START } from "@uncaged/nerve-core";
|
||||
} from "@uncaged/workflow";
|
||||
import { END, START } from "@uncaged/workflow";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { Role, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
import { START } from "@uncaged/nerve-core";
|
||||
import { START } from "@uncaged/workflow";
|
||||
import { decorateRole, onFail, withDryRun } from "../role-decorators.js";
|
||||
|
||||
type TestMeta = Record<string, unknown> & { ok: boolean };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
import { START, type ThreadContext } from "@uncaged/nerve-core";
|
||||
import { START, type ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
import { createCursorRole } from "../role-cursor.js";
|
||||
import { createHermesRole } from "../role-hermes.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AgentFn, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { AgentFn, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
import { formatLlmError } from "./shared/format-error.js";
|
||||
import { chatCompletionText } from "./shared/llm-chat.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { extractMetaOrThrow } from "./shared/extract-fn.js";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { type CursorAgentMode, cursorAgent } from "@uncaged/nerve-adapter-cursor";
|
||||
import type { Role, SpawnEnv } from "@uncaged/nerve-core";
|
||||
import type { SpawnEnv } from "@uncaged/nerve-core";
|
||||
import type { Role } from "@uncaged/workflow";
|
||||
|
||||
import type { CursorRoleDefaults, CursorRoleRequired } from "./role-types.js";
|
||||
import { formatLlmError } from "./shared/format-error.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Role, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { Role, ThreadContext } from "@uncaged/workflow";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Decorator types
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Role } from "@uncaged/nerve-core";
|
||||
import type { Role } from "@uncaged/workflow";
|
||||
|
||||
import type { HermesRoleDefaults, HermesRoleRequired } from "./role-types.js";
|
||||
import { formatLlmError } from "./shared/format-error.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Role } from "@uncaged/nerve-core";
|
||||
import type { Role } from "@uncaged/workflow";
|
||||
|
||||
import type { LlmMessage, LlmRoleDefaults, LlmRoleRequired } from "./role-types.js";
|
||||
import { formatLlmError } from "./shared/format-error.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Role } from "@uncaged/nerve-core";
|
||||
import type { Role } from "@uncaged/workflow";
|
||||
|
||||
import type { LlmMessage, ReActRoleDefaults, ReActRoleRequired } from "./role-types.js";
|
||||
import { formatLlmError } from "./shared/format-error.js";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { SpawnEnv, ThreadContext } from "@uncaged/nerve-core";
|
||||
import type { SpawnEnv } from "@uncaged/nerve-core";
|
||||
import type { ThreadContext } from "@uncaged/workflow";
|
||||
import type { z } from "zod";
|
||||
|
||||
import type { LlmProvider } from "./shared/llm-extract.js";
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
"build:public-types": "tsc -p tsconfig.public-types.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uncaged/nerve-core": "workspace:*",
|
||||
"@uncaged/nerve-store": "workspace:*"
|
||||
"@uncaged/nerve-core": "^0.5.0",
|
||||
"@uncaged/nerve-store": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rslib/core": "^0.21.3",
|
||||
|
||||
@@ -238,7 +238,9 @@ function parseWorkflowErrorMsg(obj: Record<string, unknown>): Result<WorkflowErr
|
||||
});
|
||||
}
|
||||
|
||||
function parseThreadWorkflowMessageMsg(obj: Record<string, unknown>): Result<ThreadWorkflowMessage> {
|
||||
function parseThreadWorkflowMessageMsg(
|
||||
obj: Record<string, unknown>,
|
||||
): Result<ThreadWorkflowMessage> {
|
||||
if (typeof obj.runId !== "string") {
|
||||
return err(new Error("Worker 'thread-workflow-message' missing string 'runId' field"));
|
||||
}
|
||||
@@ -297,9 +299,7 @@ export function parseWorkflowWorkerToParentMessage(
|
||||
}
|
||||
|
||||
/** Parse messages from a workflow worker child (thread IPC + optional `ready`). */
|
||||
export function parseWorkflowChildMessage(
|
||||
raw: unknown,
|
||||
): Result<WorkflowChildToParentMessage> {
|
||||
export function parseWorkflowChildMessage(raw: unknown): Result<WorkflowChildToParentMessage> {
|
||||
if (!isPlainRecord(raw)) {
|
||||
return err(new Error("Worker IPC message is not an object"));
|
||||
}
|
||||
|
||||
@@ -6,17 +6,13 @@
|
||||
* Concurrency and overflow (drop/queue) are enforced here in the parent process.
|
||||
*/
|
||||
|
||||
import type { NerveConfig, WorkflowConfig, WorkflowStatus } from "@uncaged/nerve-core";
|
||||
import type { NerveConfig, WorkflowStatus } from "@uncaged/nerve-core";
|
||||
|
||||
import type { WorkflowConfig } from "./config.js";
|
||||
|
||||
import type { LogStore } from "@uncaged/nerve-store";
|
||||
import type { KillThreadMessage, StartThreadMessage, ThreadEventMessage } from "./ipc.js";
|
||||
import { parseWorkflowChildMessage } from "./ipc.js";
|
||||
import {
|
||||
createWorkerRuntime,
|
||||
formatCapturedStderrTail,
|
||||
formatChildExitSummary,
|
||||
} from "./worker-runtime.js";
|
||||
import { WORKFLOW_WORKER_PATH } from "./paths.js";
|
||||
import {
|
||||
DEFAULT_MAX_QUEUE,
|
||||
WORKER_SHUTDOWN_TIMEOUT_MS,
|
||||
@@ -27,6 +23,12 @@ import {
|
||||
extractExitCodeFromPayload,
|
||||
recoverThreadsFromStore,
|
||||
} from "./manager-support.js";
|
||||
import { WORKFLOW_WORKER_PATH } from "./paths.js";
|
||||
import {
|
||||
createWorkerRuntime,
|
||||
formatCapturedStderrTail,
|
||||
formatChildExitSummary,
|
||||
} from "./worker-runtime.js";
|
||||
|
||||
export type WorkflowLaunchParams = {
|
||||
prompt: string;
|
||||
|
||||
Reference in New Issue
Block a user