@n8n/instance-ai 1.4.1 → 1.6.0
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/computer-use-prompt.d.ts +5 -0
- package/dist/agent/computer-use-prompt.js +97 -0
- package/dist/agent/computer-use-prompt.js.map +1 -0
- package/dist/agent/instance-agent.js +48 -73
- package/dist/agent/instance-agent.js.map +1 -1
- package/dist/agent/mcp-tool-name-validation.d.ts +15 -0
- package/dist/agent/mcp-tool-name-validation.js +67 -0
- package/dist/agent/mcp-tool-name-validation.js.map +1 -0
- package/dist/agent/sanitize-mcp-schemas.d.ts +56 -2
- package/dist/agent/sanitize-mcp-schemas.js +226 -19
- package/dist/agent/sanitize-mcp-schemas.js.map +1 -1
- package/dist/agent/sub-agent-debriefing.d.ts +2 -2
- package/dist/agent/sub-agent-factory.d.ts +1 -0
- package/dist/agent/sub-agent-factory.js +1 -0
- package/dist/agent/sub-agent-factory.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +1 -1
- package/dist/agent/system-prompt.js +46 -104
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/constants/model-settings.d.ts +3 -0
- package/dist/constants/model-settings.js +7 -0
- package/dist/constants/model-settings.js.map +1 -0
- package/dist/domain-access/domain-access-tracker.d.ts +3 -0
- package/dist/domain-access/domain-access-tracker.js +16 -0
- package/dist/domain-access/domain-access-tracker.js.map +1 -1
- package/dist/domain-access/domain-gating.d.ts +35 -6
- package/dist/domain-access/domain-gating.js +47 -1
- package/dist/domain-access/domain-gating.js.map +1 -1
- package/dist/domain-access/index.d.ts +1 -1
- package/dist/domain-access/index.js +3 -1
- package/dist/domain-access/index.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +6 -0
- package/dist/mcp/mcp-client-manager.d.ts +18 -2
- package/dist/mcp/mcp-client-manager.js +124 -20
- package/dist/mcp/mcp-client-manager.js.map +1 -1
- package/dist/parsers/docx-parser.d.ts +6 -0
- package/dist/parsers/docx-parser.js +65 -0
- package/dist/parsers/docx-parser.js.map +1 -0
- package/dist/parsers/html-parser.d.ts +7 -0
- package/dist/parsers/html-parser.js +67 -0
- package/dist/parsers/html-parser.js.map +1 -0
- package/dist/parsers/index.d.ts +4 -0
- package/dist/parsers/index.js +16 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pdf-parser.d.ts +7 -0
- package/dist/parsers/pdf-parser.js +72 -0
- package/dist/parsers/pdf-parser.js.map +1 -0
- package/dist/parsers/structured-file-parser.d.ts +8 -3
- package/dist/parsers/structured-file-parser.js +36 -4
- package/dist/parsers/structured-file-parser.js.map +1 -1
- package/dist/parsers/validate-attachments.d.ts +14 -0
- package/dist/parsers/validate-attachments.js +61 -0
- package/dist/parsers/validate-attachments.js.map +1 -0
- package/dist/parsers/xlsx-parser.d.ts +2 -0
- package/dist/parsers/xlsx-parser.js +75 -0
- package/dist/parsers/xlsx-parser.js.map +1 -0
- package/dist/planned-tasks/planned-task-permissions.d.ts +2 -0
- package/dist/planned-tasks/planned-task-permissions.js +8 -2
- package/dist/planned-tasks/planned-task-permissions.js.map +1 -1
- package/dist/planned-tasks/planned-task-service.d.ts +14 -1
- package/dist/planned-tasks/planned-task-service.js +138 -2
- package/dist/planned-tasks/planned-task-service.js.map +1 -1
- package/dist/runtime/background-task-manager.d.ts +32 -1
- package/dist/runtime/background-task-manager.js +134 -4
- package/dist/runtime/background-task-manager.js.map +1 -1
- package/dist/runtime/builder-sandbox-session-registry.d.ts +45 -0
- package/dist/runtime/builder-sandbox-session-registry.js +159 -0
- package/dist/runtime/builder-sandbox-session-registry.js.map +1 -0
- package/dist/runtime/liveness-policy.d.ts +40 -0
- package/dist/runtime/liveness-policy.js +74 -0
- package/dist/runtime/liveness-policy.js.map +1 -0
- package/dist/runtime/resumable-stream-executor.d.ts +1 -0
- package/dist/runtime/resumable-stream-executor.js +1 -0
- package/dist/runtime/resumable-stream-executor.js.map +1 -1
- package/dist/runtime/run-state-registry.d.ts +21 -5
- package/dist/runtime/run-state-registry.js +109 -7
- package/dist/runtime/run-state-registry.js.map +1 -1
- package/dist/runtime/stream-runner.d.ts +3 -0
- package/dist/runtime/stream-runner.js +3 -0
- package/dist/runtime/stream-runner.js.map +1 -1
- package/dist/runtime/terminal-response-guard.d.ts +30 -0
- package/dist/runtime/terminal-response-guard.js +149 -0
- package/dist/runtime/terminal-response-guard.js.map +1 -0
- package/dist/storage/agent-tree-snapshot.d.ts +2 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +3 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/planned-task-storage.js +2 -1
- package/dist/storage/planned-task-storage.js.map +1 -1
- package/dist/storage/terminal-outcome-storage.d.ts +48 -0
- package/dist/storage/terminal-outcome-storage.js +84 -0
- package/dist/storage/terminal-outcome-storage.js.map +1 -0
- package/dist/storage/workflow-loop-storage.d.ts +442 -16
- package/dist/stream/consume-with-hitl.d.ts +2 -0
- package/dist/stream/consume-with-hitl.js +2 -0
- package/dist/stream/consume-with-hitl.js.map +1 -1
- package/dist/stream/map-chunk.js +6 -0
- package/dist/stream/map-chunk.js.map +1 -1
- package/dist/tools/attachments/parse-file.tool.d.ts +46 -34
- package/dist/tools/attachments/parse-file.tool.js +115 -56
- package/dist/tools/attachments/parse-file.tool.js.map +1 -1
- package/dist/tools/credentials.tool.d.ts +120 -1
- package/dist/tools/credentials.tool.js +65 -12
- package/dist/tools/credentials.tool.js.map +1 -1
- package/dist/tools/data-tables.tool.d.ts +1 -0
- package/dist/tools/data-tables.tool.js +64 -24
- package/dist/tools/data-tables.tool.js.map +1 -1
- package/dist/tools/executions.tool.js +4 -1
- package/dist/tools/executions.tool.js.map +1 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +2 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.js +74 -5
- package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
- package/dist/tools/index.d.ts +4 -24
- package/dist/tools/index.js +23 -7
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nodes.tool.js +15 -15
- package/dist/tools/nodes.tool.js.map +1 -1
- package/dist/tools/orchestration/add-plan-item.tool.js +3 -1
- package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -1
- package/dist/tools/orchestration/blueprint-accumulator.d.ts +4 -1
- package/dist/tools/orchestration/blueprint-accumulator.js +28 -0
- package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -1
- package/dist/tools/orchestration/blueprint.schema.d.ts +61 -16
- package/dist/tools/orchestration/blueprint.schema.js +15 -1
- package/dist/tools/orchestration/blueprint.schema.js.map +1 -1
- package/dist/tools/orchestration/browser-credential-setup.nudge.d.ts +5 -0
- package/dist/tools/orchestration/browser-credential-setup.nudge.js +11 -0
- package/dist/tools/orchestration/browser-credential-setup.nudge.js.map +1 -0
- package/dist/tools/orchestration/browser-credential-setup.prompt.js +2 -1
- package/dist/tools/orchestration/browser-credential-setup.prompt.js.map +1 -1
- package/dist/tools/orchestration/browser-credential-setup.tool.js +55 -7
- package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.prompt.js +86 -60
- package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +56 -3
- package/dist/tools/orchestration/build-workflow-agent.tool.js +1020 -300
- package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/builder-memory-compaction.d.ts +38 -0
- package/dist/tools/orchestration/builder-memory-compaction.js +146 -0
- package/dist/tools/orchestration/builder-memory-compaction.js.map +1 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.d.ts +2 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.js +76 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -0
- package/dist/tools/orchestration/data-table-agent.tool.js +34 -17
- package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/delegate.tool.js +34 -16
- package/dist/tools/orchestration/delegate.tool.js.map +1 -1
- package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -1
- package/dist/tools/orchestration/plan-agent-prompt.js +7 -0
- package/dist/tools/orchestration/plan-agent-prompt.js.map +1 -1
- package/dist/tools/orchestration/plan-with-agent.tool.d.ts +23 -0
- package/dist/tools/orchestration/plan-with-agent.tool.js +314 -13
- package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/plan.tool.js +17 -1
- package/dist/tools/orchestration/plan.tool.js.map +1 -1
- package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +40 -2
- package/dist/tools/orchestration/report-verification-verdict.tool.js +85 -6
- package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
- package/dist/tools/orchestration/research-with-agent.tool.js +33 -16
- package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/tracing-utils.js +8 -0
- package/dist/tools/orchestration/tracing-utils.js.map +1 -1
- package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +8 -2
- package/dist/tools/orchestration/verify-built-workflow.tool.js +476 -6
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
- package/dist/tools/research.tool.js +56 -10
- package/dist/tools/research.tool.js.map +1 -1
- package/dist/tools/shared/ask-user.tool.d.ts +1 -0
- package/dist/tools/shared/ask-user.tool.js +3 -2
- package/dist/tools/shared/ask-user.tool.js.map +1 -1
- package/dist/tools/templates.tool.js +5 -90
- package/dist/tools/templates.tool.js.map +1 -1
- package/dist/tools/web-research/sanitize-web-content.d.ts +0 -1
- package/dist/tools/web-research/sanitize-web-content.js +0 -9
- package/dist/tools/web-research/sanitize-web-content.js.map +1 -1
- package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +2 -2
- package/dist/tools/workflows/build-workflow.tool.d.ts +2 -2
- package/dist/tools/workflows/build-workflow.tool.js +6 -4
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/materialize-node-type.tool.d.ts +8 -8
- package/dist/tools/workflows/resolve-credentials.d.ts +9 -4
- package/dist/tools/workflows/resolve-credentials.js +59 -27
- package/dist/tools/workflows/resolve-credentials.js.map +1 -1
- package/dist/tools/workflows/setup-workflow.schema.d.ts +40 -0
- package/dist/tools/workflows/setup-workflow.service.d.ts +5 -1
- package/dist/tools/workflows/setup-workflow.service.js +71 -5
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
- package/dist/tools/workflows/submit-workflow-identity.d.ts +25 -3
- package/dist/tools/workflows/submit-workflow-identity.js +92 -5
- package/dist/tools/workflows/submit-workflow-identity.js.map +1 -1
- package/dist/tools/workflows/submit-workflow.tool.d.ts +60 -6
- package/dist/tools/workflows/submit-workflow.tool.js +102 -19
- package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/workflow-json-utils.d.ts +4 -0
- package/dist/tools/workflows/workflow-json-utils.js +54 -0
- package/dist/tools/workflows/workflow-json-utils.js.map +1 -0
- package/dist/tools/workflows.tool.d.ts +7 -1
- package/dist/tools/workflows.tool.js +283 -54
- package/dist/tools/workflows.tool.js.map +1 -1
- package/dist/tracing/langsmith-tracing.d.ts +2 -0
- package/dist/tracing/langsmith-tracing.js +12 -3
- package/dist/tracing/langsmith-tracing.js.map +1 -1
- package/dist/tracing/trace-replay.d.ts +3 -0
- package/dist/tracing/trace-replay.js +65 -0
- package/dist/tracing/trace-replay.js.map +1 -1
- package/dist/types.d.ts +92 -16
- package/dist/workflow-builder/parse-validate.d.ts +5 -1
- package/dist/workflow-builder/parse-validate.js +5 -4
- package/dist/workflow-builder/parse-validate.js.map +1 -1
- package/dist/workflow-loop/guidance.js +8 -2
- package/dist/workflow-loop/guidance.js.map +1 -1
- package/dist/workflow-loop/index.d.ts +3 -2
- package/dist/workflow-loop/index.js +11 -1
- package/dist/workflow-loop/index.js.map +1 -1
- package/dist/workflow-loop/remediation.d.ts +13 -0
- package/dist/workflow-loop/remediation.js +36 -0
- package/dist/workflow-loop/remediation.js.map +1 -0
- package/dist/workflow-loop/runtime.js +7 -0
- package/dist/workflow-loop/runtime.js.map +1 -1
- package/dist/workflow-loop/workflow-loop-controller.d.ts +1 -1
- package/dist/workflow-loop/workflow-loop-controller.js +196 -29
- package/dist/workflow-loop/workflow-loop-controller.js.map +1 -1
- package/dist/workflow-loop/workflow-loop-state.d.ts +500 -10
- package/dist/workflow-loop/workflow-loop-state.js +74 -1
- package/dist/workflow-loop/workflow-loop-state.js.map +1 -1
- package/dist/workflow-loop/workflow-task-service.d.ts +2 -1
- package/dist/workflow-loop/workflow-task-service.js +4 -0
- package/dist/workflow-loop/workflow-task-service.js.map +1 -1
- package/dist/workspace/builder-sandbox-factory.d.ts +3 -4
- package/dist/workspace/builder-sandbox-factory.js +74 -35
- package/dist/workspace/builder-sandbox-factory.js.map +1 -1
- package/dist/workspace/create-workspace.d.ts +2 -0
- package/dist/workspace/create-workspace.js.map +1 -1
- package/dist/workspace/n8n-sandbox-filesystem.js +2 -2
- package/dist/workspace/n8n-sandbox-filesystem.js.map +1 -1
- package/dist/workspace/n8n-sandbox-sandbox.d.ts +2 -3
- package/dist/workspace/n8n-sandbox-sandbox.js +3 -7
- package/dist/workspace/n8n-sandbox-sandbox.js.map +1 -1
- package/dist/workspace/sandbox-setup.d.ts +1 -1
- package/dist/workspace/sandbox-setup.js +41 -16
- package/dist/workspace/sandbox-setup.js.map +1 -1
- package/dist/workspace/snapshot-manager.d.ts +14 -2
- package/dist/workspace/snapshot-manager.js +57 -1
- package/dist/workspace/snapshot-manager.js.map +1 -1
- package/package.json +35 -10
- package/dist/tools/templates/template-api.d.ts +0 -21
- package/dist/tools/templates/template-api.js +0 -104
- package/dist/tools/templates/template-api.js.map +0 -1
- package/dist/tools/templates/types.d.ts +0 -52
- package/dist/tools/templates/types.js +0 -37
- package/dist/tools/templates/types.js.map +0 -1
- package/dist/tools/utils/mermaid.utils.d.ts +0 -15
- package/dist/tools/utils/mermaid.utils.js +0 -622
- package/dist/tools/utils/mermaid.utils.js.map +0 -1
- package/dist/tools/utils/node-configuration.utils.d.ts +0 -6
- package/dist/tools/utils/node-configuration.utils.js +0 -77
- package/dist/tools/utils/node-configuration.utils.js.map +0 -1
- package/dist/workspace/n8n-sandbox-client.d.ts +0 -105
- package/dist/workspace/n8n-sandbox-client.js +0 -335
- package/dist/workspace/n8n-sandbox-client.js.map +0 -1
- package/dist/workspace/n8n-sandbox-image-manager.d.ts +0 -5
- package/dist/workspace/n8n-sandbox-image-manager.js +0 -25
- package/dist/workspace/n8n-sandbox-image-manager.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-settings.js","sourceRoot":"","sources":["../../src/constants/model-settings.ts"],"names":[],"mappings":";;;AAOa,QAAA,WAAW,GAAG;IAE1B,OAAO,EAAE,GAAG;CACH,CAAC"}
|
|
@@ -5,5 +5,8 @@ export interface DomainAccessTracker {
|
|
|
5
5
|
isAllDomainsApproved(): boolean;
|
|
6
6
|
approveOnce(runId: string, host: string): void;
|
|
7
7
|
clearRun(runId: string): void;
|
|
8
|
+
isWebSearchAllowed(runId?: string): boolean;
|
|
9
|
+
approveWebSearch(): void;
|
|
10
|
+
approveWebSearchOnce(runId: string): void;
|
|
8
11
|
}
|
|
9
12
|
export declare function createDomainAccessTracker(): DomainAccessTracker;
|
|
@@ -6,6 +6,8 @@ function createDomainAccessTracker() {
|
|
|
6
6
|
const approvedDomains = new Set();
|
|
7
7
|
const transientApprovals = new Map();
|
|
8
8
|
let allDomainsApproved = false;
|
|
9
|
+
let webSearchApproved = false;
|
|
10
|
+
const transientWebSearchApprovals = new Set();
|
|
9
11
|
return {
|
|
10
12
|
isHostAllowed(host, runId) {
|
|
11
13
|
if (allDomainsApproved)
|
|
@@ -40,6 +42,20 @@ function createDomainAccessTracker() {
|
|
|
40
42
|
},
|
|
41
43
|
clearRun(runId) {
|
|
42
44
|
transientApprovals.delete(runId);
|
|
45
|
+
transientWebSearchApprovals.delete(runId);
|
|
46
|
+
},
|
|
47
|
+
isWebSearchAllowed(runId) {
|
|
48
|
+
if (webSearchApproved)
|
|
49
|
+
return true;
|
|
50
|
+
if (runId && transientWebSearchApprovals.has(runId))
|
|
51
|
+
return true;
|
|
52
|
+
return false;
|
|
53
|
+
},
|
|
54
|
+
approveWebSearch() {
|
|
55
|
+
webSearchApproved = true;
|
|
56
|
+
},
|
|
57
|
+
approveWebSearchOnce(runId) {
|
|
58
|
+
transientWebSearchApprovals.add(runId);
|
|
43
59
|
},
|
|
44
60
|
};
|
|
45
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-access-tracker.js","sourceRoot":"","sources":["../../src/domain-access/domain-access-tracker.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"domain-access-tracker.js","sourceRoot":"","sources":["../../src/domain-access/domain-access-tracker.ts"],"names":[],"mappings":";;AA2CA,8DA4DC;AAvGD,8CAAiD;AA2CjD,SAAgB,yBAAyB;IACxC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC1D,IAAI,kBAAkB,GAAG,KAAK,CAAC;IAE/B,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAU,CAAC;IAEtD,OAAO;QACN,aAAa,CAAC,IAAY,EAAE,KAAc;YACzC,IAAI,kBAAkB;gBAAE,OAAO,IAAI,CAAC;YACpC,IAAI,IAAA,2BAAe,EAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACvC,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC3C,IAAI,KAAK,EAAE,CAAC;gBACX,MAAM,QAAQ,GAAG,kBAAk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odObject<{
|
|
|
5
5
|
requestId: z.ZodString;
|
|
6
6
|
message: z.ZodString;
|
|
7
7
|
severity: z.ZodEnum<["destructive", "warning", "info"]>;
|
|
8
|
-
domainAccess: z.ZodObject<{
|
|
8
|
+
domainAccess: z.ZodOptional<z.ZodObject<{
|
|
9
9
|
url: z.ZodString;
|
|
10
10
|
host: z.ZodString;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -14,23 +14,36 @@ export declare const domainGatingSuspendSchema: z.ZodObject<{
|
|
|
14
14
|
}, {
|
|
15
15
|
url: string;
|
|
16
16
|
host: string;
|
|
17
|
-
}
|
|
17
|
+
}>>;
|
|
18
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
query: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
query: string;
|
|
22
|
+
}, {
|
|
23
|
+
query: string;
|
|
24
|
+
}>>;
|
|
18
25
|
}, "strip", z.ZodTypeAny, {
|
|
19
26
|
message: string;
|
|
20
27
|
requestId: string;
|
|
21
28
|
severity: "destructive" | "warning" | "info";
|
|
22
|
-
domainAccess
|
|
29
|
+
domainAccess?: {
|
|
23
30
|
url: string;
|
|
24
31
|
host: string;
|
|
25
|
-
};
|
|
32
|
+
} | undefined;
|
|
33
|
+
webSearch?: {
|
|
34
|
+
query: string;
|
|
35
|
+
} | undefined;
|
|
26
36
|
}, {
|
|
27
37
|
message: string;
|
|
28
38
|
requestId: string;
|
|
29
39
|
severity: "destructive" | "warning" | "info";
|
|
30
|
-
domainAccess
|
|
40
|
+
domainAccess?: {
|
|
31
41
|
url: string;
|
|
32
42
|
host: string;
|
|
33
|
-
};
|
|
43
|
+
} | undefined;
|
|
44
|
+
webSearch?: {
|
|
45
|
+
query: string;
|
|
46
|
+
} | undefined;
|
|
34
47
|
}>;
|
|
35
48
|
export declare const domainGatingResumeSchema: z.ZodObject<{
|
|
36
49
|
approved: z.ZodBoolean;
|
|
@@ -53,6 +66,12 @@ export declare function checkDomainAccess(options: {
|
|
|
53
66
|
permissionMode?: InstanceAiPermissionMode;
|
|
54
67
|
runId?: string;
|
|
55
68
|
}): DomainGatingCheck;
|
|
69
|
+
export declare function checkWebSearchAccess(options: {
|
|
70
|
+
query: string;
|
|
71
|
+
tracker?: DomainAccessTracker;
|
|
72
|
+
permissionMode?: InstanceAiPermissionMode;
|
|
73
|
+
runId?: string;
|
|
74
|
+
}): DomainGatingCheck;
|
|
56
75
|
export declare function applyDomainAccessResume(options: {
|
|
57
76
|
resumeData: {
|
|
58
77
|
approved: boolean;
|
|
@@ -64,3 +83,13 @@ export declare function applyDomainAccessResume(options: {
|
|
|
64
83
|
}): {
|
|
65
84
|
proceed: boolean;
|
|
66
85
|
};
|
|
86
|
+
export declare function applyWebSearchAccessResume(options: {
|
|
87
|
+
resumeData: {
|
|
88
|
+
approved: boolean;
|
|
89
|
+
domainAccessAction?: string;
|
|
90
|
+
};
|
|
91
|
+
tracker?: DomainAccessTracker;
|
|
92
|
+
runId?: string;
|
|
93
|
+
}): {
|
|
94
|
+
proceed: boolean;
|
|
95
|
+
};
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.domainGatingResumeSchema = exports.domainGatingSuspendSchema = void 0;
|
|
4
4
|
exports.checkDomainAccess = checkDomainAccess;
|
|
5
|
+
exports.checkWebSearchAccess = checkWebSearchAccess;
|
|
5
6
|
exports.applyDomainAccessResume = applyDomainAccessResume;
|
|
7
|
+
exports.applyWebSearchAccessResume = applyWebSearchAccessResume;
|
|
6
8
|
const api_types_1 = require("@n8n/api-types");
|
|
7
9
|
const nanoid_1 = require("nanoid");
|
|
8
10
|
const zod_1 = require("zod");
|
|
@@ -10,7 +12,8 @@ exports.domainGatingSuspendSchema = zod_1.z.object({
|
|
|
10
12
|
requestId: zod_1.z.string(),
|
|
11
13
|
message: zod_1.z.string(),
|
|
12
14
|
severity: api_types_1.instanceAiConfirmationSeveritySchema,
|
|
13
|
-
domainAccess: api_types_1.domainAccessMetaSchema,
|
|
15
|
+
domainAccess: api_types_1.domainAccessMetaSchema.optional(),
|
|
16
|
+
webSearch: api_types_1.webSearchMetaSchema.optional(),
|
|
14
17
|
});
|
|
15
18
|
exports.domainGatingResumeSchema = zod_1.z.object({
|
|
16
19
|
approved: zod_1.z.boolean(),
|
|
@@ -44,6 +47,27 @@ function checkDomainAccess(options) {
|
|
|
44
47
|
},
|
|
45
48
|
};
|
|
46
49
|
}
|
|
50
|
+
function checkWebSearchAccess(options) {
|
|
51
|
+
const { query, tracker, permissionMode, runId } = options;
|
|
52
|
+
if (permissionMode === 'blocked') {
|
|
53
|
+
return { allowed: false, blocked: true };
|
|
54
|
+
}
|
|
55
|
+
if (permissionMode === 'always_allow') {
|
|
56
|
+
return { allowed: true };
|
|
57
|
+
}
|
|
58
|
+
if (tracker?.isWebSearchAllowed(runId)) {
|
|
59
|
+
return { allowed: true };
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
allowed: false,
|
|
63
|
+
suspendPayload: {
|
|
64
|
+
requestId: (0, nanoid_1.nanoid)(),
|
|
65
|
+
message: `n8n AI wants to search the web for: ${query}`,
|
|
66
|
+
severity: 'info',
|
|
67
|
+
webSearch: { query },
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
47
71
|
function applyDomainAccessResume(options) {
|
|
48
72
|
const { resumeData, host, tracker, runId } = options;
|
|
49
73
|
if (!resumeData.approved) {
|
|
@@ -68,4 +92,26 @@ function applyDomainAccessResume(options) {
|
|
|
68
92
|
}
|
|
69
93
|
return { proceed: true };
|
|
70
94
|
}
|
|
95
|
+
function applyWebSearchAccessResume(options) {
|
|
96
|
+
const { resumeData, tracker, runId } = options;
|
|
97
|
+
if (!resumeData.approved) {
|
|
98
|
+
return { proceed: false };
|
|
99
|
+
}
|
|
100
|
+
const action = resumeData.domainAccessAction;
|
|
101
|
+
if (tracker) {
|
|
102
|
+
switch (action) {
|
|
103
|
+
case 'allow_domain':
|
|
104
|
+
case 'allow_all':
|
|
105
|
+
tracker.approveWebSearch();
|
|
106
|
+
break;
|
|
107
|
+
case 'allow_once':
|
|
108
|
+
default:
|
|
109
|
+
if (runId) {
|
|
110
|
+
tracker.approveWebSearchOnce(runId);
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { proceed: true };
|
|
116
|
+
}
|
|
71
117
|
//# sourceMappingURL=domain-gating.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-gating.js","sourceRoot":"","sources":["../../src/domain-access/domain-gating.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"domain-gating.js","sourceRoot":"","sources":["../../src/domain-access/domain-gating.ts"],"names":[],"mappings":";;;AAoEA,8CAyCC;AAYD,oDA6BC;AAUD,0DAiCC;AASD,gEA6BC;AAvND,8CAKwB;AAExB,mCAAgC;AAChC,6BAAwB;AAeX,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,gDAAoC;IAC9C,YAAY,EAAE,kCAAsB,CAAC,QAAQ,EAAE;IAC/C,SAAS,EAAE,+BAAmB,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE;IACrB,kBAAkB,EAAE,oCAAwB,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC;AAkBH,SAAgB,iBAAiB,CAAC,OAKjC;IACA,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAGxD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,EAAE,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YAChB,KAAK,cAAc,CAAC;YACpB,KAAK,WAAW;gBACf,OAAO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,MAAM;YACP,KAAK,YAAY,CAAC;YAClB;gBACC,IAAI,KAAK,EAAE,CAAC;oBACX,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,MAAM;QACR,CAAC;IACF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createDomainAccessTracker } from './domain-access-tracker';
|
|
2
2
|
export type { DomainAccessTracker } from './domain-access-tracker';
|
|
3
|
-
export { checkDomainAccess, applyDomainAccessResume, domainGatingSuspendSchema, domainGatingResumeSchema, } from './domain-gating';
|
|
3
|
+
export { checkDomainAccess, checkWebSearchAccess, applyDomainAccessResume, applyWebSearchAccessResume, domainGatingSuspendSchema, domainGatingResumeSchema, } from './domain-gating';
|
|
4
4
|
export type { DomainGatingCheck } from './domain-gating';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.domainGatingResumeSchema = exports.domainGatingSuspendSchema = exports.applyDomainAccessResume = exports.checkDomainAccess = exports.createDomainAccessTracker = void 0;
|
|
3
|
+
exports.domainGatingResumeSchema = exports.domainGatingSuspendSchema = exports.applyWebSearchAccessResume = exports.applyDomainAccessResume = exports.checkWebSearchAccess = exports.checkDomainAccess = exports.createDomainAccessTracker = void 0;
|
|
4
4
|
var domain_access_tracker_1 = require("./domain-access-tracker");
|
|
5
5
|
Object.defineProperty(exports, "createDomainAccessTracker", { enumerable: true, get: function () { return domain_access_tracker_1.createDomainAccessTracker; } });
|
|
6
6
|
var domain_gating_1 = require("./domain-gating");
|
|
7
7
|
Object.defineProperty(exports, "checkDomainAccess", { enumerable: true, get: function () { return domain_gating_1.checkDomainAccess; } });
|
|
8
|
+
Object.defineProperty(exports, "checkWebSearchAccess", { enumerable: true, get: function () { return domain_gating_1.checkWebSearchAccess; } });
|
|
8
9
|
Object.defineProperty(exports, "applyDomainAccessResume", { enumerable: true, get: function () { return domain_gating_1.applyDomainAccessResume; } });
|
|
10
|
+
Object.defineProperty(exports, "applyWebSearchAccessResume", { enumerable: true, get: function () { return domain_gating_1.applyWebSearchAccessResume; } });
|
|
9
11
|
Object.defineProperty(exports, "domainGatingSuspendSchema", { enumerable: true, get: function () { return domain_gating_1.domainGatingSuspendSchema; } });
|
|
10
12
|
Object.defineProperty(exports, "domainGatingResumeSchema", { enumerable: true, get: function () { return domain_gating_1.domainGatingResumeSchema; } });
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain-access/index.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;AAA3D,kIAAA,yBAAyB,OAAA;AAElC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain-access/index.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;AAA3D,kIAAA,yBAAyB,OAAA;AAElC,iDAOyB;AANxB,kHAAA,iBAAiB,OAAA;AACjB,qHAAA,oBAAoB,OAAA;AACpB,wHAAA,uBAAuB,OAAA;AACvB,2HAAA,0BAA0B,OAAA;AAC1B,0HAAA,yBAAyB,OAAA;AACzB,yHAAA,wBAAwB,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ export { startDataTableAgentTask } from './tools/orchestration/data-table-agent.
|
|
|
19
19
|
export { startDetachedDelegateTask } from './tools/orchestration/delegate.tool';
|
|
20
20
|
export { startResearchAgentTask } from './tools/orchestration/research-with-agent.tool';
|
|
21
21
|
export { createMemory } from './memory/memory-config';
|
|
22
|
-
export { iterationEntrySchema, formatPreviousAttempts, MastraIterationLogStorage, MastraTaskStorage, PlannedTaskStorage, patchThread, WorkflowLoopStorage, } from './storage';
|
|
23
|
-
export type { AgentTreeSnapshot, IterationEntry, IterationLog, PatchableThreadMemory, ThreadPatch, WorkflowLoopWorkItemRecord, } from './storage';
|
|
22
|
+
export { iterationEntrySchema, formatPreviousAttempts, MastraIterationLogStorage, MastraTaskStorage, PlannedTaskStorage, TerminalOutcomeStorage, patchThread, WorkflowLoopStorage, } from './storage';
|
|
23
|
+
export type { AgentTreeSnapshot, IterationEntry, IterationLog, PatchableThreadMemory, ThreadPatch, TerminalOutcome, WorkflowLoopWorkItemRecord, } from './storage';
|
|
24
24
|
export { truncateToTitle, generateTitleForRun } from './memory/title-utils';
|
|
25
25
|
export { McpClientManager } from './mcp/mcp-client-manager';
|
|
26
26
|
export { mapMastraChunkToEvent } from './stream/map-chunk';
|
|
@@ -37,21 +37,29 @@ export { SnapshotManager } from './workspace/snapshot-manager';
|
|
|
37
37
|
export type { InstanceAiEventBus, StoredEvent } from './event-bus';
|
|
38
38
|
export { BackgroundTaskManager, enrichMessageWithRunningTasks as enrichMessageWithBackgroundTasks, enrichMessageWithRunningTasks, } from './runtime/background-task-manager';
|
|
39
39
|
export type { BackgroundTaskStatus, ManagedBackgroundTask, SpawnManagedBackgroundTaskOptions, } from './runtime/background-task-manager';
|
|
40
|
+
export { BuilderSandboxSessionRegistry } from './runtime/builder-sandbox-session-registry';
|
|
41
|
+
export type { BuilderSandboxSession } from './runtime/builder-sandbox-session-registry';
|
|
40
42
|
export { RunStateRegistry } from './runtime/run-state-registry';
|
|
41
43
|
export type { ActiveRunState, BackgroundTaskStatusSnapshot, ConfirmationData, PendingConfirmation, StartedRunState, SuspendedRunState, } from './runtime/run-state-registry';
|
|
44
|
+
export { InstanceAiTerminalResponseGuard } from './runtime/terminal-response-guard';
|
|
45
|
+
export type { TerminalResponseDecision, TerminalResponseStatus, TerminalVisibilitySource, } from './runtime/terminal-response-guard';
|
|
42
46
|
export { executeResumableStream } from './runtime/resumable-stream-executor';
|
|
43
47
|
export type { AutoResumeControl, ExecuteResumableStreamOptions, ExecuteResumableStreamResult, ManualSuspensionControl, ResumableStreamContext, ResumableStreamControl, ResumableStreamSource, } from './runtime/resumable-stream-executor';
|
|
48
|
+
export type { WorkSummary } from './stream/work-summary-accumulator';
|
|
44
49
|
export { resumeAgentRun, streamAgentRun } from './runtime/stream-runner';
|
|
50
|
+
export { createInstanceAiLivenessPolicyConfig, INSTANCE_AI_DEFAULT_LIVENESS_POLICY_CONFIG, InstanceAiLivenessPolicy, type InstanceAiLivenessDecision, type InstanceAiLivenessInput, type InstanceAiLivenessPolicyConfig, type InstanceAiLivenessSurface, type InstanceAiLivenessTimeoutReason, } from './runtime/liveness-policy';
|
|
45
51
|
export type { StreamableAgent, StreamRunOptions, StreamRunResult, } from './runtime/stream-runner';
|
|
46
52
|
export { createWorkItem, formatWorkflowLoopGuidance, handleBuildOutcome, handleVerificationVerdict, formatAttemptHistory, WorkflowTaskCoordinator, workflowBuildOutcomeSchema, attemptRecordSchema, workflowLoopStateSchema, verificationResultSchema, } from './workflow-loop';
|
|
47
53
|
export type { WorkflowLoopState, WorkflowLoopAction, WorkflowBuildOutcome, VerificationResult, AttemptRecord, } from './workflow-loop';
|
|
48
54
|
export { WorkflowLoopRuntime } from './workflow-loop/runtime';
|
|
49
55
|
export { PlannedTaskCoordinator } from './planned-tasks/planned-task-service';
|
|
50
|
-
export { applyPlannedTaskPermissions } from './planned-tasks/planned-task-permissions';
|
|
51
|
-
export type { InstanceAiContext, InstanceAiWorkflowService, InstanceAiExecutionService, InstanceAiCredentialService, InstanceAiNodeService, InstanceAiDataTableService, DataTableSummary, DataTableColumnInfo, DataTableFilterInput, LocalMcpServer, McpServerConfig, ModelConfig, InstanceAiMemoryConfig, CreateInstanceAgentOptions, TaskStorage, PlannedTask, PlannedTaskKind, PlannedTaskStatus, PlannedTaskRecord, PlannedTaskGraph, PlannedTaskGraphStatus, PlannedTaskSchedulerAction, PlannedTaskService, OrchestrationContext, SpawnBackgroundTaskOptions, BackgroundTaskResult, InstanceAiToolTraceOptions, InstanceAiTraceContext, InstanceAiTraceRun, InstanceAiTraceRunFinishOptions, InstanceAiTraceRunInit, WorkflowTaskService, WorkflowSummary, WorkflowDetail, WorkflowNode, WorkflowVersionSummary, WorkflowVersionDetail, ExecutionResult, ExecutionDebugInfo, NodeOutputResult, ExecutionSummary, CredentialSummary, CredentialDetail, CredentialTypeSearchResult, NodeSummary, NodeDescription, SearchableNodeDescription, ExploreResourcesParams, ExploreResourcesResult, FetchedPage, WebSearchResult, WebSearchResponse, InstanceAiWebResearchService, InstanceAiWorkspaceService, ProjectSummary, FolderSummary, ServiceProxyConfig, } from './types';
|
|
56
|
+
export { applyPlannedTaskPermissions, PLANNED_TASK_PERMISSION_OVERRIDES, } from './planned-tasks/planned-task-permissions';
|
|
57
|
+
export type { InstanceAiContext, InstanceAiWorkflowService, InstanceAiExecutionService, InstanceAiCredentialService, InstanceAiNodeService, InstanceAiDataTableService, DataTableSummary, DataTableColumnInfo, DataTableFilterInput, LocalMcpServer, McpServerConfig, ModelConfig, InstanceAiMemoryConfig, CreateInstanceAgentOptions, TaskStorage, PlannedTask, PlannedTaskKind, PlannedTaskStatus, PlannedTaskRecord, PlannedTaskGraph, PlannedTaskGraphStatus, PlannedTaskSchedulerAction, PlannedTaskService, OrchestrationContext, SpawnBackgroundTaskOptions, SpawnBackgroundTaskResult, BackgroundTaskResult, InstanceAiToolTraceOptions, InstanceAiTraceContext, InstanceAiTraceRun, InstanceAiTraceRunFinishOptions, InstanceAiTraceRunInit, WorkflowTaskService, WorkflowSummary, WorkflowDetail, WorkflowNode, WorkflowVersionSummary, WorkflowVersionDetail, ExecutionResult, ExecutionDebugInfo, NodeOutputResult, ExecutionSummary, CredentialSummary, CredentialDetail, CredentialTypeSearchResult, NodeSummary, NodeDescription, SearchableNodeDescription, ExploreResourcesParams, ExploreResourcesResult, FetchedPage, WebSearchResult, WebSearchResponse, InstanceAiWebResearchService, InstanceAiWorkspaceService, ProjectSummary, FolderSummary, ServiceProxyConfig, } from './types';
|
|
52
58
|
export type { StartedWorkflowBuildTask } from './tools/orchestration/build-workflow-agent.tool';
|
|
53
59
|
export type { StartedBackgroundAgentTask } from './tools/orchestration/data-table-agent.tool';
|
|
54
60
|
export type { DetachedDelegateTaskResult } from './tools/orchestration/delegate.tool';
|
|
55
61
|
export type { StartedResearchAgentTask } from './tools/orchestration/research-with-agent.tool';
|
|
56
|
-
export { classifyAttachments, buildAttachmentManifest, isStructuredAttachment, } from './parsers/structured-file-parser';
|
|
57
|
-
export type { ClassifiedAttachment, ParseableFormat, } from './parsers/structured-file-parser';
|
|
62
|
+
export { classifyAttachments, buildAttachmentManifest, isStructuredAttachment, isParseableAttachment, } from './parsers/structured-file-parser';
|
|
63
|
+
export type { ClassifiedAttachment, ParseableFormat, TabularFormat, TextLikeFormat, SupportedFormat, } from './parsers/structured-file-parser';
|
|
64
|
+
export { getParseableAttachmentMimeTypes, getSupportedAttachmentMimeTypes, isSupportedAttachmentMimeType, validateAttachmentMimeTypes, UnsupportedAttachmentError, } from './parsers/validate-attachments';
|
|
65
|
+
export type { UnsupportedAttachmentDetail } from './parsers/validate-attachments';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isStructuredAttachment = exports.buildAttachmentManifest = exports.classifyAttachments = exports.applyPlannedTaskPermissions = exports.PlannedTaskCoordinator = exports.WorkflowLoopRuntime = exports.verificationResultSchema = exports.workflowLoopStateSchema = exports.attemptRecordSchema = exports.workflowBuildOutcomeSchema = exports.WorkflowTaskCoordinator = exports.formatAttemptHistory = exports.handleVerificationVerdict = exports.handleBuildOutcome = exports.formatWorkflowLoopGuidance = exports.createWorkItem = exports.streamAgentRun = exports.resumeAgentRun = exports.executeResumableStream = exports.RunStateRegistry = exports.enrichMessageWithRunningTasks = exports.enrichMessageWithBackgroundTasks = exports.BackgroundTaskManager = exports.SnapshotManager = void 0;
|
|
3
|
+
exports.createWorkspace = exports.createSandbox = exports.registerWithMastra = exports.findAgentNodeInTree = exports.buildAgentTreeFromEvents = exports.HAIKU_MODEL = exports.SONNET_MODEL = exports.Tool = exports.extractText = exports.createEvalAgent = exports.asResumable = exports.parseSuspension = exports.isRecord = exports.mapMastraChunkToEvent = exports.McpClientManager = exports.generateTitleForRun = exports.truncateToTitle = exports.WorkflowLoopStorage = exports.patchThread = exports.TerminalOutcomeStorage = exports.PlannedTaskStorage = exports.MastraTaskStorage = exports.MastraIterationLogStorage = exports.formatPreviousAttempts = exports.iterationEntrySchema = exports.createMemory = exports.startResearchAgentTask = exports.startDetachedDelegateTask = exports.startDataTableAgentTask = exports.BUILDER_AGENT_PROMPT = exports.startBuildWorkflowAgentTask = exports.createOrchestrationTools = exports.createAllTools = exports.createSubAgent = exports.createInstanceAgent = exports.PURE_REPLAY_TOOLS = exports.parseTraceJsonl = exports.TraceWriter = exports.TraceIndex = exports.IdRemapper = exports.withCurrentTraceSpan = exports.submitLangsmithUserFeedback = exports.releaseTraceClient = exports.continueInstanceAiTraceContext = exports.createTraceReplayOnlyContext = exports.createInstanceAiTraceContext = exports.createDomainAccessTracker = exports.generateCompactionSummary = exports.wrapUntrustedData = exports.MAX_STEPS = void 0;
|
|
4
|
+
exports.UnsupportedAttachmentError = exports.validateAttachmentMimeTypes = exports.isSupportedAttachmentMimeType = exports.getSupportedAttachmentMimeTypes = exports.getParseableAttachmentMimeTypes = exports.isParseableAttachment = exports.isStructuredAttachment = exports.buildAttachmentManifest = exports.classifyAttachments = exports.PLANNED_TASK_PERMISSION_OVERRIDES = exports.applyPlannedTaskPermissions = exports.PlannedTaskCoordinator = exports.WorkflowLoopRuntime = exports.verificationResultSchema = exports.workflowLoopStateSchema = exports.attemptRecordSchema = exports.workflowBuildOutcomeSchema = exports.WorkflowTaskCoordinator = exports.formatAttemptHistory = exports.handleVerificationVerdict = exports.handleBuildOutcome = exports.formatWorkflowLoopGuidance = exports.createWorkItem = exports.InstanceAiLivenessPolicy = exports.INSTANCE_AI_DEFAULT_LIVENESS_POLICY_CONFIG = exports.createInstanceAiLivenessPolicyConfig = exports.streamAgentRun = exports.resumeAgentRun = exports.executeResumableStream = exports.InstanceAiTerminalResponseGuard = exports.RunStateRegistry = exports.BuilderSandboxSessionRegistry = exports.enrichMessageWithRunningTasks = exports.enrichMessageWithBackgroundTasks = exports.BackgroundTaskManager = exports.SnapshotManager = exports.BuilderSandboxFactory = void 0;
|
|
5
5
|
var max_steps_1 = require("./constants/max-steps");
|
|
6
6
|
Object.defineProperty(exports, "MAX_STEPS", { enumerable: true, get: function () { return max_steps_1.MAX_STEPS; } });
|
|
7
7
|
var sanitize_web_content_1 = require("./tools/web-research/sanitize-web-content");
|
|
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "formatPreviousAttempts", { enumerable: true, get
|
|
|
48
48
|
Object.defineProperty(exports, "MastraIterationLogStorage", { enumerable: true, get: function () { return storage_1.MastraIterationLogStorage; } });
|
|
49
49
|
Object.defineProperty(exports, "MastraTaskStorage", { enumerable: true, get: function () { return storage_1.MastraTaskStorage; } });
|
|
50
50
|
Object.defineProperty(exports, "PlannedTaskStorage", { enumerable: true, get: function () { return storage_1.PlannedTaskStorage; } });
|
|
51
|
+
Object.defineProperty(exports, "TerminalOutcomeStorage", { enumerable: true, get: function () { return storage_1.TerminalOutcomeStorage; } });
|
|
51
52
|
Object.defineProperty(exports, "patchThread", { enumerable: true, get: function () { return storage_1.patchThread; } });
|
|
52
53
|
Object.defineProperty(exports, "WorkflowLoopStorage", { enumerable: true, get: function () { return storage_1.WorkflowLoopStorage; } });
|
|
53
54
|
var title_utils_1 = require("./memory/title-utils");
|
|
@@ -83,13 +84,21 @@ var background_task_manager_1 = require("./runtime/background-task-manager");
|
|
|
83
84
|
Object.defineProperty(exports, "BackgroundTaskManager", { enumerable: true, get: function () { return background_task_manager_1.BackgroundTaskManager; } });
|
|
84
85
|
Object.defineProperty(exports, "enrichMessageWithBackgroundTasks", { enumerable: true, get: function () { return background_task_manager_1.enrichMessageWithRunningTasks; } });
|
|
85
86
|
Object.defineProperty(exports, "enrichMessageWithRunningTasks", { enumerable: true, get: function () { return background_task_manager_1.enrichMessageWithRunningTasks; } });
|
|
87
|
+
var builder_sandbox_session_registry_1 = require("./runtime/builder-sandbox-session-registry");
|
|
88
|
+
Object.defineProperty(exports, "BuilderSandboxSessionRegistry", { enumerable: true, get: function () { return builder_sandbox_session_registry_1.BuilderSandboxSessionRegistry; } });
|
|
86
89
|
var run_state_registry_1 = require("./runtime/run-state-registry");
|
|
87
90
|
Object.defineProperty(exports, "RunStateRegistry", { enumerable: true, get: function () { return run_state_registry_1.RunStateRegistry; } });
|
|
91
|
+
var terminal_response_guard_1 = require("./runtime/terminal-response-guard");
|
|
92
|
+
Object.defineProperty(exports, "InstanceAiTerminalResponseGuard", { enumerable: true, get: function () { return terminal_response_guard_1.InstanceAiTerminalResponseGuard; } });
|
|
88
93
|
var resumable_stream_executor_1 = require("./runtime/resumable-stream-executor");
|
|
89
94
|
Object.defineProperty(exports, "executeResumableStream", { enumerable: true, get: function () { return resumable_stream_executor_1.executeResumableStream; } });
|
|
90
95
|
var stream_runner_1 = require("./runtime/stream-runner");
|
|
91
96
|
Object.defineProperty(exports, "resumeAgentRun", { enumerable: true, get: function () { return stream_runner_1.resumeAgentRun; } });
|
|
92
97
|
Object.defineProperty(exports, "streamAgentRun", { enumerable: true, get: function () { return stream_runner_1.streamAgentRun; } });
|
|
98
|
+
var liveness_policy_1 = require("./runtime/liveness-policy");
|
|
99
|
+
Object.defineProperty(exports, "createInstanceAiLivenessPolicyConfig", { enumerable: true, get: function () { return liveness_policy_1.createInstanceAiLivenessPolicyConfig; } });
|
|
100
|
+
Object.defineProperty(exports, "INSTANCE_AI_DEFAULT_LIVENESS_POLICY_CONFIG", { enumerable: true, get: function () { return liveness_policy_1.INSTANCE_AI_DEFAULT_LIVENESS_POLICY_CONFIG; } });
|
|
101
|
+
Object.defineProperty(exports, "InstanceAiLivenessPolicy", { enumerable: true, get: function () { return liveness_policy_1.InstanceAiLivenessPolicy; } });
|
|
93
102
|
var workflow_loop_1 = require("./workflow-loop");
|
|
94
103
|
Object.defineProperty(exports, "createWorkItem", { enumerable: true, get: function () { return workflow_loop_1.createWorkItem; } });
|
|
95
104
|
Object.defineProperty(exports, "formatWorkflowLoopGuidance", { enumerable: true, get: function () { return workflow_loop_1.formatWorkflowLoopGuidance; } });
|
|
@@ -107,8 +116,16 @@ var planned_task_service_1 = require("./planned-tasks/planned-task-service");
|
|
|
107
116
|
Object.defineProperty(exports, "PlannedTaskCoordinator", { enumerable: true, get: function () { return planned_task_service_1.PlannedTaskCoordinator; } });
|
|
108
117
|
var planned_task_permissions_1 = require("./planned-tasks/planned-task-permissions");
|
|
109
118
|
Object.defineProperty(exports, "applyPlannedTaskPermissions", { enumerable: true, get: function () { return planned_task_permissions_1.applyPlannedTaskPermissions; } });
|
|
119
|
+
Object.defineProperty(exports, "PLANNED_TASK_PERMISSION_OVERRIDES", { enumerable: true, get: function () { return planned_task_permissions_1.PLANNED_TASK_PERMISSION_OVERRIDES; } });
|
|
110
120
|
var structured_file_parser_1 = require("./parsers/structured-file-parser");
|
|
111
121
|
Object.defineProperty(exports, "classifyAttachments", { enumerable: true, get: function () { return structured_file_parser_1.classifyAttachments; } });
|
|
112
122
|
Object.defineProperty(exports, "buildAttachmentManifest", { enumerable: true, get: function () { return structured_file_parser_1.buildAttachmentManifest; } });
|
|
113
123
|
Object.defineProperty(exports, "isStructuredAttachment", { enumerable: true, get: function () { return structured_file_parser_1.isStructuredAttachment; } });
|
|
124
|
+
Object.defineProperty(exports, "isParseableAttachment", { enumerable: true, get: function () { return structured_file_parser_1.isParseableAttachment; } });
|
|
125
|
+
var validate_attachments_1 = require("./parsers/validate-attachments");
|
|
126
|
+
Object.defineProperty(exports, "getParseableAttachmentMimeTypes", { enumerable: true, get: function () { return validate_attachments_1.getParseableAttachmentMimeTypes; } });
|
|
127
|
+
Object.defineProperty(exports, "getSupportedAttachmentMimeTypes", { enumerable: true, get: function () { return validate_attachments_1.getSupportedAttachmentMimeTypes; } });
|
|
128
|
+
Object.defineProperty(exports, "isSupportedAttachmentMimeType", { enumerable: true, get: function () { return validate_attachments_1.isSupportedAttachmentMimeType; } });
|
|
129
|
+
Object.defineProperty(exports, "validateAttachmentMimeTypes", { enumerable: true, get: function () { return validate_attachments_1.validateAttachmentMimeTypes; } });
|
|
130
|
+
Object.defineProperty(exports, "UnsupportedAttachmentError", { enumerable: true, get: function () { return validate_attachments_1.UnsupportedAttachmentError; } });
|
|
114
131
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAkD;AAAzC,sGAAA,SAAS,OAAA;AAClB,kFAA8E;AAArE,yHAAA,iBAAiB,OAAA;AAE1B,2CAAyD;AAAhD,uHAAA,yBAAyB,OAAA;AAElC,iDAA4D;AAAnD,0HAAA,yBAAyB,OAAA;AAElC,iEAOqC;AANpC,iIAAA,4BAA4B,OAAA;AAC5B,iIAAA,4BAA4B,OAAA;AAC5B,mIAAA,8BAA8B,OAAA;AAC9B,uHAAA,kBAAkB,OAAA;AAClB,gIAAA,2BAA2B,OAAA;AAC3B,yHAAA,oBAAoB,OAAA;AAGrB,uDAMgC;AAL/B,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,2GAAA,WAAW,OAAA;AACX,+GAAA,eAAe,OAAA;AACf,iHAAA,iBAAiB,OAAA;AASlB,yDAA6D;AAApD,qHAAA,mBAAmB,OAAA;AAC5B,+DAA2D;AAAlD,mHAAA,cAAc,OAAA;AAEvB,iCAAmE;AAA1D,uGAAA,cAAc,OAAA;AAAE,iHAAA,wBAAwB,OAAA;AACjD,6FAA8F;AAArF,wIAAA,2BAA2B,OAAA;AACpC,iGAA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C,OAAA;AACpC,6IAAA,0CAA0C,OAAA;AAC1C,2HAAA,wBAAwB,OAAA;AAYzB,iDAWyB;AAVxB,+GAAA,cAAc,OAAA;AACd,2HAAA,0BAA0B,OAAA;AAC1B,mHAAA,kBAAkB,OAAA;AAClB,0HAAA,yBAAyB,OAAA;AACzB,qHAAA,oBAAoB,OAAA;AACpB,wHAAA,uBAAuB,OAAA;AACvB,2HAAA,0BAA0B,OAAA;AAC1B,oHAAA,mBAAmB,OAAA;AACnB,wHAAA,uBAAuB,OAAA;AACvB,yHAAA,wBAAwB,OAAA;AASzB,mDAA8D;AAArD,8GAAA,mBAAmB,OAAA;AAC5B,6EAA8E;AAArE,8HAAA,sBAAsB,OAAA;AAC/B,qFAGkD;AAFjD,uIAAA,2BAA2B,OAAA;AAC3B,6IAAA,iCAAiC,OAAA;AAkElC,2EAK0C;AAJzC,6HAAA,mBAAmB,OAAA;AACnB,iIAAA,uBAAuB,OAAA;AACvB,gIAAA,sBAAsB,OAAA;AACtB,+HAAA,qBAAqB,OAAA;AAStB,uEAMwC;AALvC,uIAAA,+BAA+B,OAAA;AAC/B,uIAAA,+BAA+B,OAAA;AAC/B,qIAAA,6BAA6B,OAAA;AAC7B,mIAAA,2BAA2B,OAAA;AAC3B,kIAAA,0BAA0B,OAAA"}
|
package/dist/logger.d.ts
CHANGED
|
@@ -4,3 +4,9 @@ export interface Logger {
|
|
|
4
4
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
5
5
|
debug(message: string, metadata?: Record<string, unknown>): void;
|
|
6
6
|
}
|
|
7
|
+
export interface ErrorReporter {
|
|
8
|
+
error(error: unknown, options?: {
|
|
9
|
+
tags?: Record<string, string>;
|
|
10
|
+
extra?: Record<string, unknown>;
|
|
11
|
+
}): void;
|
|
12
|
+
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
import type { ToolsInput } from '@mastra/core/agent';
|
|
2
|
+
import type { Result } from 'n8n-workflow';
|
|
3
|
+
import type { Logger } from '../logger';
|
|
1
4
|
import type { McpServerConfig } from '../types';
|
|
5
|
+
export interface SsrfUrlValidator {
|
|
6
|
+
validateUrl(url: string | URL): Promise<Result<void, Error>>;
|
|
7
|
+
}
|
|
2
8
|
export declare class McpClientManager {
|
|
3
|
-
private
|
|
4
|
-
|
|
9
|
+
private readonly ssrfValidator?;
|
|
10
|
+
private regularToolsByKey;
|
|
11
|
+
private browserToolsByKey;
|
|
12
|
+
private inFlightRegularByKey;
|
|
13
|
+
private inFlightBrowserByKey;
|
|
14
|
+
private clientsByKey;
|
|
15
|
+
constructor(ssrfValidator?: SsrfUrlValidator | undefined);
|
|
16
|
+
getRegularTools(configs: McpServerConfig[], logger?: Logger): Promise<ToolsInput>;
|
|
17
|
+
getBrowserTools(config: McpServerConfig | undefined, logger?: Logger): Promise<ToolsInput>;
|
|
5
18
|
disconnect(): Promise<void>;
|
|
19
|
+
private getOrLoad;
|
|
20
|
+
private validateConfigs;
|
|
21
|
+
private connectAndListTools;
|
|
6
22
|
}
|
|
@@ -2,32 +2,136 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.McpClientManager = void 0;
|
|
4
4
|
const mcp_1 = require("@mastra/mcp");
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const nanoid_1 = require("nanoid");
|
|
7
|
+
const mcp_tool_name_validation_1 = require("../agent/mcp-tool-name-validation");
|
|
8
|
+
const sanitize_mcp_schemas_1 = require("../agent/sanitize-mcp-schemas");
|
|
9
|
+
function buildMcpServers(configs) {
|
|
10
|
+
const servers = {};
|
|
11
|
+
for (const server of configs) {
|
|
12
|
+
if (server.url) {
|
|
13
|
+
servers[server.name] = { url: new URL(server.url) };
|
|
14
|
+
}
|
|
15
|
+
else if (server.command) {
|
|
16
|
+
servers[server.name] = { command: server.command, args: server.args, env: server.env };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return servers;
|
|
20
|
+
}
|
|
21
|
+
function warnSkippedMcpSchema(logger, source) {
|
|
22
|
+
return (error) => {
|
|
23
|
+
logger?.warn('Skipped MCP tool with unsupported schema', {
|
|
24
|
+
toolName: error.details.toolName,
|
|
25
|
+
source,
|
|
26
|
+
path: error.details.path,
|
|
27
|
+
depth: error.details.depth,
|
|
28
|
+
maxDepth: error.details.maxDepth,
|
|
29
|
+
limitType: error.details.limitType,
|
|
30
|
+
limit: error.details.limit,
|
|
31
|
+
reason: error.message,
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function getSafeMcpServers(configs, logger, source) {
|
|
36
|
+
return configs.filter((config) => {
|
|
37
|
+
if ((0, mcp_tool_name_validation_1.isSafeMcpIdentifierName)(config.name))
|
|
38
|
+
return true;
|
|
39
|
+
logger?.warn('Skipped MCP server with unsafe name', {
|
|
40
|
+
serverName: config.name,
|
|
41
|
+
source,
|
|
42
|
+
});
|
|
43
|
+
return false;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
5
46
|
class McpClientManager {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
47
|
+
ssrfValidator;
|
|
48
|
+
regularToolsByKey = new Map();
|
|
49
|
+
browserToolsByKey = new Map();
|
|
50
|
+
inFlightRegularByKey = new Map();
|
|
51
|
+
inFlightBrowserByKey = new Map();
|
|
52
|
+
clientsByKey = new Map();
|
|
53
|
+
constructor(ssrfValidator) {
|
|
54
|
+
this.ssrfValidator = ssrfValidator;
|
|
55
|
+
}
|
|
56
|
+
async getRegularTools(configs, logger) {
|
|
57
|
+
const safeConfigs = getSafeMcpServers(configs, logger, 'external MCP');
|
|
58
|
+
if (safeConfigs.length === 0)
|
|
59
|
+
return {};
|
|
60
|
+
const key = JSON.stringify(safeConfigs);
|
|
61
|
+
return await this.getOrLoad(this.regularToolsByKey, this.inFlightRegularByKey, key, async () => {
|
|
62
|
+
await this.validateConfigs(safeConfigs);
|
|
63
|
+
return await this.connectAndListTools(`mcp-${(0, nanoid_1.nanoid)(6)}`, safeConfigs, key, logger, 'external MCP');
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async getBrowserTools(config, logger) {
|
|
67
|
+
if (!config)
|
|
68
|
+
return {};
|
|
69
|
+
const [safeConfig] = getSafeMcpServers([config], logger, 'browser MCP');
|
|
70
|
+
if (!safeConfig)
|
|
9
71
|
return {};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
72
|
+
const key = JSON.stringify(safeConfig);
|
|
73
|
+
return await this.getOrLoad(this.browserToolsByKey, this.inFlightBrowserByKey, key, async () => {
|
|
74
|
+
await this.validateConfigs([safeConfig]);
|
|
75
|
+
return await this.connectAndListTools(`browser-mcp-${(0, nanoid_1.nanoid)(6)}`, [safeConfig], key, logger, 'browser MCP');
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async disconnect() {
|
|
79
|
+
const clients = [...this.clientsByKey.values()];
|
|
80
|
+
this.clientsByKey.clear();
|
|
81
|
+
this.regularToolsByKey.clear();
|
|
82
|
+
this.browserToolsByKey.clear();
|
|
83
|
+
this.inFlightRegularByKey.clear();
|
|
84
|
+
this.inFlightBrowserByKey.clear();
|
|
85
|
+
await Promise.all(clients.map(async (c) => await c.disconnect()));
|
|
86
|
+
}
|
|
87
|
+
async getOrLoad(cache, inFlight, key, produce) {
|
|
88
|
+
const cached = cache.get(key);
|
|
89
|
+
if (cached)
|
|
90
|
+
return cached;
|
|
91
|
+
const pending = inFlight.get(key);
|
|
92
|
+
if (pending)
|
|
93
|
+
return await pending;
|
|
94
|
+
const promise = (async () => {
|
|
95
|
+
const value = await produce();
|
|
96
|
+
cache.set(key, value);
|
|
97
|
+
return value;
|
|
98
|
+
})();
|
|
99
|
+
inFlight.set(key, promise);
|
|
100
|
+
try {
|
|
101
|
+
return await promise;
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
inFlight.delete(key);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async validateConfigs(configs) {
|
|
108
|
+
for (const server of configs) {
|
|
109
|
+
if (!server.url)
|
|
110
|
+
continue;
|
|
111
|
+
let parsed;
|
|
112
|
+
try {
|
|
113
|
+
parsed = new URL(server.url);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
throw new n8n_workflow_1.UserError(`MCP server "${server.name}": invalid URL "${server.url}"`);
|
|
117
|
+
}
|
|
118
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
119
|
+
throw new n8n_workflow_1.UserError(`MCP server "${server.name}": only http(s) URLs are allowed, got "${parsed.protocol}"`);
|
|
14
120
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
121
|
+
if (this.ssrfValidator) {
|
|
122
|
+
const result = await this.ssrfValidator.validateUrl(server.url);
|
|
123
|
+
if (!result.ok) {
|
|
124
|
+
throw new n8n_workflow_1.UserError(`MCP server "${server.name}": URL blocked by SSRF policy — ${result.error.message}`);
|
|
125
|
+
}
|
|
21
126
|
}
|
|
22
127
|
}
|
|
23
|
-
this.mcpClient = new mcp_1.MCPClient({ servers: serverMap });
|
|
24
|
-
return await this.mcpClient.listTools();
|
|
25
128
|
}
|
|
26
|
-
async
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
129
|
+
async connectAndListTools(id, configs, clientKey, logger, source) {
|
|
130
|
+
const client = new mcp_1.MCPClient({ id, servers: buildMcpServers(configs) });
|
|
131
|
+
this.clientsByKey.set(clientKey, client);
|
|
132
|
+
return (0, sanitize_mcp_schemas_1.sanitizeMcpToolSchemas)(await client.listTools(), {
|
|
133
|
+
onError: warnSkippedMcpSchema(logger, source),
|
|
134
|
+
});
|
|
31
135
|
}
|
|
32
136
|
}
|
|
33
137
|
exports.McpClientManager = McpClientManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client-manager.js","sourceRoot":"","sources":["../../src/mcp/mcp-client-manager.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