@jungjaehoon/mama-os 0.42.0 → 0.44.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/agent-loop.d.ts +2 -0
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +96 -3
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/cline-native-tool-policy.d.ts +6 -0
- package/dist/agent/cline-native-tool-policy.d.ts.map +1 -1
- package/dist/agent/cline-native-tool-policy.js +11 -0
- package/dist/agent/cline-native-tool-policy.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +45 -0
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/codex-app-server-process.d.ts +9 -0
- package/dist/agent/codex-app-server-process.d.ts.map +1 -1
- package/dist/agent/codex-app-server-process.js +25 -2
- package/dist/agent/codex-app-server-process.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +15 -0
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +206 -0
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +3 -0
- package/dist/agent/model-runner.d.ts +2 -0
- package/dist/agent/model-runner.d.ts.map +1 -1
- package/dist/agent/model-runner.js.map +1 -1
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +18 -0
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +18 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +145 -1
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/config/types.d.ts +7 -0
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +11 -1
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/runtime/agent-loop-init.d.ts +4 -0
- package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
- package/dist/cli/runtime/agent-loop-init.js +15 -1
- package/dist/cli/runtime/agent-loop-init.js.map +1 -1
- package/dist/evidence/effects.d.ts +7 -6
- package/dist/evidence/effects.d.ts.map +1 -1
- package/dist/evidence/effects.js +60 -1
- package/dist/evidence/effects.js.map +1 -1
- package/dist/observability/operational-issues.d.ts +55 -0
- package/dist/observability/operational-issues.d.ts.map +1 -0
- package/dist/observability/operational-issues.js +170 -0
- package/dist/observability/operational-issues.js.map +1 -0
- package/dist/operator/file-export.d.ts +22 -0
- package/dist/operator/file-export.d.ts.map +1 -0
- package/dist/operator/file-export.js +115 -0
- package/dist/operator/file-export.js.map +1 -0
- package/dist/operator/owner-event-loop.d.ts +6 -0
- package/dist/operator/owner-event-loop.d.ts.map +1 -1
- package/dist/operator/owner-event-loop.js +12 -1
- package/dist/operator/owner-event-loop.js.map +1 -1
- package/dist/operator/owner-event-policy.d.ts.map +1 -1
- package/dist/operator/owner-event-policy.js +4 -0
- package/dist/operator/owner-event-policy.js.map +1 -1
- package/dist/operator/repair-request.d.ts +29 -0
- package/dist/operator/repair-request.d.ts.map +1 -0
- package/dist/operator/repair-request.js +115 -0
- package/dist/operator/repair-request.js.map +1 -0
- package/dist/operator/report-context.d.ts +13 -0
- package/dist/operator/report-context.d.ts.map +1 -1
- package/dist/operator/report-context.js +39 -1
- package/dist/operator/report-context.js.map +1 -1
- package/dist/operator/task-ledger.d.ts +24 -1
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +64 -1
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/worker-run.d.ts +4 -0
- package/dist/operator/worker-run.d.ts.map +1 -1
- package/dist/operator/worker-run.js +4 -1
- package/dist/operator/worker-run.js.map +1 -1
- package/dist/operator/workorder-consumer.d.ts +2 -0
- package/dist/operator/workorder-consumer.d.ts.map +1 -1
- package/dist/operator/workorder-consumer.js +22 -1
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/dist/operator/workorder-publishers.d.ts +2 -0
- package/dist/operator/workorder-publishers.d.ts.map +1 -1
- package/dist/operator/workorder-publishers.js +12 -0
- package/dist/operator/workorder-publishers.js.map +1 -1
- package/package.json +2 -2
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - Blocked tools return permission errors instead of executing
|
|
11
11
|
* - Path-based tools (Read, Write) also check path permissions
|
|
12
12
|
*/
|
|
13
|
+
import type { RecordIssueInput } from '../observability/operational-issues.js';
|
|
13
14
|
import type { GatewayToolName, GatewayToolInput, GatewayToolResult, GatewayToolExecutorOptions, MAMAApiSetInput, AgentContext, GatewayToolExecutionContext, BeginModelRunInput, ModelRunRecord, PrincipalRepository } from './types.js';
|
|
14
15
|
import type { AgentProcessManager } from '../multi-agent/agent-process-manager.js';
|
|
15
16
|
import type { AgentEventBus } from '../multi-agent/agent-event-bus.js';
|
|
@@ -88,6 +89,10 @@ export declare class GatewayToolExecutor {
|
|
|
88
89
|
private disallowedGatewayTools;
|
|
89
90
|
private reportPublisher;
|
|
90
91
|
private reportRequestHandler;
|
|
92
|
+
/** Host-injected: failures become operational issues (observability/operational-issues.ts). */
|
|
93
|
+
private operationalIssueSink;
|
|
94
|
+
/** Host-injected: issue lifecycle + owner notice for the self-check turn's tools. */
|
|
95
|
+
private repairControls;
|
|
91
96
|
private reportReader;
|
|
92
97
|
private wikiPublisher;
|
|
93
98
|
private wikiPublishAdapter;
|
|
@@ -131,6 +136,16 @@ export declare class GatewayToolExecutor {
|
|
|
131
136
|
* owner-event crash-recovery resolver can see it. Reads only the fields the write named.
|
|
132
137
|
*/
|
|
133
138
|
private withMemoryWriteReceipt;
|
|
139
|
+
/** Issue lifecycle and the one-line owner notice used by repair_request / issue_close. */
|
|
140
|
+
setRepairControls(controls: {
|
|
141
|
+
issueExists: (issueId: string) => boolean;
|
|
142
|
+
setIssueStatus: (issueId: string, status: 'repair_requested' | 'closed') => void;
|
|
143
|
+
notifyOwner: (line: string) => Promise<void>;
|
|
144
|
+
repairRoot: () => string;
|
|
145
|
+
}): void;
|
|
146
|
+
/** Where a tool failure or a scope mismatch is recorded as an operational issue. */
|
|
147
|
+
setOperationalIssueSink(fn: (input: RecordIssueInput) => void): void;
|
|
148
|
+
private recordIssue;
|
|
134
149
|
setReportPublisher(fn: (slots: Record<string, string>) => void | readonly string[] | ReportPublishResult): void;
|
|
135
150
|
/** Forwarder hook for on-demand full reports (plan v6 S1-T3). */
|
|
136
151
|
setReportRequestHandler(fn: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-tool-executor.d.ts","sourceRoot":"","sources":["../../src/agent/gateway-tool-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"gateway-tool-executor.d.ts","sourceRoot":"","sources":["../../src/agent/gateway-tool-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAS/E,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAcjB,0BAA0B,EAG1B,eAAe,EACf,YAAY,EAIZ,2BAA2B,EAE3B,kBAAkB,EAClB,cAAc,EAKd,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAoBpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,4BAA4B,CAAC;AAY1F,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,+BAA+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,CAAsD;IACxE,OAAO,CAAC,uBAAuB;IAsE/B;;OAEG;YACW,eAAe;YAqDf,cAAc;IAwI5B;;;;;;;;;;;OAWG;YACW,oBAAoB;YA2FpB,gBAAgB;IAoC9B,MAAM,CAAC,aAAa,IAAI,eAAe,EAAE;IAIzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,eAAe;YAInD,oBAAoB;CA+InC"}
|
|
@@ -59,8 +59,11 @@ const util_1 = require("util");
|
|
|
59
59
|
const debugLogger = __importStar(require("@jungjaehoon/mama-core/debug-logger"));
|
|
60
60
|
const mama_core_1 = require("@jungjaehoon/mama-core");
|
|
61
61
|
const security_monitor_js_1 = require("../security/security-monitor.js");
|
|
62
|
+
const node_fs_1 = require("node:fs");
|
|
62
63
|
const secret_filter_js_1 = require("../memory/secret-filter.js");
|
|
63
64
|
const learning_context_js_1 = require("../operator/learning-context.js");
|
|
65
|
+
const file_export_js_1 = require("../operator/file-export.js");
|
|
66
|
+
const repair_request_js_1 = require("../operator/repair-request.js");
|
|
64
67
|
const scope_context_js_1 = require("../memory/scope-context.js");
|
|
65
68
|
const provenance_live_js_1 = require("../memory/provenance-live.js");
|
|
66
69
|
const worker_envelope_js_1 = require("../api/worker-envelope.js");
|
|
@@ -460,6 +463,10 @@ class GatewayToolExecutor {
|
|
|
460
463
|
disallowedGatewayTools = new Set();
|
|
461
464
|
reportPublisher = null;
|
|
462
465
|
reportRequestHandler = null;
|
|
466
|
+
/** Host-injected: failures become operational issues (observability/operational-issues.ts). */
|
|
467
|
+
operationalIssueSink = null;
|
|
468
|
+
/** Host-injected: issue lifecycle + owner notice for the self-check turn's tools. */
|
|
469
|
+
repairControls = null;
|
|
463
470
|
reportReader = null;
|
|
464
471
|
wikiPublisher = null;
|
|
465
472
|
wikiPublishAdapter = null;
|
|
@@ -667,6 +674,25 @@ class GatewayToolExecutor {
|
|
|
667
674
|
}
|
|
668
675
|
return result;
|
|
669
676
|
}
|
|
677
|
+
/** Issue lifecycle and the one-line owner notice used by repair_request / issue_close. */
|
|
678
|
+
setRepairControls(controls) {
|
|
679
|
+
this.repairControls = controls;
|
|
680
|
+
}
|
|
681
|
+
/** Where a tool failure or a scope mismatch is recorded as an operational issue. */
|
|
682
|
+
setOperationalIssueSink(fn) {
|
|
683
|
+
this.operationalIssueSink = fn;
|
|
684
|
+
}
|
|
685
|
+
recordIssue(input) {
|
|
686
|
+
if (!this.operationalIssueSink) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
try {
|
|
690
|
+
this.operationalIssueSink(input);
|
|
691
|
+
}
|
|
692
|
+
catch (error) {
|
|
693
|
+
console.error(`[operational-issue] record failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
670
696
|
setReportPublisher(fn) {
|
|
671
697
|
this.reportPublisher = fn;
|
|
672
698
|
}
|
|
@@ -1160,6 +1186,22 @@ class GatewayToolExecutor {
|
|
|
1160
1186
|
this.requireActiveTemporalAuthority(toolName);
|
|
1161
1187
|
});
|
|
1162
1188
|
}
|
|
1189
|
+
const rawFailure = rawResult;
|
|
1190
|
+
if (rawFailure.success === false) {
|
|
1191
|
+
// Captured BEFORE sanitizeGatewayFailureResult: the raw text only exists here, and
|
|
1192
|
+
// what the model receives is unchanged by this record. A code-carrying refusal is a
|
|
1193
|
+
// designed boundary (info); an uncoded failure is a defect candidate (warn).
|
|
1194
|
+
this.recordIssue({
|
|
1195
|
+
surface: 'gateway',
|
|
1196
|
+
signature: `${toolName}:${typeof rawFailure.code === 'string' ? rawFailure.code : 'failed'}`,
|
|
1197
|
+
severity: typeof rawFailure.code === 'string' ? 'info' : 'warn',
|
|
1198
|
+
error: typeof rawFailure.error === 'string'
|
|
1199
|
+
? rawFailure.error
|
|
1200
|
+
: String(rawFailure.code ?? 'failed'),
|
|
1201
|
+
sourceRef: activeCtx.channelId ?? undefined,
|
|
1202
|
+
ownerAgent: activeCtx.agentContext?.roleName,
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1163
1205
|
const shouldSanitizeAuditFailure = Boolean(activeCtx.temporalWorkContext) ||
|
|
1164
1206
|
toolName === 'context_compile' ||
|
|
1165
1207
|
toolName === 'code_act';
|
|
@@ -1174,6 +1216,14 @@ class GatewayToolExecutor {
|
|
|
1174
1216
|
}
|
|
1175
1217
|
}
|
|
1176
1218
|
catch (error) {
|
|
1219
|
+
this.recordIssue({
|
|
1220
|
+
surface: 'gateway',
|
|
1221
|
+
signature: `${toolName}:threw`,
|
|
1222
|
+
severity: 'error',
|
|
1223
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1224
|
+
sourceRef: activeCtx.channelId ?? undefined,
|
|
1225
|
+
ownerAgent: activeCtx.agentContext?.roleName,
|
|
1226
|
+
});
|
|
1177
1227
|
const shouldSanitizeAuditFailure = Boolean(activeCtx.temporalWorkContext) ||
|
|
1178
1228
|
toolName === 'context_compile' ||
|
|
1179
1229
|
toolName === 'code_act';
|
|
@@ -1674,6 +1724,14 @@ class GatewayToolExecutor {
|
|
|
1674
1724
|
return { report_slot_ids: [...slotIds].sort() };
|
|
1675
1725
|
}
|
|
1676
1726
|
alarmScopeMismatch(ctx, toolName) {
|
|
1727
|
+
this.recordIssue({
|
|
1728
|
+
surface: 'envelope',
|
|
1729
|
+
signature: `scope_mismatch:${toolName}`,
|
|
1730
|
+
severity: 'warn',
|
|
1731
|
+
error: `requested memory scopes outside the envelope (${ctx?.source ?? 'unknown'})`,
|
|
1732
|
+
sourceRef: ctx?.channelId ?? undefined,
|
|
1733
|
+
ownerAgent: ctx?.agentContext?.roleName,
|
|
1734
|
+
});
|
|
1677
1735
|
try {
|
|
1678
1736
|
this.metricsStore?.record({
|
|
1679
1737
|
name: 'envelope_scope_mismatch',
|
|
@@ -1852,6 +1910,154 @@ class GatewayToolExecutor {
|
|
|
1852
1910
|
success: true,
|
|
1853
1911
|
result: (0, drive_tools_js_1.asUntrustedDriveEvidence)(await this.driveTools.download(input, this.getExecutionState().signal)),
|
|
1854
1912
|
};
|
|
1913
|
+
case 'repair_request': {
|
|
1914
|
+
// Containment: this case writes ONE markdown file under the repairs root and
|
|
1915
|
+
// sends ONE text line. No spawn, no signal, no config write, no restart.
|
|
1916
|
+
if (!this.repairControls || !this.taskLedger) {
|
|
1917
|
+
return {
|
|
1918
|
+
success: false,
|
|
1919
|
+
code: 'repair_unavailable',
|
|
1920
|
+
error: 'repair_request needs the issue store, the task ledger and the owner notice.',
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
const requestedIssue = input.issue_id;
|
|
1924
|
+
if (typeof requestedIssue !== 'string' ||
|
|
1925
|
+
!this.repairControls.issueExists(requestedIssue)) {
|
|
1926
|
+
// A model-authored id must name an issue the host recorded; nothing is written otherwise.
|
|
1927
|
+
return {
|
|
1928
|
+
success: false,
|
|
1929
|
+
code: 'issue_not_found',
|
|
1930
|
+
error: "repair_request: issue_id must name an open operational issue from this turn's input.",
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
let bundle;
|
|
1934
|
+
try {
|
|
1935
|
+
bundle = (0, repair_request_js_1.writeRepairBundle)(input, this.repairControls.repairRoot());
|
|
1936
|
+
}
|
|
1937
|
+
catch (error) {
|
|
1938
|
+
return {
|
|
1939
|
+
success: false,
|
|
1940
|
+
code: 'repair_request_failed',
|
|
1941
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
const issueId = input.issue_id;
|
|
1945
|
+
if (bundle.created) {
|
|
1946
|
+
const state = this.getExecutionState();
|
|
1947
|
+
this.taskLedger.recordRepairRequest({
|
|
1948
|
+
issueId,
|
|
1949
|
+
repairId: bundle.repairId,
|
|
1950
|
+
runId: state.modelRunId ?? null,
|
|
1951
|
+
causeEventIds: state.causeEventIds,
|
|
1952
|
+
});
|
|
1953
|
+
try {
|
|
1954
|
+
this.repairControls.setIssueStatus(issueId, 'repair_requested');
|
|
1955
|
+
}
|
|
1956
|
+
catch (error) {
|
|
1957
|
+
return {
|
|
1958
|
+
success: false,
|
|
1959
|
+
code: 'repair_request_failed',
|
|
1960
|
+
error: `bundle written but the issue could not be marked: ${error instanceof Error ? error.message : String(error)}`,
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
try {
|
|
1964
|
+
await this.repairControls.notifyOwner(`MAMA filed repair request ${bundle.repairId} for issue ${issueId}.`);
|
|
1965
|
+
}
|
|
1966
|
+
catch (error) {
|
|
1967
|
+
// The file is the durable artifact; a failed notice is recorded, not fatal.
|
|
1968
|
+
this.recordIssue({
|
|
1969
|
+
surface: 'delivery',
|
|
1970
|
+
signature: 'repair_notice_failed',
|
|
1971
|
+
severity: 'warn',
|
|
1972
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
return {
|
|
1977
|
+
success: true,
|
|
1978
|
+
repair_id: bundle.repairId,
|
|
1979
|
+
created: bundle.created,
|
|
1980
|
+
message: bundle.created
|
|
1981
|
+
? `Repair request ${bundle.repairId} filed for ${issueId}.`
|
|
1982
|
+
: `Repair request ${bundle.repairId} already exists for ${issueId}.`,
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
case 'issue_close': {
|
|
1986
|
+
if (!this.repairControls) {
|
|
1987
|
+
return {
|
|
1988
|
+
success: false,
|
|
1989
|
+
code: 'repair_unavailable',
|
|
1990
|
+
error: 'issue_close needs the issue store.',
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
const { issue_id: closeId, reason } = input;
|
|
1994
|
+
if (typeof closeId !== 'string' || typeof reason !== 'string' || reason.trim() === '') {
|
|
1995
|
+
return {
|
|
1996
|
+
success: false,
|
|
1997
|
+
code: 'invalid_input',
|
|
1998
|
+
error: 'issue_id and reason are required',
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
try {
|
|
2002
|
+
this.repairControls.setIssueStatus(closeId, 'closed');
|
|
2003
|
+
}
|
|
2004
|
+
catch (error) {
|
|
2005
|
+
return {
|
|
2006
|
+
success: false,
|
|
2007
|
+
code: 'issue_close_failed',
|
|
2008
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
return { success: true, message: `Issue ${closeId} closed: ${reason.slice(0, 200)}` };
|
|
2012
|
+
}
|
|
2013
|
+
case 'file_export': {
|
|
2014
|
+
const exportInput = input;
|
|
2015
|
+
if (!this.taskLedger) {
|
|
2016
|
+
return {
|
|
2017
|
+
success: false,
|
|
2018
|
+
code: 'ledger_unavailable',
|
|
2019
|
+
error: 'file_export needs the task ledger to record its receipt.',
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
try {
|
|
2023
|
+
const result = await (0, file_export_js_1.exportFile)({
|
|
2024
|
+
format: exportInput.format,
|
|
2025
|
+
name: typeof exportInput.name === 'string' ? exportInput.name : 'export',
|
|
2026
|
+
columns: exportInput.columns,
|
|
2027
|
+
rows: exportInput.rows,
|
|
2028
|
+
content: exportInput.content,
|
|
2029
|
+
}, (0, file_export_js_1.resolveExportRoot)());
|
|
2030
|
+
const state = this.getExecutionState();
|
|
2031
|
+
try {
|
|
2032
|
+
this.taskLedger.recordFileExport({
|
|
2033
|
+
sha256: result.sha256,
|
|
2034
|
+
runId: state.modelRunId ?? null,
|
|
2035
|
+
causeEventIds: state.causeEventIds,
|
|
2036
|
+
channelId: state.channelId ?? null,
|
|
2037
|
+
payload: { format: exportInput.format, bytes: result.bytes },
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
catch (receiptError) {
|
|
2041
|
+
// No unrecorded durable change: a file without its receipt is removed again.
|
|
2042
|
+
(0, node_fs_1.unlinkSync)(result.path);
|
|
2043
|
+
throw receiptError;
|
|
2044
|
+
}
|
|
2045
|
+
return {
|
|
2046
|
+
success: true,
|
|
2047
|
+
path: result.path,
|
|
2048
|
+
bytes: result.bytes,
|
|
2049
|
+
sha256: result.sha256,
|
|
2050
|
+
message: `Wrote ${result.bytes} bytes to ${result.path}`,
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
catch (error) {
|
|
2054
|
+
return {
|
|
2055
|
+
success: false,
|
|
2056
|
+
code: 'file_export_failed',
|
|
2057
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
1855
2061
|
case 'drive_upload': {
|
|
1856
2062
|
const uploadInput = input;
|
|
1857
2063
|
const state = this.getExecutionState();
|