@mininglamp-oss/octo-runtime 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/help.js +5 -1
- package/apps/cli/dist/main.js +32 -6
- package/apps/cli/dist/manifest.json +5 -0
- package/apps/cli/dist/openclaw.js +32 -8
- package/apps/cli/dist/output.js +3 -0
- package/apps/cli/dist/playboard.d.ts +5 -0
- package/apps/cli/dist/playboard.js +41 -13
- package/dist/public/dsh.d.ts +2 -0
- package/dist/public/dsh.js +1 -0
- package/dist/public/executor-kernel.d.ts +1 -1
- package/dist/public/executor-kernel.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +26 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-DYOJCNWF.js +854 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-G5PWGRL5.js +209 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-UOQRXV3Q.js +340 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-client-LICENSE.txt +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-protocol-LICENSE.txt +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +35 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +52 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +306 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +11 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +13 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.d.ts +12 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +10 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +214 -55
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +24 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/hourly-log.js +11 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +12 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +30 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +15 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +29 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +32 -6
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +32 -8
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +41 -13
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -23
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.js +16 -6
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/systemd.js +9 -7
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +36 -11
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +16 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +152 -21
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +9 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +8 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +167 -25
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +23 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +43 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +283 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +15 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -13
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.js +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +26 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +104 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +44 -13
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +10 -7
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +141 -16
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-CXTvRGim.js +74 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +33 -9
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +9 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +39 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +76 -7
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +35 -29
- package/packages/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
- package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +443 -56
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +357 -37
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-DiPc-ipL.js +0 -74
|
@@ -4,7 +4,7 @@ import { shutdownDeadline, withinShutdown } from "@mininglamp-oss/octo-runtime-h
|
|
|
4
4
|
* 管理会话、排队、取消和交互归属;平台协议交给 connector,领域业务交给发起方。
|
|
5
5
|
*/
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
|
-
import { assertModelInputParts, failurePayload } from "@mininglamp-oss/octo-runtime-protocol";
|
|
7
|
+
import { assertModelInputParts, failurePayload, failureMessage } from "@mininglamp-oss/octo-runtime-protocol";
|
|
8
8
|
import { ImImageInputError } from "../transport/image-input.js";
|
|
9
9
|
import { performance } from "node:perf_hooks";
|
|
10
10
|
import { imBotIdentity, validateImConfig } from "../lifecycle/configuration.js";
|
|
@@ -23,6 +23,7 @@ export class ImRuntime {
|
|
|
23
23
|
dependencies;
|
|
24
24
|
#processEpoch = randomUUID();
|
|
25
25
|
#preparing = new Map();
|
|
26
|
+
#finalDeliveries = new Map();
|
|
26
27
|
config;
|
|
27
28
|
#connector;
|
|
28
29
|
#delivery;
|
|
@@ -37,6 +38,7 @@ export class ImRuntime {
|
|
|
37
38
|
#draining = false;
|
|
38
39
|
#ownerStopped;
|
|
39
40
|
#drainErrors = [];
|
|
41
|
+
#finishIncomplete;
|
|
40
42
|
#state = "stopped";
|
|
41
43
|
#reconnect;
|
|
42
44
|
#connecting;
|
|
@@ -47,6 +49,7 @@ export class ImRuntime {
|
|
|
47
49
|
#error;
|
|
48
50
|
#working = 0;
|
|
49
51
|
#busyNotifications = new Map();
|
|
52
|
+
#failureNotifications = new Map();
|
|
50
53
|
#busyNotifiedAt = new Map();
|
|
51
54
|
#retry = 0;
|
|
52
55
|
#disconnecting;
|
|
@@ -263,10 +266,11 @@ export class ImRuntime {
|
|
|
263
266
|
this.#reconnect = setTimeout(wake, Math.min(delayMs, 2_147_483_647));
|
|
264
267
|
this.#reconnect.unref();
|
|
265
268
|
}
|
|
266
|
-
#diagnostic(code, runId) {
|
|
269
|
+
#diagnostic(code, runId, data = {}) {
|
|
267
270
|
try {
|
|
268
271
|
this.dependencies.log?.("warn", "channel.diagnostic", {
|
|
269
272
|
code,
|
|
273
|
+
...data,
|
|
270
274
|
endpoint_id: imBotIdentity(this.config),
|
|
271
275
|
...(runId ? { run_id: runId } : {})
|
|
272
276
|
});
|
|
@@ -394,11 +398,23 @@ export class ImRuntime {
|
|
|
394
398
|
return;
|
|
395
399
|
}
|
|
396
400
|
let session;
|
|
401
|
+
// 只有 read 的同步失败属于执行前存储故障,排队、控制及后续保存不进入此分类。
|
|
397
402
|
try {
|
|
398
403
|
session = this.#session(key);
|
|
404
|
+
}
|
|
405
|
+
catch {
|
|
406
|
+
const failure = failurePayload({ code: "IM_SESSION_STORE_FAILED" }, {
|
|
407
|
+
stage: "channel_session_read",
|
|
408
|
+
defaultDomain: "runtime"
|
|
409
|
+
}).failure;
|
|
410
|
+
void this.#notifyFailure(message, failure).finally(() => this.#seen.delete(dedupe));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
399
414
|
if (command === "/reset" || command === "/new") {
|
|
400
415
|
try {
|
|
401
416
|
const binding = this.#sessionStore.reset(key, message.messageId);
|
|
417
|
+
this.#finalDeliveries.get(key)?.abort();
|
|
402
418
|
this.#tasks.get(key)?.task.stopRetries();
|
|
403
419
|
session.id = binding.id;
|
|
404
420
|
session.generation = binding.generation;
|
|
@@ -420,10 +436,12 @@ export class ImRuntime {
|
|
|
420
436
|
// 控制命令绕过普通消息队列,否则 stop 会排在待取消的长任务之后。
|
|
421
437
|
const preparation = this.#preparing.get(key);
|
|
422
438
|
preparation?.abort();
|
|
439
|
+
const delivery = this.#finalDeliveries.get(key);
|
|
440
|
+
delivery?.abort();
|
|
423
441
|
const invocationId = session.activeInvocationId;
|
|
424
442
|
void (async () => {
|
|
425
443
|
const task = this.#tasks.get(key)?.task;
|
|
426
|
-
const cancelled = preparation
|
|
444
|
+
const cancelled = preparation || delivery
|
|
427
445
|
? true
|
|
428
446
|
: task
|
|
429
447
|
? await task.cancel()
|
|
@@ -439,7 +457,7 @@ export class ImRuntime {
|
|
|
439
457
|
}
|
|
440
458
|
catch {
|
|
441
459
|
this.#seen.delete(dedupe);
|
|
442
|
-
this.#diagnostic("
|
|
460
|
+
this.#diagnostic("IM_INBOUND_PROCESSING_FAILED");
|
|
443
461
|
}
|
|
444
462
|
finally {
|
|
445
463
|
if (session)
|
|
@@ -511,7 +529,9 @@ export class ImRuntime {
|
|
|
511
529
|
const previous = this.#sessionStore.occurrence(key, id);
|
|
512
530
|
if (previous) {
|
|
513
531
|
void this.#reply(message, previous.text === message.text
|
|
514
|
-
?
|
|
532
|
+
? previous.notSubmittedFailure
|
|
533
|
+
? `原消息尚未提交,请修复故障后重新发送。\n错误码:${previous.notSubmittedFailure.code}\n诊断编号:${previous.notSubmittedFailure.diagnosticId}`
|
|
534
|
+
: "该消息已经提交,请查看原执行结果。"
|
|
515
535
|
: "消息身份冲突,请重新发送。", `duplicate:${id}`);
|
|
516
536
|
return false;
|
|
517
537
|
}
|
|
@@ -599,12 +619,64 @@ export class ImRuntime {
|
|
|
599
619
|
});
|
|
600
620
|
this.#busyNotifications.set(key, notification);
|
|
601
621
|
}
|
|
602
|
-
|
|
622
|
+
/** 独立错误展示不复用已坏的 presentation;共享有界投递,迟到失败不触发再次执行或递归通知。 */
|
|
623
|
+
#notifyFailure(message, failure, identity, retry = false) {
|
|
624
|
+
const data = {
|
|
625
|
+
code: failure.code,
|
|
626
|
+
reason_code: failure.reasonCode,
|
|
627
|
+
diagnostic_id: failure.diagnosticId,
|
|
628
|
+
stage: failure.stage,
|
|
629
|
+
failure_component: failure.source.component,
|
|
630
|
+
occurred_at: failure.occurredAt,
|
|
631
|
+
...(failure.source.adapter ? { adapter_type: failure.source.adapter } : {}),
|
|
632
|
+
...(identity ? { invocation_id: identity.invocationId, session_id: identity.sessionId } : {})
|
|
633
|
+
};
|
|
634
|
+
this.#diagnostic(failure.reasonCode, identity?.runId, data);
|
|
635
|
+
if (this.#failureNotifications.size >= 64 || this.#closed || !this.#delivery)
|
|
636
|
+
return Promise.resolve();
|
|
637
|
+
const until = shutdownDeadline(this.dependencies.signal);
|
|
638
|
+
const effect = `failure:${message.messageId}:${failure.diagnosticId}`;
|
|
639
|
+
const text = `${retry ? "本次重试未提交,之前的执行记录仍须核查。" : failureMessage(failure.code)}\n错误码:${failure.code}\n诊断编号:${failure.diagnosticId}`;
|
|
640
|
+
const event = {
|
|
641
|
+
protocolVersion: 2,
|
|
642
|
+
type: "run.failed",
|
|
643
|
+
payload: { code: failure.reasonCode, message: text, failure }
|
|
644
|
+
};
|
|
645
|
+
const delivery = this.#delivery;
|
|
646
|
+
const options = { transient: true, obsolete: () => this.#closed || performance.now() >= until };
|
|
647
|
+
const secondary = (code) => {
|
|
648
|
+
this.#diagnostic(code, identity?.runId, {
|
|
649
|
+
...data,
|
|
650
|
+
code,
|
|
651
|
+
reason_code: code,
|
|
652
|
+
primary_code: failure.code
|
|
653
|
+
});
|
|
654
|
+
if (this.#draining)
|
|
655
|
+
this.#drainErrors.push(new Error(code));
|
|
656
|
+
};
|
|
657
|
+
const send = async (operation, key) => {
|
|
658
|
+
const receipt = await delivery.deliver(key, operation, options);
|
|
659
|
+
if (receipt.state !== "delivered")
|
|
660
|
+
secondary(receipt.code ?? "IM_DELIVERY_FAILED");
|
|
661
|
+
};
|
|
662
|
+
const notification = withinShutdown(Promise.allSettled([
|
|
663
|
+
...(message.replyFailure ? [send(() => message.replyFailure(event, effect), effect)] : []),
|
|
664
|
+
send(() => message.reply(text, `${effect}:text`), `${effect}:text`)
|
|
665
|
+
]), until, "IM_DELIVERY_UNKNOWN")
|
|
666
|
+
.then(() => undefined)
|
|
667
|
+
.catch(() => secondary("IM_DELIVERY_UNKNOWN"))
|
|
668
|
+
.finally(() => this.#failureNotifications.delete(failure.diagnosticId));
|
|
669
|
+
this.#failureNotifications.set(failure.diagnosticId, notification);
|
|
670
|
+
return notification;
|
|
671
|
+
}
|
|
672
|
+
async #reply(message, text, effectKey, requireDelivered = false, final = false, allowUnknownNotice = true, finalOptions) {
|
|
603
673
|
if (this.#closed || this.#signal.aborted || !this.#delivery)
|
|
604
674
|
return;
|
|
605
675
|
const receipt = await this.#delivery.deliver(effectKey, () => final && message.replyFinal
|
|
606
|
-
? message.replyFinal(text, effectKey)
|
|
607
|
-
: message.reply(text, effectKey));
|
|
676
|
+
? message.replyFinal(text, effectKey, finalOptions)
|
|
677
|
+
: message.reply(text, effectKey), { obsolete: finalOptions ? () => finalOptions.obsolete() : undefined });
|
|
678
|
+
if (finalOptions?.obsolete())
|
|
679
|
+
return;
|
|
608
680
|
if (receipt.state !== "delivered") {
|
|
609
681
|
if (this.#draining)
|
|
610
682
|
this.#drainErrors.push(new Error(receipt.code ?? "IM_DELIVERY_FAILED"));
|
|
@@ -868,10 +940,15 @@ export class ImRuntime {
|
|
|
868
940
|
});
|
|
869
941
|
const controls = this.#runControls(message, key, request.invocationId);
|
|
870
942
|
let presentation;
|
|
943
|
+
let executionStarted = false;
|
|
944
|
+
let presentationFailed = false;
|
|
945
|
+
let localFailure;
|
|
946
|
+
const delivery = new AbortController();
|
|
871
947
|
try {
|
|
872
948
|
presentation = message.beginPresentation?.(rootRunId, (code) => this.#diagnostic(code, rootRunId), controls);
|
|
873
949
|
presentation?.update(snapshot());
|
|
874
950
|
session.activeInvocationId = request.invocationId;
|
|
951
|
+
executionStarted = true;
|
|
875
952
|
for await (const event of task.events()) {
|
|
876
953
|
if (this.#closed || this.#signal.aborted)
|
|
877
954
|
break;
|
|
@@ -925,7 +1002,8 @@ export class ImRuntime {
|
|
|
925
1002
|
const interaction = event.payload;
|
|
926
1003
|
let cardShown = false;
|
|
927
1004
|
try {
|
|
928
|
-
cardShown =
|
|
1005
|
+
cardShown =
|
|
1006
|
+
!presentationFailed && ((await presentation?.interaction?.(interaction)) ?? false);
|
|
929
1007
|
}
|
|
930
1008
|
catch {
|
|
931
1009
|
this.#diagnostic("IM_INTERACTION_CARD_FAILED", request.runId);
|
|
@@ -940,12 +1018,13 @@ export class ImRuntime {
|
|
|
940
1018
|
? `/approve ${interaction.interactionId} 或 /decline ${interaction.interactionId}`
|
|
941
1019
|
: `/respond ${interaction.interactionId} ${interaction.kind === "elicitation" ? "<JSON>" : "<回答>"}`;
|
|
942
1020
|
if (!cardShown)
|
|
943
|
-
await this.#reply(message, `${summary?.slice(0, 1000) ?? "执行需要你的确认或输入。"}\n${Array.isArray(interaction.request.questions) ? JSON.stringify(interaction.request.questions).slice(0, 8000) + "\n请按问题 ID 提交 JSON 答案。\n" : ""}${instruction}`, `interaction:${interaction.interactionId}
|
|
1021
|
+
await this.#reply(message, `${summary?.slice(0, 1000) ?? "执行需要你的确认或输入。"}\n${Array.isArray(interaction.request.questions) ? JSON.stringify(interaction.request.questions).slice(0, 8000) + "\n请按问题 ID 提交 JSON 答案。\n" : ""}${instruction}`, `interaction:${interaction.interactionId}`, true);
|
|
944
1022
|
}
|
|
945
1023
|
if (event.type === "interaction.resolved") {
|
|
946
1024
|
this.#interactions.delete(event.payload.interactionId);
|
|
947
1025
|
try {
|
|
948
|
-
|
|
1026
|
+
if (!presentationFailed)
|
|
1027
|
+
await presentation?.resolveInteraction?.(event.payload.interactionId, event.payload.status);
|
|
949
1028
|
}
|
|
950
1029
|
catch {
|
|
951
1030
|
this.#diagnostic("IM_INTERACTION_CARD_FAILED", request.runId);
|
|
@@ -953,13 +1032,37 @@ export class ImRuntime {
|
|
|
953
1032
|
}
|
|
954
1033
|
projector.accept(event);
|
|
955
1034
|
controls.failed = projector.snapshot().terminal === "failed";
|
|
956
|
-
|
|
1035
|
+
if (!presentationFailed) {
|
|
1036
|
+
try {
|
|
1037
|
+
presentation?.update(snapshot());
|
|
1038
|
+
}
|
|
1039
|
+
catch {
|
|
1040
|
+
presentationFailed = true;
|
|
1041
|
+
this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
|
|
1042
|
+
// 展示故障不关闭原迭代器;请求停止后仍由同一消费者确认真实终态。
|
|
1043
|
+
if (!projector.snapshot().terminal)
|
|
1044
|
+
void task
|
|
1045
|
+
.cancelExecution("IM presentation failed")
|
|
1046
|
+
.catch(() => this.#diagnostic("IM_CANCEL_FAILED", request.runId));
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
957
1049
|
}
|
|
958
1050
|
if (!projector.snapshot().terminal)
|
|
959
1051
|
throw new Error("IM_RUN_WITHOUT_TERMINAL");
|
|
960
1052
|
}
|
|
961
1053
|
catch {
|
|
962
|
-
if (!
|
|
1054
|
+
if (!executionStarted || task.notSubmittedFailure) {
|
|
1055
|
+
localFailure =
|
|
1056
|
+
task.notSubmittedFailure ??
|
|
1057
|
+
failurePayload({ code: "IM_PRESENTATION_INITIALIZATION_FAILED" }, {
|
|
1058
|
+
stage: "channel_presentation_initialize",
|
|
1059
|
+
defaultDomain: "runtime",
|
|
1060
|
+
runId: request.runId
|
|
1061
|
+
}).failure;
|
|
1062
|
+
controls.failed = false;
|
|
1063
|
+
await this.#notifyFailure(message, localFailure, request, task.attempts.length > 1);
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
963
1066
|
if (this.#draining)
|
|
964
1067
|
this.#drainErrors.push(new Error("IM_EXECUTION_RESULT_UNKNOWN"));
|
|
965
1068
|
// 流断开无法证明执行失败;尽力取消并提示核查,不自动重跑潜在的业务副作用。
|
|
@@ -967,10 +1070,18 @@ export class ImRuntime {
|
|
|
967
1070
|
.cancelInvocation(request.invocationId, "IM execution stream failed")
|
|
968
1071
|
.catch(() => undefined);
|
|
969
1072
|
this.#diagnostic("IM_EXECUTION_RESULT_UNKNOWN", request.runId);
|
|
970
|
-
|
|
1073
|
+
// 原源流即使在终态后失败,也不能被展示层的终态掩盖。
|
|
1074
|
+
controls.failed = false;
|
|
1075
|
+
projector = new ImRunProjector(rootRunId, message.conversationKind === "direct");
|
|
1076
|
+
if (!presentationFailed) {
|
|
1077
|
+
try {
|
|
1078
|
+
presentation?.update({ ...snapshot(), resultUnknown: true });
|
|
1079
|
+
}
|
|
1080
|
+
catch {
|
|
1081
|
+
this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
971
1084
|
}
|
|
972
|
-
else if (this.#draining)
|
|
973
|
-
this.#drainErrors.push(new Error("IM_RUN_FINALIZATION_FAILED"));
|
|
974
1085
|
}
|
|
975
1086
|
finally {
|
|
976
1087
|
if (rulesEnabled)
|
|
@@ -996,8 +1107,11 @@ export class ImRuntime {
|
|
|
996
1107
|
run_id: rootRunId,
|
|
997
1108
|
invocation_id: request.invocationId,
|
|
998
1109
|
session_id: request.sessionId,
|
|
999
|
-
status: projector.snapshot().terminal ?? "unknown"
|
|
1110
|
+
status: localFailure ? "not_submitted" : (projector.snapshot().terminal ?? "unknown")
|
|
1000
1111
|
});
|
|
1112
|
+
// 移除执行身份前移交收尾/产物投递的取消权;finish 等待期间的 stop 不能落入空窗。
|
|
1113
|
+
if (!localFailure)
|
|
1114
|
+
this.#finalDeliveries.set(key, delivery);
|
|
1001
1115
|
this.#tasks.delete(key);
|
|
1002
1116
|
try {
|
|
1003
1117
|
// 长任务结束后重新开始终态去重窗口,保留有界尝试身份,避免立即重复执行。
|
|
@@ -1008,7 +1122,11 @@ export class ImRuntime {
|
|
|
1008
1122
|
sessionId: request.sessionId,
|
|
1009
1123
|
runId: rootRunId,
|
|
1010
1124
|
snapshot: saved,
|
|
1011
|
-
attempts: task.attempts.map((attempt) => ({ ...attempt }))
|
|
1125
|
+
attempts: task.attempts.map((attempt) => ({ ...attempt })),
|
|
1126
|
+
...(localFailure &&
|
|
1127
|
+
task.attempts.every((attempt) => attempt.outcome === "not_submitted")
|
|
1128
|
+
? { notSubmittedFailure: localFailure }
|
|
1129
|
+
: {})
|
|
1012
1130
|
});
|
|
1013
1131
|
}
|
|
1014
1132
|
catch {
|
|
@@ -1020,17 +1138,38 @@ export class ImRuntime {
|
|
|
1020
1138
|
this.#interactions.delete(id);
|
|
1021
1139
|
try {
|
|
1022
1140
|
if (!this.#closed)
|
|
1023
|
-
await presentation?.finish();
|
|
1141
|
+
await withinShutdown(Promise.resolve().then(() => presentation?.finish()), shutdownDeadline(this.dependencies.signal), "IM_PRESENTATION_FINISH_INCOMPLETE");
|
|
1024
1142
|
}
|
|
1025
|
-
catch {
|
|
1143
|
+
catch (error) {
|
|
1144
|
+
// 截止只结束等待,不能证明尚未完成的展示资源已经释放。
|
|
1145
|
+
if (error instanceof Error && error.message === "IM_PRESENTATION_FINISH_INCOMPLETE")
|
|
1146
|
+
this.#finishIncomplete ??= error;
|
|
1026
1147
|
this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
|
|
1027
1148
|
}
|
|
1028
1149
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1150
|
+
try {
|
|
1151
|
+
if (localFailure || this.#closed || this.#signal.aborted || delivery.signal.aborted)
|
|
1152
|
+
return;
|
|
1153
|
+
const { text, allowMention } = projector.finalReply;
|
|
1154
|
+
const obsolete = () => {
|
|
1155
|
+
const binding = this.#sessionStore.read(key);
|
|
1156
|
+
return (binding?.id !== request.sessionId || binding.generation !== request.sessionGeneration);
|
|
1157
|
+
};
|
|
1158
|
+
// reset 不取消原模型执行,但旧代次的结果不能启动上传或继续最终消息重试。
|
|
1159
|
+
if (allowMention && obsolete())
|
|
1160
|
+
return;
|
|
1161
|
+
const deliverySignal = AbortSignal.any([this.#signal, delivery.signal]);
|
|
1162
|
+
// 最终文本拥有独立投递身份,即使进度卡投递失败,也必须尝试回复用户。
|
|
1163
|
+
await this.#reply(message, text, `final:${rootRunId}`, false, allowMention, projector.snapshot().terminal !== "cancelled", {
|
|
1164
|
+
artifacts: prepared.artifacts,
|
|
1165
|
+
signal: deliverySignal,
|
|
1166
|
+
obsolete: () => deliverySignal.aborted || (allowMention && obsolete())
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
finally {
|
|
1170
|
+
if (this.#finalDeliveries.get(key) === delivery)
|
|
1171
|
+
this.#finalDeliveries.delete(key);
|
|
1172
|
+
}
|
|
1034
1173
|
}
|
|
1035
1174
|
#saveBinding(key, session) {
|
|
1036
1175
|
if (this.#closed)
|
|
@@ -1104,11 +1243,14 @@ export class ImRuntime {
|
|
|
1104
1243
|
attempt(() => this.#connector?.close()),
|
|
1105
1244
|
attempt(() => this.#connecting),
|
|
1106
1245
|
attempt(() => this.#disconnecting),
|
|
1246
|
+
...[...this.#failureNotifications.values()].map((notification) => attempt(() => notification)),
|
|
1107
1247
|
...[...this.#busyNotifications.values()].map((notification) => attempt(() => notification))
|
|
1108
1248
|
]);
|
|
1109
1249
|
if (!this.dependencies.sessions)
|
|
1110
1250
|
await attempt(() => this.#sessionStore.close?.());
|
|
1111
1251
|
errors.push(...this.#drainErrors);
|
|
1252
|
+
if (this.#finishIncomplete)
|
|
1253
|
+
errors.push(this.#finishIncomplete);
|
|
1112
1254
|
if (errors.length)
|
|
1113
1255
|
throw new AggregateError(errors, "IM_DISPOSE_FAILED");
|
|
1114
1256
|
this.#sessions.clear();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImInvocationInput } from "../execution/dispatcher.js";
|
|
2
|
-
import type { ProviderSession } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
import type { FailureEnvelope, ProviderSession } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
3
|
import type { ImTaskAttempt } from "../contracts.js";
|
|
4
4
|
import type { ImGapMetadata, ImGapTurnToken } from "./context-gap.js";
|
|
5
5
|
import type { ImRulesContext } from "./rules-context.js";
|
|
@@ -9,6 +9,8 @@ export interface ImSessionOccurrence {
|
|
|
9
9
|
runId: string;
|
|
10
10
|
snapshot?: ImInvocationInput;
|
|
11
11
|
attempts?: ImTaskAttempt[];
|
|
12
|
+
/** 仅整轮没有已执行或未知尝试时保存;旧记录缺省不推测执行事实。 */
|
|
13
|
+
notSubmittedFailure?: FailureEnvelope;
|
|
12
14
|
}
|
|
13
15
|
export interface ImSessionBinding {
|
|
14
16
|
id?: string;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { ApprovalMode, ContextEnvelope, ContextItem, CanonicalEvent, InteractionResponse, InteractionRequestedPayload, InvokeEnvironment, ModelInputPart, ProviderSession } from "@mininglamp-oss/octo-runtime-protocol";
|
|
5
5
|
import type { RunPresentation } from "./presentation/run-projector.js";
|
|
6
6
|
import type { ImGapPlan, ImGapTurnToken } from "./application/context-gap.js";
|
|
7
|
+
import type { ImArtifactPolicy } from "./delivery/artifact-policy.js";
|
|
7
8
|
export interface ImPositionObservation {
|
|
8
9
|
conversationId: string;
|
|
9
10
|
conversationKind: "group" | "thread";
|
|
@@ -47,6 +48,22 @@ export interface OctoBotConfig extends ImCommonConfig {
|
|
|
47
48
|
group_ids?: string[] | null;
|
|
48
49
|
cards?: boolean;
|
|
49
50
|
typing?: boolean;
|
|
51
|
+
/** 渠道固定产物交付;由宿主配置,模型 Context 不能扩大文件访问范围。 */
|
|
52
|
+
artifact_delivery?: {
|
|
53
|
+
mode?: "channel" | "tools";
|
|
54
|
+
allowed_roots?: string[];
|
|
55
|
+
allowed_mime_types?: string[];
|
|
56
|
+
max_file_bytes?: number;
|
|
57
|
+
max_total_bytes?: number;
|
|
58
|
+
max_files?: number;
|
|
59
|
+
timeout_ms?: number;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** 成功 final 的冻结投递合同;signal 归当前交付所有,不能复用已终态的模型 signal。 */
|
|
63
|
+
export interface ImFinalReplyOptions {
|
|
64
|
+
artifacts: ImArtifactPolicy;
|
|
65
|
+
signal: AbortSignal;
|
|
66
|
+
obsolete(): boolean;
|
|
50
67
|
}
|
|
51
68
|
export type ImBotConfig = OctoBotConfig;
|
|
52
69
|
/** Authenticated scope, resolved from octo-auth rather than caller configuration. */
|
|
@@ -69,7 +86,7 @@ export interface ImInboundMessage {
|
|
|
69
86
|
text: string;
|
|
70
87
|
buildInputs?(signal: AbortSignal): Promise<ModelInputPart[]>;
|
|
71
88
|
reply(text: string, effectKey?: string): Promise<void>;
|
|
72
|
-
replyFinal?(text: string, effectKey: string): Promise<void>;
|
|
89
|
+
replyFinal?(text: string, effectKey: string, options?: ImFinalReplyOptions): Promise<void>;
|
|
73
90
|
replyFailure?(event: CanonicalEvent, effectKey: string): Promise<void>;
|
|
74
91
|
replyDeliveryUnknown?(event: CanonicalEvent, effectKey: string, replyEffectKey: string, signal: AbortSignal): Promise<void>;
|
|
75
92
|
isReplyDelivered?(effectKey: string): boolean;
|
|
@@ -99,6 +116,7 @@ export interface ImRunControls {
|
|
|
99
116
|
export interface ImTaskAttempt {
|
|
100
117
|
runId: string;
|
|
101
118
|
invocationId: string;
|
|
119
|
+
/** not_submitted 是本次调用事实,不是 Provider 执行终态或整轮未执行的证明。 */
|
|
102
120
|
outcome: string;
|
|
103
121
|
failureCode?: string;
|
|
104
122
|
diagnosticId?: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContextEnvelope, ContextItem } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
import type { OctoBotConfig } from "../contracts.js";
|
|
3
|
+
export interface ImArtifactPolicy {
|
|
4
|
+
mode: "channel" | "tools";
|
|
5
|
+
workspace?: string;
|
|
6
|
+
local: boolean;
|
|
7
|
+
roots: string[];
|
|
8
|
+
mimeTypes?: string[];
|
|
9
|
+
maxFileBytes: number;
|
|
10
|
+
maxTotalBytes: number;
|
|
11
|
+
maxFiles: number;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const ARTIFACT_LIMITS: {
|
|
15
|
+
readonly max_file_bytes: number;
|
|
16
|
+
readonly max_total_bytes: number;
|
|
17
|
+
readonly max_files: 16;
|
|
18
|
+
readonly timeout_ms: 30000;
|
|
19
|
+
};
|
|
20
|
+
/** 从可信配置及实际执行目录派生合同;远程 preset 的同名主机路径永不成为可读产物。 */
|
|
21
|
+
export declare function artifactPolicy(config: OctoBotConfig, context: ContextEnvelope, local: boolean): ImArtifactPolicy;
|
|
22
|
+
/** 在执行前向模型明示两种行为;这里只传递约定,不接受模型改写后的访问授权。 */
|
|
23
|
+
export declare function artifactContext(policy: ImArtifactPolicy): ContextItem;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const ARTIFACT_LIMITS = {
|
|
2
|
+
max_file_bytes: 20 * 1024 * 1024,
|
|
3
|
+
max_total_bytes: 50 * 1024 * 1024,
|
|
4
|
+
max_files: 16,
|
|
5
|
+
timeout_ms: 30_000
|
|
6
|
+
};
|
|
7
|
+
/** 从可信配置及实际执行目录派生合同;远程 preset 的同名主机路径永不成为可读产物。 */
|
|
8
|
+
export function artifactPolicy(config, context, local) {
|
|
9
|
+
const options = config.artifact_delivery;
|
|
10
|
+
const workspace = context.items.find((item) => item.namespace === "octo.execution" && item.name === "workspace")?.payload.path;
|
|
11
|
+
return {
|
|
12
|
+
mode: options?.mode ?? "channel",
|
|
13
|
+
...(typeof workspace === "string" ? { workspace } : {}),
|
|
14
|
+
local,
|
|
15
|
+
roots: [...(options?.allowed_roots ?? (typeof workspace === "string" ? [workspace] : []))],
|
|
16
|
+
...(options?.allowed_mime_types ? { mimeTypes: [...options.allowed_mime_types] } : {}),
|
|
17
|
+
maxFileBytes: options?.max_file_bytes ?? ARTIFACT_LIMITS.max_file_bytes,
|
|
18
|
+
maxTotalBytes: options?.max_total_bytes ?? ARTIFACT_LIMITS.max_total_bytes,
|
|
19
|
+
maxFiles: options?.max_files ?? ARTIFACT_LIMITS.max_files,
|
|
20
|
+
timeoutMs: options?.timeout_ms ?? ARTIFACT_LIMITS.timeout_ms
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** 在执行前向模型明示两种行为;这里只传递约定,不接受模型改写后的访问授权。 */
|
|
24
|
+
export function artifactContext(policy) {
|
|
25
|
+
return {
|
|
26
|
+
namespace: "extra.im",
|
|
27
|
+
name: "artifact-delivery",
|
|
28
|
+
guidance: policy.mode === "channel"
|
|
29
|
+
? "This channel delivers generated local output files referenced in your successful final reply. Create outputs in the effective workspace and use Markdown links or images (including reference style). Gateway's deterministic delivery workflow uploads accessible, policy-allowed files as IM attachments, rewrites their targets and sends native file cards for ordinary file links alongside this same final reply. Display image outputs inline with ; a plain download link alone is not image delivery. Images alone do not add file cards. Offer a separate image download link only when requested. This workflow does not publish HTML, create online documents, grant document permissions or save to Drive. Explicit user requests to upload, publish, collaborate on an online document or perform another business action still use your normal tool calls; preserve their returned remote URLs. Do not send a duplicate final reply with a messaging tool. Code, quoted examples, and directory contents are not collected. Remote provider files cannot be retrieved by Gateway."
|
|
30
|
+
: "This channel does not automatically upload output files. Use normal tool calls when the task requires file delivery and return recipient-accessible URLs. Do not present runtime-local paths as downloadable attachments. Do not send a duplicate final reply with a messaging tool.",
|
|
31
|
+
payload: {
|
|
32
|
+
mode: policy.mode,
|
|
33
|
+
localWorkspaceAccessible: policy.local,
|
|
34
|
+
...(policy.workspace ? { workspace: policy.workspace } : {}),
|
|
35
|
+
allowedRoots: policy.roots,
|
|
36
|
+
...(policy.mimeTypes ? { allowedMimeTypes: policy.mimeTypes } : {}),
|
|
37
|
+
maxFileBytes: policy.maxFileBytes,
|
|
38
|
+
maxTotalBytes: policy.maxTotalBytes,
|
|
39
|
+
maxFiles: policy.maxFiles,
|
|
40
|
+
timeoutMs: policy.timeoutMs
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ImArtifactPolicy } from "./artifact-policy.js";
|
|
2
|
+
export type ArtifactUpload = (bytes: Uint8Array, filename: string, mime: string, signal: AbortSignal) => Promise<string>;
|
|
3
|
+
/** 已核验并上传的文件元数据;不向发送层暴露本机路径。 */
|
|
4
|
+
export interface ArtifactFile {
|
|
5
|
+
url: string;
|
|
6
|
+
name: string;
|
|
7
|
+
size: number;
|
|
8
|
+
extension: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PreparedArtifacts {
|
|
11
|
+
text: string;
|
|
12
|
+
files: ArtifactFile[];
|
|
13
|
+
}
|
|
14
|
+
/** 只交付成功 final 的显式引用;失败不改变生成终态,缓存由 transport 的 final effect 闭包持有。 */
|
|
15
|
+
export declare function prepareArtifacts(text: string, policy: ImArtifactPolicy, ownerSignal: AbortSignal, upload: ArtifactUpload): Promise<PreparedArtifacts>;
|