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:
@@ -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,KAAK,MAAM,EAAmD,MAAM,WAAW,CAAC;AAEzF,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,8FAA8F;IAC9F,EAAE,EAAE,MAAM,EAAE,CAAC;CACd,CAAC;AAEF,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAA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X_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;AAEF,6CAA6C;AAC7C,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,sDAAsD;AACtD,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,eAAe,CAAC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,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9B,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACnC,aAAa,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAClE,mHAAmH;IACnH,eAAe,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,6BAA6B,GAAG,IAAI,GAC3C,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACzC,+FAA+F;IAC/F,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;CACpE,CAAC;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,E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BAAsB,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.ts.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"sense.d.ts","sourceRoot":"","sources":["sense.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,KAAK,MAAM,EAA0B,MAAM,WAAW,CAAC;AAEhE,kEAAkE;AAClE,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,yFAAyF;IACzF,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI,CACxC,KAAK,EAAE,CAAC,KACL,OAAO,CAAC;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;IACrC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,YAAY,EAAE,CAAC,CAAC;CACjB,CAAC;AAYF,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,MAAM,CAYrF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAClC,MAAM,EAAE,CAKV;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,CActE"}
|
||||
Vendored
-66
@@ -1,66 +0,0 @@
|
||||
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,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