qlogicagent 2.20.2 → 2.20.4
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/dist/agent-contract.js +1 -1
- package/dist/agent.js +39 -35
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/host-session-collection-contract.js +1 -1
- package/dist/index.js +624 -549
- package/dist/memory-category-contract.js +1 -0
- package/dist/orchestration.js +1 -1
- package/dist/project-memory-host.js +21 -21
- package/dist/protocol.js +1 -1
- package/dist/skill-category-contract.js +1 -0
- package/dist/skills/builtin/web-research/SKILL.md +37 -0
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +1 -1
- package/dist/tunables.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +6 -9
- package/dist/types/agent/memory-recall-injection.d.ts +1 -6
- package/dist/types/agent/tool-loop/agent-argument-normalizer.d.ts +12 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +8 -0
- package/dist/types/agent/tool-loop.d.ts +5 -0
- package/dist/types/agent/types.d.ts +5 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +11 -9
- package/dist/types/cli/acp-session-handlers.d.ts +1 -1
- package/dist/types/cli/acp-session-host.d.ts +8 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +7 -1
- package/dist/types/cli/agent-runtime-session-state.d.ts +23 -6
- package/dist/types/cli/atomic-text-file.d.ts +31 -0
- package/dist/types/cli/background-context-capsule.d.ts +12 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/cli-acp-request-handler.d.ts +3 -1
- package/dist/types/cli/community-workflow-installer.d.ts +1 -1
- package/dist/types/cli/core-tool-coordinator.d.ts +1 -0
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +17 -1
- package/dist/types/cli/dev-tool-bootstrap.d.ts +3 -2
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +1 -0
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +3 -1
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +81 -0
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +59 -0
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +2 -0
- package/dist/types/cli/handlers/community-handler.d.ts +2 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +1 -1
- package/dist/types/cli/handlers/memory-handler.d.ts +2 -14
- package/dist/types/cli/handlers/product-handler.d.ts +6 -24
- package/dist/types/cli/handlers/turn-handler.d.ts +1 -0
- package/dist/types/cli/idle-dream-coordinator.d.ts +9 -5
- package/dist/types/cli/memory-background-coordinator.d.ts +26 -0
- package/dist/types/cli/memory-candidate-service.d.ts +2 -3
- package/dist/types/cli/memory-coordinator.d.ts +12 -8
- package/dist/types/cli/permission-bootstrap.d.ts +10 -1
- package/dist/types/cli/product-acp-params.d.ts +29 -0
- package/dist/types/cli/resolved-agent-cache.d.ts +18 -7
- package/dist/types/cli/rpc-registry.d.ts +2 -1
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +7 -4
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +8 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +53 -16
- package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -2
- package/dist/types/cli/task-distillation-coordinator.d.ts +42 -14
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +14 -4
- package/dist/types/cli/tool-bootstrap.d.ts +2 -1
- package/dist/types/cli/turn-core.d.ts +4 -0
- package/dist/types/cli/turn-lifecycle.d.ts +1 -0
- package/dist/types/contracts/hooks.d.ts +3 -2
- package/dist/types/contracts/turn-event.d.ts +7 -0
- package/dist/types/host-contract/index.d.ts +144 -14
- package/dist/types/host-contract/memory-category.d.ts +8 -0
- package/dist/types/host-contract/skill-category.d.ts +5 -0
- package/dist/types/host-session-collection-contract.d.ts +1 -0
- package/dist/types/orchestration/agent-instance.d.ts +15 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +18 -0
- package/dist/types/orchestration/delegate-approval-policy.d.ts +8 -0
- package/dist/types/orchestration/goal-acceptance.d.ts +2 -5
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +4 -2
- package/dist/types/orchestration/goal-mode-adapters.d.ts +16 -0
- package/dist/types/orchestration/goal-run-types.d.ts +6 -1
- package/dist/types/orchestration/product-budget.d.ts +35 -16
- package/dist/types/orchestration/product-persistence.d.ts +5 -14
- package/dist/types/orchestration/product-planner.d.ts +38 -0
- package/dist/types/orchestration/product-worktree.d.ts +4 -2
- package/dist/types/orchestration/solo-evaluator.d.ts +42 -2
- package/dist/types/orchestration/solo-spec-builder.d.ts +3 -0
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +6 -0
- package/dist/types/orchestration/testing/run-state-client-double.d.ts +13 -0
- package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +3 -0
- package/dist/types/orchestration/workflow/capability-catalog.d.ts +31 -0
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +3 -4
- package/dist/types/orchestration/workflow/expression.d.ts +2 -1
- package/dist/types/orchestration/workflow/n8n-import.d.ts +3 -0
- package/dist/types/orchestration/workflow/node-registry.d.ts +2 -2
- package/dist/types/orchestration/workflow/node-schema.d.ts +20 -4
- package/dist/types/orchestration/workflow/params-schema.d.ts +7 -6
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +4 -1
- package/dist/types/orchestration/workflow/run-history-store.d.ts +33 -3
- package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-authoring.d.ts +74 -0
- package/dist/types/orchestration/workflow/workflow-bundle.d.ts +4 -0
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +16 -4
- package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +46 -0
- package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +56 -0
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +7 -0
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +11 -0
- package/dist/types/orchestration/workflow/workflow-store.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +4 -0
- package/dist/types/orchestration/workflow-chat-builder.d.ts +105 -20
- package/dist/types/orchestration/worktree-task-prompt.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +49 -8
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +97 -9
- package/dist/types/protocol/wire/acp-protocol.d.ts +7 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +15 -1
- package/dist/types/protocol/wire/index.d.ts +2 -4
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +1 -39
- package/dist/types/protocol/wire/notification-payloads.d.ts +96 -1
- package/dist/types/protocol/wire/web-capability.d.ts +2 -2
- package/dist/types/runtime/community/community-consent-client.d.ts +3 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +0 -6
- package/dist/types/runtime/execution/bounded-output-tail.d.ts +7 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +8 -5
- package/dist/types/runtime/execution/dream-category-context.d.ts +3 -3
- package/dist/types/runtime/execution/structured-tool-progress.d.ts +21 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +20 -8
- package/dist/types/runtime/infra/background-tasks.d.ts +5 -1
- package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +4 -0
- package/dist/types/runtime/infra/llmrouter-access-token.d.ts +0 -1
- package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +32 -0
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +22 -0
- package/dist/types/runtime/memory/implicit-extraction.d.ts +23 -7
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -5
- package/dist/types/runtime/ports/index.d.ts +2 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +31 -16
- package/dist/types/runtime/ports/memory-writer.d.ts +55 -6
- package/dist/types/runtime/ports/permission-contracts.d.ts +2 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +3 -1
- package/dist/types/runtime/prompt/identity-section.d.ts +2 -0
- package/dist/types/runtime/session/session-permission-store.d.ts +6 -0
- package/dist/types/runtime/tasks/task-types.d.ts +2 -0
- package/dist/types/skills/memory/host-memory-provider.d.ts +59 -9
- package/dist/types/skills/memory/memory-tool.d.ts +3 -1
- package/dist/types/skills/memory/task-distillation.d.ts +22 -3
- package/dist/types/skills/permissions/hook-runner.d.ts +8 -0
- package/dist/types/skills/permissions/operation-classifier.d.ts +7 -0
- package/dist/types/skills/skill-system/skill-category.d.ts +10 -0
- package/dist/types/skills/tools/agent-tool.d.ts +13 -21
- package/dist/types/skills/tools/edit-tool.d.ts +10 -2
- package/dist/types/skills/tools/exec-tool.d.ts +2 -2
- package/dist/types/skills/tools/file-text-snapshot.d.ts +24 -0
- package/dist/types/skills/tools/lsp-tool.d.ts +1 -1
- package/dist/types/skills/tools/patch-tool.d.ts +10 -3
- package/dist/types/skills/tools/read-tool.d.ts +23 -1
- package/dist/types/skills/tools/repo-map-tool.d.ts +52 -0
- package/dist/types/skills/tools/search-tool.d.ts +10 -1
- package/dist/types/skills/tools/shell/index.d.ts +1 -2
- package/dist/types/skills/tools/shell/shell-command.d.ts +1 -1
- package/dist/types/skills/tools/shell/shell-exec.d.ts +2 -2
- package/dist/types/skills/tools/shell/task-output.d.ts +12 -3
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +15 -0
- package/dist/types/skills/tools/task-tool.d.ts +16 -2
- package/dist/types/skills/tools/write-tool.d.ts +2 -1
- package/dist/types/transport/acp-server.d.ts +1 -0
- package/dist/types/transport/host-cloud-auth-client.d.ts +10 -0
- package/dist/types/transport/host-community-client.d.ts +8 -0
- package/dist/types/transport/host-run-state-client.d.ts +6 -0
- package/dist/types/workflow-host.d.ts +8 -1
- package/dist/workflow-host.js +9 -9
- package/package.json +25 -6
- package/dist/types/cli/tool-bootstrap-web-registration.d.ts +0 -14
- package/dist/types/orchestration/tool-cascade.d.ts +0 -49
- package/dist/types/protocol/wire/channel-ingress.d.ts +0 -29
- package/dist/types/protocol/wire/channel.d.ts +0 -89
- package/dist/types/runtime/infra/native-mcp-config-sync.d.ts +0 -16
- package/dist/types/runtime/memory/categories.d.ts +0 -5
- package/dist/types/runtime/memory/recall-category-filter.d.ts +0 -42
- package/dist/types/runtime/ports/source-provider.d.ts +0 -39
- package/dist/types/runtime/ports/web-search-contracts.d.ts +0 -21
- package/dist/types/server/search-svc.d.ts +0 -1
- package/dist/types/skills/memory/local-embedding.d.ts +0 -80
- package/dist/types/skills/memory/memory-config-resolver.d.ts +0 -4
- package/dist/types/skills/memory/memory-embedding-config.d.ts +0 -31
- package/dist/types/skills/tools/web-answer-tool.d.ts +0 -27
- package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -80
- package/dist/types/skills/tools/web-research-tool.d.ts +0 -48
- package/dist/types/skills/tools/web-search-tool.d.ts +0 -46
- package/dist/types/skills/web-search/brave-source.d.ts +0 -3
- package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +0 -16
- package/dist/types/skills/web-search/embedding-rerank.d.ts +0 -13
- package/dist/types/skills/web-search/exa-source.d.ts +0 -3
- package/dist/types/skills/web-search/multi-source-backend.d.ts +0 -23
- package/dist/types/skills/web-search/redis-source-cache.d.ts +0 -6
- package/dist/types/skills/web-search/search-svc-source.d.ts +0 -5
- package/dist/types/skills/web-search/searxng-source.d.ts +0 -4
- package/dist/types/skills/web-search/serper-source.d.ts +0 -3
- package/dist/types/skills/web-search/source-factory.d.ts +0 -6
- package/dist/types/skills/web-search/stability.d.ts +0 -26
- package/dist/types/skills/web-search/web-tunable-resolver.d.ts +0 -16
|
@@ -22,6 +22,12 @@ import type { RunResult } from "./workflow-runtime.js";
|
|
|
22
22
|
import { type WorkflowError } from "./workflow-error.js";
|
|
23
23
|
export declare const MAX_RUN_HISTORY = 20;
|
|
24
24
|
export type RunHistoryStatus = "running" | "completed" | "failed" | "paused" | "skipped" | "canceled";
|
|
25
|
+
export interface RunNodeActivity {
|
|
26
|
+
ts: string;
|
|
27
|
+
phase: "started" | "waiting" | "generating" | "tool_call" | "tool_result" | "completed" | "failed";
|
|
28
|
+
label: string;
|
|
29
|
+
detail?: string;
|
|
30
|
+
}
|
|
25
31
|
export interface RunNodeRecord {
|
|
26
32
|
/** Whether the node's executor actually ran (false = checkpoint cache hit). */
|
|
27
33
|
executed: boolean;
|
|
@@ -33,7 +39,11 @@ export interface RunNodeRecord {
|
|
|
33
39
|
attempts?: number;
|
|
34
40
|
cacheHit?: boolean;
|
|
35
41
|
/** Per-node disposition; "failed" with a surviving run = onError errorPort/continue (D32). */
|
|
36
|
-
nodeStatus?: "completed" | "failed";
|
|
42
|
+
nodeStatus?: "running" | "completed" | "failed";
|
|
43
|
+
/** Safe execution-stage timeline. Never contains model chain-of-thought or raw tool arguments. */
|
|
44
|
+
activities?: RunNodeActivity[];
|
|
45
|
+
/** Live/terminal node error, when available. */
|
|
46
|
+
error?: string;
|
|
37
47
|
/** Engine-imposed limit surfaced on this node (e.g. a loop forced out at its iteration cap). */
|
|
38
48
|
warning?: string;
|
|
39
49
|
}
|
|
@@ -53,21 +63,41 @@ export interface RunHistoryEntry {
|
|
|
53
63
|
/** nodeId → output record. Present once the run settles (not while running). */
|
|
54
64
|
nodes?: Record<string, RunNodeRecord>;
|
|
55
65
|
}
|
|
56
|
-
|
|
66
|
+
export interface RecoverableWorkflowRun {
|
|
67
|
+
runId: string;
|
|
68
|
+
triggerType: string;
|
|
69
|
+
startedAt: string;
|
|
70
|
+
triggerPayload?: Record<string, unknown>;
|
|
71
|
+
}
|
|
57
72
|
export type RunHistorySummary = Omit<RunHistoryEntry, "nodes">;
|
|
58
73
|
/** Build per-node output previews (+ D33 trace stats) from a settled RunResult. */
|
|
59
74
|
export declare function buildNodeRecords(result: RunResult): Record<string, RunNodeRecord>;
|
|
60
75
|
export declare class WorkflowRunHistoryStore {
|
|
61
76
|
private readonly cwd;
|
|
77
|
+
private readonly mutationChains;
|
|
62
78
|
constructor(cwd: string);
|
|
63
79
|
/** Record a run start. Prepends a "running" entry and prunes to the bound. */
|
|
64
|
-
begin(workflowId: string, entry: Pick<RunHistoryEntry, "runId" | "triggerType" | "startedAt">
|
|
80
|
+
begin(workflowId: string, entry: Pick<RunHistoryEntry, "runId" | "triggerType" | "startedAt"> & {
|
|
81
|
+
triggerPayload?: Record<string, unknown>;
|
|
82
|
+
}): Promise<void>;
|
|
65
83
|
/** Settle a run entry (status/outputs/error). Unknown runId is a no-op (pruned entry). */
|
|
66
84
|
finish(workflowId: string, runId: string, patch: Partial<Pick<RunHistoryEntry, "status" | "finishedAt" | "durationMs" | "error" | "failedNodeId" | "nodes">>): Promise<void>;
|
|
85
|
+
/** Persist live node state so a refreshed/reconnected UI can reconstruct the active run. */
|
|
86
|
+
recordNodeStatus(workflowId: string, runId: string, nodeId: string, status: "running" | "completed" | "failed", error?: string): Promise<void>;
|
|
87
|
+
/** Append a redacted, user-facing execution stage for a running node. */
|
|
88
|
+
recordNodeActivity(workflowId: string, runId: string, nodeId: string, activity: Omit<RunNodeActivity, "ts"> & {
|
|
89
|
+
ts?: string;
|
|
90
|
+
}): Promise<void>;
|
|
67
91
|
/** Most-recent-first run summaries (no node outputs — those stay behind get()). */
|
|
68
92
|
list(workflowId: string): Promise<RunHistorySummary[]>;
|
|
69
93
|
/** Full entry incl. per-node output previews. */
|
|
70
94
|
get(workflowId: string, runId: string): Promise<RunHistoryEntry | undefined>;
|
|
95
|
+
/** Host-only view for reconstructing runs left in-flight by an abrupt process exit. */
|
|
96
|
+
recoverableRunning(workflowId: string): Promise<RecoverableWorkflowRun[]>;
|
|
97
|
+
/** Reclassify on read so historical records benefit from newer user-facing diagnostics. */
|
|
98
|
+
private withCurrentErrorInfo;
|
|
99
|
+
private waitForMutations;
|
|
100
|
+
private mutate;
|
|
71
101
|
private read;
|
|
72
102
|
private write;
|
|
73
103
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CapabilityEntry } from "./capability-catalog.js";
|
|
2
|
+
import type { WorkflowDef } from "./node-schema.js";
|
|
3
|
+
import type { TriggerDef } from "./workflow-patch.js";
|
|
4
|
+
import type { WorkflowIntentContract } from "./workflow-intent-contract.js";
|
|
5
|
+
export type WorkflowSemanticCheck = {
|
|
6
|
+
type: "trigger_type";
|
|
7
|
+
triggerType: TriggerDef["type"];
|
|
8
|
+
} | {
|
|
9
|
+
type: "capability_present";
|
|
10
|
+
capabilityId: string;
|
|
11
|
+
minCount?: number;
|
|
12
|
+
} | {
|
|
13
|
+
type: "node_kind_count";
|
|
14
|
+
kind: string;
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: "path";
|
|
19
|
+
from: string;
|
|
20
|
+
to: string;
|
|
21
|
+
ordered?: string[];
|
|
22
|
+
} | {
|
|
23
|
+
type: "terminal_kind";
|
|
24
|
+
kind: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: "param_equals";
|
|
27
|
+
node: string;
|
|
28
|
+
field: string;
|
|
29
|
+
value: unknown;
|
|
30
|
+
};
|
|
31
|
+
export interface WorkflowSemanticCriterion {
|
|
32
|
+
id: string;
|
|
33
|
+
description: string;
|
|
34
|
+
check: WorkflowSemanticCheck;
|
|
35
|
+
/** Optional evidence link; it does not turn an intent fact into a completion gate. */
|
|
36
|
+
intentFactId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface WorkflowSemanticAcceptance {
|
|
39
|
+
status: "passed" | "needs_attention";
|
|
40
|
+
passed: number;
|
|
41
|
+
total: number;
|
|
42
|
+
criteria: Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
description: string;
|
|
45
|
+
status: "passed" | "failed" | "unverified";
|
|
46
|
+
evidence: string;
|
|
47
|
+
intentFactId?: string;
|
|
48
|
+
}>;
|
|
49
|
+
/** Active conversational intent facts and whether a deterministic criterion supplied evidence. */
|
|
50
|
+
intentCoverage: Array<{
|
|
51
|
+
factId: string;
|
|
52
|
+
statement: string;
|
|
53
|
+
status: "verified" | "failed" | "unverified";
|
|
54
|
+
evidence: string;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
/** Flow-level semantic checks are evidence, not a save/finish hard gate. */
|
|
58
|
+
export declare function assessWorkflowSemantics(input: {
|
|
59
|
+
def: WorkflowDef;
|
|
60
|
+
trigger?: TriggerDef | null;
|
|
61
|
+
criteria?: WorkflowSemanticCriterion[];
|
|
62
|
+
catalog?: CapabilityEntry[];
|
|
63
|
+
aliases?: Record<string, string>;
|
|
64
|
+
intentContract?: WorkflowIntentContract;
|
|
65
|
+
}): WorkflowSemanticAcceptance;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CapabilityEntry } from "./capability-catalog.js";
|
|
2
|
+
import type { WorkflowDef } from "./node-schema.js";
|
|
3
|
+
import type { TriggerDef, WorkflowPatch } from "./workflow-patch.js";
|
|
4
|
+
export type WorkflowAuthoringOperation = {
|
|
5
|
+
op: "add";
|
|
6
|
+
key: string;
|
|
7
|
+
capabilityId: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
params?: Record<string, unknown>;
|
|
10
|
+
} | {
|
|
11
|
+
op: "insert_after";
|
|
12
|
+
after: string;
|
|
13
|
+
key: string;
|
|
14
|
+
capabilityId: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
params?: Record<string, unknown>;
|
|
17
|
+
} | {
|
|
18
|
+
op: "replace_capability";
|
|
19
|
+
nodeId: string;
|
|
20
|
+
capabilityId: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
params?: Record<string, unknown>;
|
|
23
|
+
} | {
|
|
24
|
+
op: "update";
|
|
25
|
+
nodeId: string;
|
|
26
|
+
params: Record<string, unknown>;
|
|
27
|
+
} | {
|
|
28
|
+
op: "rename";
|
|
29
|
+
nodeId: string;
|
|
30
|
+
name: string;
|
|
31
|
+
} | {
|
|
32
|
+
op: "remove";
|
|
33
|
+
nodeId: string;
|
|
34
|
+
} | {
|
|
35
|
+
op: "connect";
|
|
36
|
+
from: string;
|
|
37
|
+
to: string;
|
|
38
|
+
fromPort?: string;
|
|
39
|
+
toPort?: string;
|
|
40
|
+
} | {
|
|
41
|
+
op: "connect_path";
|
|
42
|
+
nodes: string[];
|
|
43
|
+
} | {
|
|
44
|
+
op: "disconnect";
|
|
45
|
+
from: string;
|
|
46
|
+
to: string;
|
|
47
|
+
fromPort?: string;
|
|
48
|
+
} | {
|
|
49
|
+
op: "set_trigger";
|
|
50
|
+
trigger: TriggerDef;
|
|
51
|
+
} | {
|
|
52
|
+
op: "set_node_options";
|
|
53
|
+
nodeId: string;
|
|
54
|
+
retry?: {
|
|
55
|
+
maxTries: number;
|
|
56
|
+
backoffMs?: number;
|
|
57
|
+
} | null;
|
|
58
|
+
timeoutMs?: number | null;
|
|
59
|
+
onError?: "stop" | "continue" | "errorPort" | null;
|
|
60
|
+
};
|
|
61
|
+
export interface CompiledWorkflowOperations {
|
|
62
|
+
patch: WorkflowPatch[];
|
|
63
|
+
aliasToNodeId: Record<string, string>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Compile the Agent's bounded authoring operations into the canonical WorkflowPatch protocol.
|
|
67
|
+
* Node kinds, capability references, parameter templates and collision-free ids are Host/catalog
|
|
68
|
+
* derived rather than freehand graph JSON.
|
|
69
|
+
*/
|
|
70
|
+
export declare function compileWorkflowOperations(input: {
|
|
71
|
+
operations: WorkflowAuthoringOperation[];
|
|
72
|
+
current: WorkflowDef;
|
|
73
|
+
catalog: CapabilityEntry[];
|
|
74
|
+
}): CompiledWorkflowOperations;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { type WorkflowDef } from "./node-schema.js";
|
|
7
7
|
import type { TriggerDef } from "./workflow-trigger.js";
|
|
8
8
|
import type { ConcurrencyPolicy, WorkflowRecord } from "./workflow-store.js";
|
|
9
|
+
import { type WorkflowTemplateSetupManifest } from "./workflow-template-setup.js";
|
|
9
10
|
export declare const WORKFLOW_BUNDLE_SCHEMA_VERSION = 3;
|
|
10
11
|
export interface CapabilityRequirement {
|
|
11
12
|
category: "agent" | "mcp" | "memory" | "channel";
|
|
@@ -24,6 +25,8 @@ export interface WorkflowBundle {
|
|
|
24
25
|
trigger?: TriggerDef;
|
|
25
26
|
concurrency?: ConcurrencyPolicy;
|
|
26
27
|
requires: CapabilityRequirement[];
|
|
28
|
+
/** Optional centralized setup form. Values and credentials are never serialized. */
|
|
29
|
+
setup?: WorkflowTemplateSetupManifest;
|
|
27
30
|
meta?: {
|
|
28
31
|
author?: string;
|
|
29
32
|
tags?: string[];
|
|
@@ -42,6 +45,7 @@ export interface ParsedBundle {
|
|
|
42
45
|
trigger?: TriggerDef;
|
|
43
46
|
concurrency?: ConcurrencyPolicy;
|
|
44
47
|
requires: CapabilityRequirement[];
|
|
48
|
+
setup?: WorkflowTemplateSetupManifest;
|
|
45
49
|
}
|
|
46
50
|
/** Parse and validate an incoming canonical bundle. */
|
|
47
51
|
export declare function fromWorkflowBundle(payload: unknown): ParsedBundle;
|
|
@@ -25,6 +25,7 @@ import type { WorkflowDef } from "./node-schema.js";
|
|
|
25
25
|
import { type PatchEnvelope, type WorkflowPatch } from "./workflow-patch.js";
|
|
26
26
|
import { type RenderOptions } from "./workflow-render.js";
|
|
27
27
|
import { WorkflowStore, type ConcurrencyPolicy, type WorkflowRecord } from "./workflow-store.js";
|
|
28
|
+
import { type WorkflowTemplateSetupManifest, type WorkflowTemplateSetupState } from "./workflow-template-setup.js";
|
|
28
29
|
import { type WorkflowRunHistoryStore } from "./run-history-store.js";
|
|
29
30
|
export interface TriggerEvent {
|
|
30
31
|
type: WorkflowTriggerKind;
|
|
@@ -78,6 +79,8 @@ export interface CreateInput {
|
|
|
78
79
|
active?: boolean;
|
|
79
80
|
/** Owning user (D38); the handler stamps resolveActiveOwnerUserId(). */
|
|
80
81
|
owner?: string;
|
|
82
|
+
setup?: WorkflowTemplateSetupManifest;
|
|
83
|
+
setupState?: WorkflowTemplateSetupState;
|
|
81
84
|
}
|
|
82
85
|
/** Result of a `patch()` call (spec §C `WorkflowToolResult`). */
|
|
83
86
|
export type PatchOutcome = {
|
|
@@ -105,7 +108,14 @@ export declare class WorkflowController {
|
|
|
105
108
|
* trigger path — manual RPC, cron scheduler, IM, webhook — is captured alike. */
|
|
106
109
|
runHistory?: WorkflowRunHistoryStore | undefined);
|
|
107
110
|
create(input: CreateInput): Promise<WorkflowRecord>;
|
|
108
|
-
update(id: string, patch: Partial<Pick<WorkflowRecord, "name" | "def" | "concurrency" | "active" | "permissionScope">>): Promise<WorkflowRecord>;
|
|
111
|
+
update(id: string, patch: Partial<Pick<WorkflowRecord, "name" | "def" | "concurrency" | "active" | "permissionScope" | "setup" | "setupState">>): Promise<WorkflowRecord>;
|
|
112
|
+
/** Apply all template answers to their node/trigger bindings in one CAS-protected revision. */
|
|
113
|
+
configureTemplate(id: string, input: {
|
|
114
|
+
baseRev: number;
|
|
115
|
+
values: Record<string, unknown>;
|
|
116
|
+
}): Promise<PatchOutcome & {
|
|
117
|
+
missingRequired?: string[];
|
|
118
|
+
}>;
|
|
109
119
|
setActive(id: string, active: boolean): Promise<WorkflowRecord>;
|
|
110
120
|
/**
|
|
111
121
|
* Publish (D31): snapshot the current draft (`def`) as the version triggers execute.
|
|
@@ -122,9 +132,9 @@ export declare class WorkflowController {
|
|
|
122
132
|
*/
|
|
123
133
|
revertTo(id: string, rev: number): Promise<WorkflowRecord>;
|
|
124
134
|
/**
|
|
125
|
-
* Import an n8n workflow JSON
|
|
126
|
-
*
|
|
127
|
-
*
|
|
135
|
+
* Import an n8n workflow JSON into the single store. Native mappings stay native; compatible
|
|
136
|
+
* installed ecosystem nodes are resolved by the Host, while unsupported nodes remain explicit
|
|
137
|
+
* fail-loud placeholders. Every graph still passes the same canonical write validation.
|
|
128
138
|
*/
|
|
129
139
|
importN8n(id: string, json: string | unknown, opts?: {
|
|
130
140
|
concurrency?: ConcurrencyPolicy;
|
|
@@ -156,6 +166,8 @@ export declare class WorkflowController {
|
|
|
156
166
|
run(id: string, trigger?: TriggerEvent, opts?: {
|
|
157
167
|
recordHistory?: boolean;
|
|
158
168
|
reuseCache?: boolean;
|
|
169
|
+
/** Host-only crash recovery: preserve the original run identity and history row. */
|
|
170
|
+
recoverRunId?: string;
|
|
159
171
|
onStarted?: (run: WorkflowRunStarted) => void | Promise<void>;
|
|
160
172
|
}): Promise<RunOutcome>;
|
|
161
173
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CapabilityEntry } from "./capability-catalog.js";
|
|
2
|
+
import type { WorkflowDef, WorkflowNodeDef } from "./node-schema.js";
|
|
3
|
+
import type { TriggerDef } from "./workflow-patch.js";
|
|
4
|
+
export interface WorkflowEditContextCapsule {
|
|
5
|
+
workflowId: string;
|
|
6
|
+
trigger?: TriggerDef | null;
|
|
7
|
+
selectedNodeIds: string[];
|
|
8
|
+
nodes: WorkflowNodeDef[];
|
|
9
|
+
edges: WorkflowDef["edges"];
|
|
10
|
+
omittedNodeCount: number;
|
|
11
|
+
lineage: Record<string, {
|
|
12
|
+
upstream: Array<{
|
|
13
|
+
nodeId: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
fields: string[];
|
|
16
|
+
expressionExamples: string[];
|
|
17
|
+
}>;
|
|
18
|
+
}>;
|
|
19
|
+
latestRun?: {
|
|
20
|
+
status: string;
|
|
21
|
+
failedNodeId?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
nodeEvidence: Array<{
|
|
24
|
+
nodeId: string;
|
|
25
|
+
preview?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface WorkflowRunEvidence {
|
|
31
|
+
status: string;
|
|
32
|
+
failedNodeId?: string;
|
|
33
|
+
error?: string;
|
|
34
|
+
nodes?: Record<string, {
|
|
35
|
+
preview?: string;
|
|
36
|
+
error?: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export declare function buildWorkflowEditContextCapsule(input: {
|
|
40
|
+
def: WorkflowDef;
|
|
41
|
+
trigger?: TriggerDef | null;
|
|
42
|
+
scope?: string[];
|
|
43
|
+
catalog?: CapabilityEntry[];
|
|
44
|
+
latestRun?: WorkflowRunEvidence;
|
|
45
|
+
maxNodes?: number;
|
|
46
|
+
}): WorkflowEditContextCapsule;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversation-owned Workflow intent ledger.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately not an acceptance gate: it has no ready/complete/pass field and is never consulted
|
|
5
|
+
* to decide whether a proposal may be saved or whether an Agent turn may finish. It preserves
|
|
6
|
+
* exact user observations plus a revisable interpretation so incomplete conversations work.
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkflowIntentObservation {
|
|
9
|
+
id: string;
|
|
10
|
+
sequence: number;
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowIntentFact {
|
|
14
|
+
id: string;
|
|
15
|
+
statement: string;
|
|
16
|
+
confidence: "explicit" | "inferred";
|
|
17
|
+
sourceObservationIds: string[];
|
|
18
|
+
status: "active" | "superseded";
|
|
19
|
+
}
|
|
20
|
+
export interface WorkflowIntentQuestion {
|
|
21
|
+
id: string;
|
|
22
|
+
question: string;
|
|
23
|
+
sourceObservationIds: string[];
|
|
24
|
+
status: "open" | "resolved";
|
|
25
|
+
}
|
|
26
|
+
export interface WorkflowIntentContract {
|
|
27
|
+
revision: number;
|
|
28
|
+
observations: WorkflowIntentObservation[];
|
|
29
|
+
facts: WorkflowIntentFact[];
|
|
30
|
+
openQuestions: WorkflowIntentQuestion[];
|
|
31
|
+
diagnostics: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface WorkflowIntentDelta {
|
|
34
|
+
upsertFacts?: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
confidence: "explicit" | "inferred";
|
|
38
|
+
sourceObservationIds: string[];
|
|
39
|
+
}>;
|
|
40
|
+
supersedeFactIds?: string[];
|
|
41
|
+
upsertQuestions?: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
question: string;
|
|
44
|
+
sourceObservationIds: string[];
|
|
45
|
+
}>;
|
|
46
|
+
resolveQuestionIds?: string[];
|
|
47
|
+
}
|
|
48
|
+
export declare function evolveWorkflowIntentContract(input: {
|
|
49
|
+
previous: WorkflowIntentContract | null | undefined;
|
|
50
|
+
newTurns: Array<{
|
|
51
|
+
sequence: number;
|
|
52
|
+
role: "user" | "assistant";
|
|
53
|
+
content: string;
|
|
54
|
+
}>;
|
|
55
|
+
delta?: WorkflowIntentDelta | null;
|
|
56
|
+
}): WorkflowIntentContract;
|
|
@@ -91,6 +91,13 @@ export interface PatchEnvelope {
|
|
|
91
91
|
export interface ApplyResult {
|
|
92
92
|
target: PatchTarget;
|
|
93
93
|
applied: WorkflowPatch[];
|
|
94
|
+
/** Non-blocking facts about pre-existing defects outside a scoped edit. */
|
|
95
|
+
diagnostics: WorkflowPatchDiagnostic[];
|
|
96
|
+
}
|
|
97
|
+
export interface WorkflowPatchDiagnostic {
|
|
98
|
+
classification: "preexisting";
|
|
99
|
+
nodeId: string;
|
|
100
|
+
message: string;
|
|
94
101
|
}
|
|
95
102
|
/** Thrown when a patch is rejected. `errors` is the ordered list of reasons (for self-correction). */
|
|
96
103
|
export declare class PatchError extends Error {
|
|
@@ -82,6 +82,8 @@ export interface WorkflowRuntimeOptions {
|
|
|
82
82
|
trigger?: Record<string, unknown>;
|
|
83
83
|
/** This run's trigger KIND (manual/schedule/…) — exposed on ExecutorContext for IT-7b audits. */
|
|
84
84
|
triggerKind?: string;
|
|
85
|
+
/** Durable run identity exposed to Host-backed node executors. */
|
|
86
|
+
runId?: string;
|
|
85
87
|
log?: {
|
|
86
88
|
info(m: string): void;
|
|
87
89
|
warn(m: string): void;
|
|
@@ -108,6 +110,7 @@ export declare class WorkflowRuntime {
|
|
|
108
110
|
private readonly now;
|
|
109
111
|
private readonly trigger?;
|
|
110
112
|
private readonly triggerKind?;
|
|
113
|
+
private readonly runId?;
|
|
111
114
|
private readonly log?;
|
|
112
115
|
private readonly host?;
|
|
113
116
|
private readonly abortController?;
|
|
@@ -115,6 +118,8 @@ export declare class WorkflowRuntime {
|
|
|
115
118
|
private readonly checkpoint?;
|
|
116
119
|
private readonly preserveCheckpoint;
|
|
117
120
|
private readonly onNodeStatus?;
|
|
121
|
+
/** Serializes snapshots so an older slow write cannot land after a newer parallel-node write. */
|
|
122
|
+
private checkpointWriteChain;
|
|
118
123
|
private dag;
|
|
119
124
|
private readonly nodeDefs;
|
|
120
125
|
private readonly nodeOutputs;
|
|
@@ -28,6 +28,13 @@ export declare const systemClock: SchedulerClock;
|
|
|
28
28
|
export interface SchedulerDeps {
|
|
29
29
|
controller: WorkflowController;
|
|
30
30
|
clock?: SchedulerClock;
|
|
31
|
+
/**
|
|
32
|
+
* Product-level timezone for legacy schedule records that predate an explicit timezone.
|
|
33
|
+
* The reusable engine remains UTC by default; desktop hosts should pass the user's system zone.
|
|
34
|
+
*/
|
|
35
|
+
defaultTimezone?: string;
|
|
36
|
+
/** Latest durable scheduled-run start, used to detect one missed slot after a cold restart. */
|
|
37
|
+
getLastScheduledAt?: (workflowId: string) => Promise<number | undefined>;
|
|
31
38
|
/**
|
|
32
39
|
* Surfaces an error from a timer-driven (cron) run, which has no caller to throw back to.
|
|
33
40
|
* Required so a failed unattended run is never silently swallowed (§1.5 fail-loud). Caller-driven
|
|
@@ -48,6 +55,8 @@ export interface SchedulerDeps {
|
|
|
48
55
|
onTriggerDropped?: (workflowId: string, triggerType: string, detail: {
|
|
49
56
|
sinceLastMs: number;
|
|
50
57
|
minIntervalMs: number;
|
|
58
|
+
reason?: "rate-limit" | "misfire";
|
|
59
|
+
scheduledAt?: number;
|
|
51
60
|
}) => void;
|
|
52
61
|
}
|
|
53
62
|
export declare class WorkflowScheduler {
|
|
@@ -57,6 +66,8 @@ export declare class WorkflowScheduler {
|
|
|
57
66
|
private readonly onRunStarted?;
|
|
58
67
|
private readonly onRunCompleted?;
|
|
59
68
|
private readonly onRunFailed?;
|
|
69
|
+
private readonly defaultTimezone;
|
|
70
|
+
private readonly getLastScheduledAt?;
|
|
60
71
|
/** Every registered workflow's trigger, keyed by id (the single source for lookups). */
|
|
61
72
|
private readonly triggers;
|
|
62
73
|
/** Active cron arms keyed by workflow id. */
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { WorkflowDef } from "./node-schema.js";
|
|
11
11
|
import type { TriggerDef } from "./workflow-patch.js";
|
|
12
|
+
import type { WorkflowTemplateSetupManifest, WorkflowTemplateSetupState } from "./workflow-template-setup.js";
|
|
12
13
|
/** What to do when a workflow is triggered while a previous run is still in-flight (spec §B5). */
|
|
13
14
|
export type ConcurrencyPolicy = "queue" | "skip" | "parallel";
|
|
14
15
|
export interface WorkflowRecord {
|
|
@@ -22,6 +23,10 @@ export interface WorkflowRecord {
|
|
|
22
23
|
concurrency: ConcurrencyPolicy;
|
|
23
24
|
/** The workflow's trigger (set via a WorkflowPatch set_trigger op; spec §C/D7). */
|
|
24
25
|
trigger?: TriggerDef | null;
|
|
26
|
+
/** Portable, credential-free inputs shown in the import/template setup panel. */
|
|
27
|
+
setup?: WorkflowTemplateSetupManifest;
|
|
28
|
+
/** Non-secret answers and opaque connection references applied from `setup`. */
|
|
29
|
+
setupState?: WorkflowTemplateSetupState;
|
|
25
30
|
/**
|
|
26
31
|
* Unattended-run capability grant (spec D30, IT-7): sensitive node kinds this workflow may
|
|
27
32
|
* execute under unattended triggers (schedule/im/webhook). Granted explicitly by the owner
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { WorkflowDef } from "./node-schema.js";
|
|
2
|
+
import type { TriggerDef } from "./workflow-trigger.js";
|
|
3
|
+
export type WorkflowTemplateSetupValue = string | number | boolean;
|
|
4
|
+
export interface WorkflowTemplateSetupOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
export interface WorkflowTemplateSetupField {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
group?: string;
|
|
13
|
+
type: "text" | "textarea" | "url" | "number" | "boolean" | "select" | "connection";
|
|
14
|
+
required?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
defaultValue?: WorkflowTemplateSetupValue;
|
|
17
|
+
options?: WorkflowTemplateSetupOption[];
|
|
18
|
+
/** Capability/provider family used to filter installed connections. */
|
|
19
|
+
connectionType?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface WorkflowTemplateSetupBinding {
|
|
22
|
+
fieldId: string;
|
|
23
|
+
target: {
|
|
24
|
+
kind: "node";
|
|
25
|
+
nodeId: string;
|
|
26
|
+
path: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "trigger";
|
|
29
|
+
path: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface WorkflowTemplateSetupManifest {
|
|
33
|
+
version: 1;
|
|
34
|
+
title?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
fields: WorkflowTemplateSetupField[];
|
|
37
|
+
bindings: WorkflowTemplateSetupBinding[];
|
|
38
|
+
}
|
|
39
|
+
export interface WorkflowTemplateSetupState {
|
|
40
|
+
values: Record<string, WorkflowTemplateSetupValue>;
|
|
41
|
+
updatedAt?: string;
|
|
42
|
+
completedAt?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface WorkflowTemplateSetupProjection {
|
|
45
|
+
manifest: WorkflowTemplateSetupManifest;
|
|
46
|
+
values: Record<string, WorkflowTemplateSetupValue>;
|
|
47
|
+
status: "pending" | "complete";
|
|
48
|
+
missingRequired: string[];
|
|
49
|
+
}
|
|
50
|
+
export declare function validateWorkflowTemplateSetup(value: unknown, def: WorkflowDef): WorkflowTemplateSetupManifest;
|
|
51
|
+
export declare function projectWorkflowTemplateSetup(manifest: WorkflowTemplateSetupManifest, state?: WorkflowTemplateSetupState): WorkflowTemplateSetupProjection;
|
|
52
|
+
export declare function applyWorkflowTemplateSetup(definition: WorkflowDef, trigger: TriggerDef | null | undefined, manifest: WorkflowTemplateSetupManifest, previous: WorkflowTemplateSetupState | undefined, input: Record<string, unknown>, now?: string): {
|
|
53
|
+
def: WorkflowDef;
|
|
54
|
+
trigger?: TriggerDef | null;
|
|
55
|
+
state: WorkflowTemplateSetupState;
|
|
56
|
+
missingRequired: string[];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Reset every setup-bound destination before a workflow leaves the local Host.
|
|
60
|
+
* The manifest travels with the bundle; user answers and opaque connection ids do not.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resetWorkflowTemplateSetupBindings(definition: WorkflowDef, trigger: TriggerDef | null | undefined, manifest: WorkflowTemplateSetupManifest): {
|
|
63
|
+
def: WorkflowDef;
|
|
64
|
+
trigger?: TriggerDef | null;
|
|
65
|
+
};
|
|
@@ -4,6 +4,10 @@ export type TriggerDef = {
|
|
|
4
4
|
} | {
|
|
5
5
|
type: "schedule";
|
|
6
6
|
cron: string;
|
|
7
|
+
/** IANA timezone used to interpret the cron wall clock. Missing legacy values remain UTC. */
|
|
8
|
+
timezone?: string;
|
|
9
|
+
/** Desktop sleep/wake behavior. A late timer never replays every missed slot. */
|
|
10
|
+
misfirePolicy?: "run-once" | "skip";
|
|
7
11
|
} | {
|
|
8
12
|
type: "im-message";
|
|
9
13
|
channel: string;
|