qlogicagent 2.20.1 → 2.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/agent-contract.js +1 -1
  2. package/dist/agent.js +39 -35
  3. package/dist/cli.js +1 -1
  4. package/dist/host-contract.js +1 -1
  5. package/dist/host-session-collection-contract.js +1 -1
  6. package/dist/index.js +624 -549
  7. package/dist/memory-category-contract.js +1 -0
  8. package/dist/orchestration.js +1 -1
  9. package/dist/project-memory-host.js +21 -21
  10. package/dist/protocol.js +1 -1
  11. package/dist/skill-category-contract.js +1 -0
  12. package/dist/skills/builtin/web-research/SKILL.md +37 -0
  13. package/dist/skills/mcp/astraclaw-native-mcp-server.js +1 -1
  14. package/dist/tunables.js +1 -1
  15. package/dist/types/agent/memory-recall-context.d.ts +6 -9
  16. package/dist/types/agent/memory-recall-injection.d.ts +1 -6
  17. package/dist/types/agent/tool-loop/agent-argument-normalizer.d.ts +12 -0
  18. package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +8 -0
  19. package/dist/types/agent/tool-loop.d.ts +5 -0
  20. package/dist/types/agent/types.d.ts +5 -0
  21. package/dist/types/cli/acp-extended-handlers.d.ts +11 -9
  22. package/dist/types/cli/acp-session-handlers.d.ts +1 -1
  23. package/dist/types/cli/acp-session-host.d.ts +8 -0
  24. package/dist/types/cli/agent-runtime-bootstrap.d.ts +7 -1
  25. package/dist/types/cli/agent-runtime-session-state.d.ts +23 -6
  26. package/dist/types/cli/atomic-text-file.d.ts +31 -0
  27. package/dist/types/cli/background-context-capsule.d.ts +12 -0
  28. package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
  29. package/dist/types/cli/cli-acp-request-handler.d.ts +3 -1
  30. package/dist/types/cli/community-workflow-installer.d.ts +1 -1
  31. package/dist/types/cli/core-tool-coordinator.d.ts +1 -0
  32. package/dist/types/cli/core-tools/agent-tool-service.d.ts +17 -1
  33. package/dist/types/cli/dev-tool-bootstrap.d.ts +3 -2
  34. package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +1 -0
  35. package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +3 -1
  36. package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +81 -0
  37. package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +59 -0
  38. package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +2 -0
  39. package/dist/types/cli/handlers/dream-handler.d.ts +1 -1
  40. package/dist/types/cli/handlers/memory-handler.d.ts +2 -14
  41. package/dist/types/cli/handlers/product-handler.d.ts +6 -24
  42. package/dist/types/cli/handlers/turn-handler.d.ts +1 -0
  43. package/dist/types/cli/idle-dream-coordinator.d.ts +9 -5
  44. package/dist/types/cli/memory-background-coordinator.d.ts +26 -0
  45. package/dist/types/cli/memory-candidate-service.d.ts +2 -3
  46. package/dist/types/cli/memory-coordinator.d.ts +12 -8
  47. package/dist/types/cli/permission-bootstrap.d.ts +10 -1
  48. package/dist/types/cli/product-acp-params.d.ts +29 -0
  49. package/dist/types/cli/resolved-agent-cache.d.ts +18 -7
  50. package/dist/types/cli/rpc-registry.d.ts +2 -1
  51. package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
  52. package/dist/types/cli/stdio-acp-request-host.d.ts +7 -4
  53. package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +8 -2
  54. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -2
  55. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
  56. package/dist/types/cli/stdio-server.d.ts +49 -16
  57. package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -2
  58. package/dist/types/cli/task-distillation-coordinator.d.ts +42 -14
  59. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +14 -4
  60. package/dist/types/cli/tool-bootstrap.d.ts +2 -1
  61. package/dist/types/cli/turn-core.d.ts +4 -0
  62. package/dist/types/cli/turn-lifecycle.d.ts +1 -0
  63. package/dist/types/contracts/hooks.d.ts +3 -2
  64. package/dist/types/contracts/turn-event.d.ts +7 -0
  65. package/dist/types/host-contract/index.d.ts +111 -12
  66. package/dist/types/host-contract/memory-category.d.ts +8 -0
  67. package/dist/types/host-contract/skill-category.d.ts +5 -0
  68. package/dist/types/host-session-collection-contract.d.ts +1 -0
  69. package/dist/types/orchestration/agent-instance.d.ts +15 -0
  70. package/dist/types/orchestration/dag-scheduler.d.ts +18 -0
  71. package/dist/types/orchestration/delegate-approval-policy.d.ts +8 -0
  72. package/dist/types/orchestration/goal-acceptance.d.ts +2 -5
  73. package/dist/types/orchestration/goal-loop-coordinator.d.ts +4 -2
  74. package/dist/types/orchestration/goal-mode-adapters.d.ts +16 -0
  75. package/dist/types/orchestration/goal-run-types.d.ts +6 -1
  76. package/dist/types/orchestration/product-budget.d.ts +35 -16
  77. package/dist/types/orchestration/product-persistence.d.ts +5 -14
  78. package/dist/types/orchestration/product-planner.d.ts +38 -0
  79. package/dist/types/orchestration/product-worktree.d.ts +4 -2
  80. package/dist/types/orchestration/solo-evaluator.d.ts +42 -2
  81. package/dist/types/orchestration/solo-spec-builder.d.ts +3 -0
  82. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +6 -0
  83. package/dist/types/orchestration/testing/run-state-client-double.d.ts +13 -0
  84. package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +3 -0
  85. package/dist/types/orchestration/workflow/capability-catalog.d.ts +31 -0
  86. package/dist/types/orchestration/workflow/cron-schedule.d.ts +3 -4
  87. package/dist/types/orchestration/workflow/expression.d.ts +2 -1
  88. package/dist/types/orchestration/workflow/n8n-import.d.ts +3 -0
  89. package/dist/types/orchestration/workflow/node-registry.d.ts +2 -2
  90. package/dist/types/orchestration/workflow/node-schema.d.ts +20 -4
  91. package/dist/types/orchestration/workflow/params-schema.d.ts +7 -6
  92. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +4 -1
  93. package/dist/types/orchestration/workflow/run-history-store.d.ts +33 -3
  94. package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +65 -0
  95. package/dist/types/orchestration/workflow/workflow-authoring.d.ts +74 -0
  96. package/dist/types/orchestration/workflow/workflow-bundle.d.ts +4 -0
  97. package/dist/types/orchestration/workflow/workflow-controller.d.ts +16 -4
  98. package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +46 -0
  99. package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +56 -0
  100. package/dist/types/orchestration/workflow/workflow-patch.d.ts +7 -0
  101. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +5 -0
  102. package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +11 -0
  103. package/dist/types/orchestration/workflow/workflow-store.d.ts +5 -0
  104. package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +65 -0
  105. package/dist/types/orchestration/workflow/workflow-trigger.d.ts +4 -0
  106. package/dist/types/orchestration/workflow-chat-builder.d.ts +105 -20
  107. package/dist/types/orchestration/worktree-task-prompt.d.ts +1 -0
  108. package/dist/types/protocol/agent-contract.d.ts +49 -8
  109. package/dist/types/protocol/notifications.d.ts +1 -1
  110. package/dist/types/protocol/wire/acp-agent-management.d.ts +97 -9
  111. package/dist/types/protocol/wire/acp-protocol.d.ts +7 -1
  112. package/dist/types/protocol/wire/agent-methods.d.ts +15 -1
  113. package/dist/types/protocol/wire/index.d.ts +2 -4
  114. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +1 -39
  115. package/dist/types/protocol/wire/notification-payloads.d.ts +96 -1
  116. package/dist/types/protocol/wire/web-capability.d.ts +2 -2
  117. package/dist/types/runtime/config/tunable-defaults.d.ts +0 -6
  118. package/dist/types/runtime/execution/bounded-output-tail.d.ts +7 -0
  119. package/dist/types/runtime/execution/dream-agent.d.ts +8 -5
  120. package/dist/types/runtime/execution/dream-category-context.d.ts +3 -3
  121. package/dist/types/runtime/execution/structured-tool-progress.d.ts +21 -0
  122. package/dist/types/runtime/hooks/memory-hooks.d.ts +20 -8
  123. package/dist/types/runtime/infra/background-tasks.d.ts +5 -1
  124. package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +32 -0
  125. package/dist/types/runtime/infra/turn-telemetry-store.d.ts +22 -0
  126. package/dist/types/runtime/memory/implicit-extraction.d.ts +23 -7
  127. package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -5
  128. package/dist/types/runtime/ports/index.d.ts +2 -3
  129. package/dist/types/runtime/ports/memory-provider.d.ts +31 -16
  130. package/dist/types/runtime/ports/memory-writer.d.ts +55 -6
  131. package/dist/types/runtime/ports/permission-contracts.d.ts +2 -0
  132. package/dist/types/runtime/ports/tool-contracts.d.ts +3 -1
  133. package/dist/types/runtime/prompt/identity-section.d.ts +2 -0
  134. package/dist/types/runtime/session/session-permission-store.d.ts +6 -0
  135. package/dist/types/runtime/tasks/task-types.d.ts +2 -0
  136. package/dist/types/skills/memory/host-memory-provider.d.ts +59 -9
  137. package/dist/types/skills/memory/memory-tool.d.ts +3 -1
  138. package/dist/types/skills/memory/task-distillation.d.ts +22 -3
  139. package/dist/types/skills/permissions/hook-runner.d.ts +8 -0
  140. package/dist/types/skills/permissions/operation-classifier.d.ts +7 -0
  141. package/dist/types/skills/skill-system/skill-category.d.ts +10 -0
  142. package/dist/types/skills/tools/agent-tool.d.ts +13 -21
  143. package/dist/types/skills/tools/edit-tool.d.ts +10 -2
  144. package/dist/types/skills/tools/exec-tool.d.ts +2 -2
  145. package/dist/types/skills/tools/file-text-snapshot.d.ts +24 -0
  146. package/dist/types/skills/tools/lsp-tool.d.ts +1 -1
  147. package/dist/types/skills/tools/patch-tool.d.ts +10 -3
  148. package/dist/types/skills/tools/read-tool.d.ts +23 -1
  149. package/dist/types/skills/tools/repo-map-tool.d.ts +52 -0
  150. package/dist/types/skills/tools/search-tool.d.ts +10 -1
  151. package/dist/types/skills/tools/shell/index.d.ts +1 -2
  152. package/dist/types/skills/tools/shell/shell-command.d.ts +1 -1
  153. package/dist/types/skills/tools/shell/shell-exec.d.ts +2 -2
  154. package/dist/types/skills/tools/shell/task-output.d.ts +12 -3
  155. package/dist/types/skills/tools/subagent-decision-tool.d.ts +15 -0
  156. package/dist/types/skills/tools/task-tool.d.ts +16 -2
  157. package/dist/types/skills/tools/write-tool.d.ts +2 -1
  158. package/dist/types/transport/acp-server.d.ts +1 -0
  159. package/dist/types/transport/host-run-state-client.d.ts +6 -0
  160. package/dist/types/workflow-host.d.ts +8 -1
  161. package/dist/workflow-host.js +9 -9
  162. package/package.json +25 -6
  163. package/dist/types/cli/tool-bootstrap-web-registration.d.ts +0 -14
  164. package/dist/types/orchestration/tool-cascade.d.ts +0 -49
  165. package/dist/types/protocol/wire/channel-ingress.d.ts +0 -29
  166. package/dist/types/protocol/wire/channel.d.ts +0 -89
  167. package/dist/types/runtime/infra/native-mcp-config-sync.d.ts +0 -16
  168. package/dist/types/runtime/memory/categories.d.ts +0 -5
  169. package/dist/types/runtime/memory/recall-category-filter.d.ts +0 -42
  170. package/dist/types/runtime/ports/source-provider.d.ts +0 -39
  171. package/dist/types/runtime/ports/web-search-contracts.d.ts +0 -21
  172. package/dist/types/server/search-svc.d.ts +0 -1
  173. package/dist/types/skills/memory/local-embedding.d.ts +0 -80
  174. package/dist/types/skills/memory/memory-config-resolver.d.ts +0 -4
  175. package/dist/types/skills/memory/memory-embedding-config.d.ts +0 -31
  176. package/dist/types/skills/tools/web-answer-tool.d.ts +0 -27
  177. package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -80
  178. package/dist/types/skills/tools/web-research-tool.d.ts +0 -48
  179. package/dist/types/skills/tools/web-search-tool.d.ts +0 -46
  180. package/dist/types/skills/web-search/brave-source.d.ts +0 -3
  181. package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +0 -16
  182. package/dist/types/skills/web-search/embedding-rerank.d.ts +0 -13
  183. package/dist/types/skills/web-search/exa-source.d.ts +0 -3
  184. package/dist/types/skills/web-search/multi-source-backend.d.ts +0 -23
  185. package/dist/types/skills/web-search/redis-source-cache.d.ts +0 -6
  186. package/dist/types/skills/web-search/search-svc-source.d.ts +0 -5
  187. package/dist/types/skills/web-search/searxng-source.d.ts +0 -4
  188. package/dist/types/skills/web-search/serper-source.d.ts +0 -3
  189. package/dist/types/skills/web-search/source-factory.d.ts +0 -6
  190. package/dist/types/skills/web-search/stability.d.ts +0 -26
  191. package/dist/types/skills/web-search/web-tunable-resolver.d.ts +0 -16
@@ -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 (read-format only, plan M5 §2.1) into the single store. Converts
126
- * via the deterministic translator then routes through `create`, so the graph passes the same
127
- * `validateWorkflowDef` gate every write path uses fail-loud on unsupported nodes or bad graph.
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;
@@ -2,25 +2,89 @@
2
2
  * Workflow Chat Builder (M4) — 自动化页"意图先行"的对话搭图/改图(D18/D17)。
3
3
  *
4
4
  * 与 solo-spec-builder.runSpecChatRound 同构:进程内 runForkedAgent + 受限工具,纯推理产出,
5
- * 不直接落库。区别:产出的是 **工作流提案**——新建给完整 WorkflowDef,改已有给 WorkflowPatch[]。
6
- * 应用由调用方(前端经既有 workflow.create/patch RPC,触发 WS 回流画布)完成,故本轮无副作用、
7
- * 也无需访问引擎控制器。
5
+ * 不直接落库。Agent 只提交有界 authoring operations;确定性编译器根据 Host 能力目录生成
6
+ * WorkflowPatch[]、dry-run 并产生流程级验收证据。应用仍由 Runtime Host 原子完成。
8
7
  */
9
8
  import type { ForkedAgentRunnerFactory } from "../runtime/ports/agent-execution-contracts.js";
10
9
  import type { LLMTransport } from "../runtime/ports/index.js";
11
- import type { ToolDefinition, AgentLogger } from "../agent/types.js";
10
+ import type { ChatMessage, ToolDefinition, AgentLogger } from "../agent/types.js";
11
+ import { type WorkflowPatch } from "./workflow/workflow-patch.js";
12
12
  import { type CapabilityEntry } from "./workflow/capability-catalog.js";
13
- /** agent 通过此工具产出工作流提案:新建给 def,改已有给 patch。 */
13
+ import { type WorkflowIntentContract } from "./workflow/workflow-intent-contract.js";
14
+ import type { WorkflowEditContextCapsule } from "./workflow/workflow-edit-context.js";
15
+ import { type WorkflowSemanticAcceptance } from "./workflow/semantic-acceptance.js";
16
+ export interface WorkflowClarification {
17
+ /** Host-roundtrip id for deterministically resolving this open question after an answer. */
18
+ intentQuestionId?: string;
19
+ /** Stable semantic id supplied by the Agent when the question is not tied to one field. */
20
+ id?: string;
21
+ /** Why this choice is useful; transported for telemetry/context, never interpreted as a gate. */
22
+ purpose?: string;
23
+ /** Optional field target for __ASK__ replacement flows. */
24
+ nodeId?: string;
25
+ field?: string;
26
+ header: string;
27
+ question: string;
28
+ options?: Array<{
29
+ label: string;
30
+ description?: string;
31
+ }>;
32
+ multiSelect?: boolean;
33
+ }
34
+ export interface WorkflowChatContextCheckpoint {
35
+ protocolVersion: 1;
36
+ producer: "qlogicagent";
37
+ payload: {
38
+ messages: {
39
+ role: "user" | "assistant";
40
+ content: string;
41
+ }[];
42
+ intentContract?: WorkflowIntentContract;
43
+ };
44
+ }
45
+ export interface WorkflowChatContextInput {
46
+ checkpoint: WorkflowChatContextCheckpoint | null;
47
+ newTurns: Array<{
48
+ sequence: number;
49
+ role: "user" | "assistant";
50
+ content: string;
51
+ }>;
52
+ }
53
+ type WorkflowChatContextMessage = {
54
+ role: "user" | "assistant";
55
+ content: string;
56
+ };
57
+ export declare function buildWorkflowChatPromptContext(input: {
58
+ context?: WorkflowChatContextInput;
59
+ history?: {
60
+ role: "user" | "assistant";
61
+ content: string;
62
+ }[];
63
+ model: string;
64
+ budgetTokens?: number;
65
+ }): {
66
+ promptMessages: ChatMessage[];
67
+ checkpointMessages: WorkflowChatContextMessage[];
68
+ };
69
+ /** Agent emits bounded authoring operations; the deterministic compiler owns graph JSON. */
14
70
  export declare const PROPOSE_WORKFLOW_TOOL_NAME = "propose_workflow";
15
71
  export declare const PROPOSE_WORKFLOW_TOOL_DEF: ToolDefinition;
16
- /** 单轮入参。history 含到本轮为止的完整对话(末条为用户最新消息)。currentWorkflow 为已有图的渲染文本(改图上下文)。
17
- * v1 不带 ask_user(不反问;直接用默认搭,用户再说一句改),故澄清往返的网关路由也无需接。 */
72
+ /** Structured clarification transport only. It does not decide whether asking is required. */
73
+ export declare const REQUEST_WORKFLOW_INPUT_TOOL_NAME = "request_workflow_input";
74
+ export declare const REQUEST_WORKFLOW_INPUT_TOOL_DEF: ToolDefinition;
75
+ /** 单轮入参。Runtime Host 传 checkpoint + 新消息;history 只服务不写主对话的 ephemeral 局部编辑。
76
+ * currentWorkflow 为已有图的渲染文本(改图上下文)。 */
18
77
  export interface WorkflowChatDeps {
19
- history: {
78
+ context?: WorkflowChatContextInput;
79
+ /** Answered clarification ids from the transport; resolves evidence only and never ends the task. */
80
+ resolvedClarificationIds?: string[];
81
+ history?: {
20
82
  role: "user" | "assistant";
21
83
  content: string;
22
84
  }[];
23
85
  currentWorkflow?: string;
86
+ /** Host-built bounded prompt context. The full graph remains private compiler input. */
87
+ editContext?: WorkflowEditContextCapsule;
24
88
  /** D19 框选局部修改:用户框选的节点 id;非空时指示 agent 只产出 scoped patch(引擎按同 scope 强制)。 */
25
89
  scope?: string[];
26
90
  /**
@@ -29,18 +93,32 @@ export interface WorkflowChatDeps {
29
93
  * 校验回环拒绝引用目录外能力(反幻觉)。缺省(无目录)时退回静态 kind 说明、不做 ref 校验。
30
94
  */
31
95
  catalog?: CapabilityEntry[];
96
+ /** Automation-only Host tools. Omitted entirely outside workflow configuration. */
97
+ connectorTools?: ToolDefinition[];
98
+ invokeConnectorTool?: (name: string, args: Record<string, unknown>) => Promise<unknown>;
32
99
  transport: LLMTransport;
33
100
  apiKey: string;
34
101
  model: string;
35
102
  createAgentRunner: ForkedAgentRunnerFactory;
36
103
  log: AgentLogger;
37
104
  parentSignal?: AbortSignal;
105
+ /** Test seam for deterministic forced compaction. Production uses the model-derived budget. */
106
+ contextBudgetTokens?: number;
38
107
  }
39
108
  export interface WorkflowChatResult {
40
109
  reply: string;
41
- def?: Record<string, unknown>;
42
- patch?: unknown[];
43
- trigger?: Record<string, unknown>;
110
+ proposal?: {
111
+ patch: WorkflowPatch[];
112
+ };
113
+ /**
114
+ * A valid partial proposal can coexist with a later rejected refinement. The Host still applies
115
+ * the validated patch, while the UI receives the actual rejected diagnostics instead of an
116
+ * assistant success claim that describes nodes which never reached the candidate graph.
117
+ */
118
+ proposalWarnings?: {
119
+ attempts: number;
120
+ errors: string[];
121
+ };
44
122
  /**
45
123
  * Fail-loud(§3/EX-A):本轮 agent 调过 propose_workflow 但**没有任何一次通过校验**时带上
46
124
  * (attempts=被拒次数,errors=最后一次的校验错误)。reply 此时只是 agent 的口头方案,
@@ -51,17 +129,24 @@ export interface WorkflowChatResult {
51
129
  errors: string[];
52
130
  };
53
131
  /**
54
- * AI-2: per-field {{ __ASK__ }} placeholders the agent left for genuinely-unknown REQUIRED values.
55
- * The def IS applied (so the user sees the shape) but these nodes show a 待补 badge and the
56
- * workflow cannot be activated until resolved. Absent/empty = nothing pending.
132
+ * Per-field __ASK__ placeholders for genuinely unknown required values. They remain revisable
133
+ * conversation state and never prevent already reliable parts of the proposal being applied.
57
134
  */
58
- clarify?: {
59
- nodeId: string;
60
- field: string;
61
- question: string;
62
- }[];
135
+ clarify?: WorkflowClarification[];
136
+ /** Flow-level evidence for the accepted candidate. It informs the user; it is not a hard gate. */
137
+ semanticAcceptance?: WorkflowSemanticAcceptance;
138
+ /** Revisable conversational evidence only; never a save/finish gate. */
139
+ intentContract: WorkflowIntentContract;
140
+ /** IDs included in the initial compact working set; full catalog remains searchable. */
141
+ capabilitySelection?: string[];
142
+ /** Structured secure-input request returned by connector_request_connection. */
143
+ pendingConnectorInput?: Record<string, unknown>;
144
+ /** Most recent connector_validate evidence, surfaced without turning it into a finish gate. */
145
+ connectorValidation?: Record<string, unknown>;
146
+ contextCheckpoint: WorkflowChatContextCheckpoint;
63
147
  }
64
148
  /** agent 按需检索能力长尾(系统提示只放每类前 N 条)。 */
65
149
  export declare const LIST_CAPABILITIES_TOOL_NAME = "list_capabilities";
66
- /** 跑一轮对话式搭图/改图,返回自然语言 reply + 工作流提案(def 新建 / patch 改已有)。失败抛,由调用方降级。 */
150
+ /** 跑一轮对话式搭图/改图,返回自然语言 reply + 编译后的工作流 patch。失败抛,由调用方降级。 */
67
151
  export declare function runWorkflowChatRound(deps: WorkflowChatDeps): Promise<WorkflowChatResult>;
152
+ export {};
@@ -0,0 +1 @@
1
+ export declare function buildWorktreeTaskPrompt(worktreePath: string, prompt: string): string;