@mininglamp-oss/octo-runtime 1.1.3 → 1.1.5
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 +62 -38
- package/apps/cli/README.md +58 -22
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/cli-entrypoint.d.ts +2 -0
- package/apps/cli/dist/cli-entrypoint.js +16 -0
- package/apps/cli/dist/command-tree.d.ts +20 -0
- package/apps/cli/dist/command-tree.js +402 -0
- package/apps/cli/dist/extra-command-config.d.ts +4 -0
- package/apps/cli/dist/extra-command-config.js +50 -0
- package/apps/cli/dist/extra-commands.d.ts +15 -0
- package/apps/cli/dist/extra-commands.js +275 -0
- package/apps/cli/dist/extras.js +14 -2
- package/apps/cli/dist/global-extras.d.ts +16 -0
- package/apps/cli/dist/global-extras.js +201 -0
- package/apps/cli/dist/help.d.ts +4 -1
- package/apps/cli/dist/help.js +31 -75
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +53 -63
- package/apps/cli/dist/manifest.json +53 -3
- package/apps/cli/dist/module-manifest.d.ts +1 -1
- package/apps/cli/dist/module-manifest.js +3 -2
- package/apps/cli/dist/openclaw.js +32 -8
- package/apps/cli/dist/output.js +16 -2
- package/apps/cli/dist/playboard.d.ts +5 -0
- package/apps/cli/dist/playboard.js +41 -13
- package/apps/cli/dist/service-control.js +2 -2
- package/apps/cli/dist/state.js +48 -19
- package/dist/public/channel-gateway-commands.d.ts +1 -0
- package/dist/public/channel-gateway-commands.js +1 -0
- package/dist/public/channel-wecom-commands.d.ts +1 -0
- package/dist/public/channel-wecom-commands.js +1 -0
- 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/dist/public/extra.d.ts +1 -0
- package/dist/public/extra.js +1 -0
- package/dist/public/host.d.ts +2 -4
- package/dist/public/host.js +1 -2
- package/dist/public/webui-commands.d.ts +1 -0
- package/dist/public/webui-commands.js +1 -0
- 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/module-manifest.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +16 -4
- 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/cli-entrypoint.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +402 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +50 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +275 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +14 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +201 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +31 -75
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +53 -63
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +53 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +32 -8
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +16 -2
- 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/dist/service-control.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -19
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +25 -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 +170 -28
- 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/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +124 -0
- 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.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +4 -3
- 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/connection-error.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +44 -3
- 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 +18 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +10 -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/dist/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +128 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +51 -0
- 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 +7 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +70 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +16 -0
- 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/dist/index.d.ts +1 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +8 -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/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1172 -0
- package/node_modules/commander/index.js +21 -0
- package/node_modules/commander/lib/argument.js +147 -0
- package/node_modules/commander/lib/command.js +2790 -0
- package/node_modules/commander/lib/error.js +36 -0
- package/node_modules/commander/lib/help.js +731 -0
- package/node_modules/commander/lib/option.js +377 -0
- package/node_modules/commander/lib/suggestSimilar.js +99 -0
- package/node_modules/commander/package-support.json +19 -0
- package/node_modules/commander/package.json +64 -0
- package/node_modules/commander/typings/index.d.ts +1113 -0
- package/package.json +49 -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
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.d.ts +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.js +0 -22
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.d.ts +0 -16
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.js +0 -160
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname } from "node:path";
|
|
5
5
|
/**
|
|
@@ -16,11 +16,15 @@ export class InvocationManifest {
|
|
|
16
16
|
}
|
|
17
17
|
static async open(path) {
|
|
18
18
|
const reap = await reapOrphanedInvocationManifest(path);
|
|
19
|
+
if (reap.reason === "cleanup_incomplete") {
|
|
20
|
+
throw Object.assign(new Error(`Orphan cleanup is unconfirmed: ${path}. After stopping all orphan tools, use acknowledgeOrphanCleanup(path), then retry startup.`), { code: "ORPHAN_CLEANUP_INCOMPLETE" });
|
|
21
|
+
}
|
|
19
22
|
if (reap.reason === "kernel_alive" || reap.reason === "unsupported_identity") {
|
|
20
23
|
throw new Error(`cannot replace live or unverifiable invocation manifest (${reap.reason})`);
|
|
21
24
|
}
|
|
22
25
|
const manifest = new InvocationManifest(path);
|
|
23
26
|
await manifest.#persist();
|
|
27
|
+
await removeAcknowledgement(path);
|
|
24
28
|
return { manifest, reap };
|
|
25
29
|
}
|
|
26
30
|
async setWorker(pid, entrypoint) {
|
|
@@ -52,6 +56,7 @@ export class InvocationManifest {
|
|
|
52
56
|
async close() {
|
|
53
57
|
await this.#writes;
|
|
54
58
|
await rm(this.#path, { force: true });
|
|
59
|
+
await removeAcknowledgement(this.#path);
|
|
55
60
|
}
|
|
56
61
|
#persist() {
|
|
57
62
|
const snapshot = {
|
|
@@ -62,18 +67,7 @@ export class InvocationManifest {
|
|
|
62
67
|
invocations: [...this.#invocations.values()].map((entry) => ({ ...entry }))
|
|
63
68
|
};
|
|
64
69
|
this.#writes = this.#writes.then(async () => {
|
|
65
|
-
await
|
|
66
|
-
const temporary = `${this.#path}.${process.pid}.${randomUUID()}.tmp`;
|
|
67
|
-
try {
|
|
68
|
-
await writeFile(temporary, `${JSON.stringify(snapshot)}\n`, {
|
|
69
|
-
encoding: "utf8",
|
|
70
|
-
mode: 0o600
|
|
71
|
-
});
|
|
72
|
-
await rename(temporary, this.#path);
|
|
73
|
-
}
|
|
74
|
-
finally {
|
|
75
|
-
await rm(temporary, { force: true });
|
|
76
|
-
}
|
|
70
|
+
await writeManifest(this.#path, snapshot);
|
|
77
71
|
});
|
|
78
72
|
return this.#writes;
|
|
79
73
|
}
|
|
@@ -84,13 +78,18 @@ export class InvocationManifest {
|
|
|
84
78
|
*/
|
|
85
79
|
export async function reapOrphanedInvocationManifest(path) {
|
|
86
80
|
let parsed;
|
|
81
|
+
let source;
|
|
87
82
|
try {
|
|
88
|
-
|
|
83
|
+
source = await readFile(path, "utf8");
|
|
84
|
+
parsed = JSON.parse(source);
|
|
89
85
|
}
|
|
90
86
|
catch (error) {
|
|
91
|
-
if (error.code === "ENOENT")
|
|
87
|
+
if (error.code === "ENOENT") {
|
|
88
|
+
await removeAcknowledgement(path);
|
|
92
89
|
return { found: false, reaped: false };
|
|
90
|
+
}
|
|
93
91
|
await rm(path, { force: true });
|
|
92
|
+
await removeAcknowledgement(path);
|
|
94
93
|
return { found: true, reaped: false, reason: "host_missing" };
|
|
95
94
|
}
|
|
96
95
|
if (Number.isSafeInteger(parsed.kernelPid) &&
|
|
@@ -100,7 +99,18 @@ export async function reapOrphanedInvocationManifest(path) {
|
|
|
100
99
|
}
|
|
101
100
|
const host = parsed.worker;
|
|
102
101
|
if (!host || !Number.isSafeInteger(host.pid) || host.pid < 1 || !processAlive(host.pid)) {
|
|
102
|
+
if (parsed.cleanupIncomplete && process.platform === "win32") {
|
|
103
|
+
return {
|
|
104
|
+
found: true,
|
|
105
|
+
reaped: false,
|
|
106
|
+
pid: host?.pid,
|
|
107
|
+
reason: (await cleanupWasAcknowledged(path, source))
|
|
108
|
+
? "cleanup_acknowledged"
|
|
109
|
+
: "cleanup_incomplete"
|
|
110
|
+
};
|
|
111
|
+
}
|
|
103
112
|
await rm(path, { force: true });
|
|
113
|
+
await removeAcknowledgement(path);
|
|
104
114
|
return { found: true, reaped: false, reason: "host_missing" };
|
|
105
115
|
}
|
|
106
116
|
const currentIdentity = await processStartIdentity(host.pid);
|
|
@@ -108,13 +118,127 @@ export async function reapOrphanedInvocationManifest(path) {
|
|
|
108
118
|
return { found: true, reaped: false, pid: host.pid, reason: "unsupported_identity" };
|
|
109
119
|
}
|
|
110
120
|
if (currentIdentity !== host.started) {
|
|
121
|
+
if (parsed.cleanupIncomplete && process.platform === "win32") {
|
|
122
|
+
return {
|
|
123
|
+
found: true,
|
|
124
|
+
reaped: false,
|
|
125
|
+
pid: host.pid,
|
|
126
|
+
reason: (await cleanupWasAcknowledged(path, source))
|
|
127
|
+
? "cleanup_acknowledged"
|
|
128
|
+
: "cleanup_incomplete"
|
|
129
|
+
};
|
|
130
|
+
}
|
|
111
131
|
await rm(path, { force: true });
|
|
132
|
+
await removeAcknowledgement(path);
|
|
112
133
|
return { found: true, reaped: false, pid: host.pid, reason: "identity_mismatch" };
|
|
113
134
|
}
|
|
114
|
-
|
|
135
|
+
// 必须在 leader 仍可识别时回收 Windows 树;失败保留证据,禁止覆盖清单并启动替代 worker。
|
|
136
|
+
if (!(await terminateProcessGroup(host.pid)) && process.platform === "win32") {
|
|
137
|
+
// 失败事实必须跨重启保留;leader 后来消失或 PID 复用不能抹去未确认的后代归属。
|
|
138
|
+
await writeManifest(path, { ...parsed, cleanupIncomplete: true });
|
|
139
|
+
return { found: true, reaped: false, pid: host.pid, reason: "cleanup_incomplete" };
|
|
140
|
+
}
|
|
115
141
|
await rm(path, { force: true });
|
|
142
|
+
await removeAcknowledgement(path);
|
|
116
143
|
return { found: true, reaped: true, pid: host.pid };
|
|
117
144
|
}
|
|
145
|
+
async function removeAcknowledgement(path) {
|
|
146
|
+
try {
|
|
147
|
+
await rm(`${path}.acknowledgement`, { force: true });
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// 旧确认已因清单删除或替换而失效;辅助文件清理失败不能阻止启动,原始归档始终保留。
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** 只读恢复诊断,不回收进程、不改写清单;用于 doctor 及 SDK 运维界面。 */
|
|
154
|
+
export async function inspectOrphanCleanup(path) {
|
|
155
|
+
try {
|
|
156
|
+
const source = await readFile(path, "utf8");
|
|
157
|
+
const parsed = JSON.parse(source);
|
|
158
|
+
return {
|
|
159
|
+
manifestPath: path,
|
|
160
|
+
state: parsed.cleanupIncomplete
|
|
161
|
+
? (await cleanupWasAcknowledged(path, source))
|
|
162
|
+
? "acknowledged"
|
|
163
|
+
: "cleanup_incomplete"
|
|
164
|
+
: "available",
|
|
165
|
+
workerPid: parsed.worker?.pid
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return {
|
|
170
|
+
manifestPath: path,
|
|
171
|
+
state: error.code === "ENOENT" ? "missing" : "unreadable"
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 操作者已停止未知后代后显式确认当前失败记录;不终止进程、不声称整树回收已验证。
|
|
177
|
+
* 仍存活的原 Kernel/worker 或无法核验的 PID 不能放行。备份保留,确认仅匹配原文摘要,
|
|
178
|
+
* 所以并发启动、后续调用或另一份清单不会复用旧确认;下一次 open 才替换失败记录。
|
|
179
|
+
*/
|
|
180
|
+
export async function acknowledgeOrphanCleanup(path) {
|
|
181
|
+
const source = await readFile(path, "utf8");
|
|
182
|
+
const parsed = JSON.parse(source);
|
|
183
|
+
if (parsed.schemaVersion !== 1 ||
|
|
184
|
+
!Number.isSafeInteger(parsed.kernelPid) ||
|
|
185
|
+
parsed.kernelPid < 1 ||
|
|
186
|
+
parsed.cleanupIncomplete !== true ||
|
|
187
|
+
!parsed.worker ||
|
|
188
|
+
!Number.isSafeInteger(parsed.worker.pid) ||
|
|
189
|
+
parsed.worker.pid < 1) {
|
|
190
|
+
throw new Error("ORPHAN_CLEANUP_NOT_PENDING");
|
|
191
|
+
}
|
|
192
|
+
if (processAlive(parsed.kernelPid))
|
|
193
|
+
throw new Error("ORPHAN_CLEANUP_OWNER_ALIVE");
|
|
194
|
+
if (processAlive(parsed.worker.pid)) {
|
|
195
|
+
const identity = await processStartIdentity(parsed.worker.pid);
|
|
196
|
+
if (!identity || identity === parsed.worker.started)
|
|
197
|
+
throw new Error("ORPHAN_CLEANUP_OWNER_ALIVE");
|
|
198
|
+
}
|
|
199
|
+
const archivePath = `${path}.acknowledged.${randomUUID()}.json`;
|
|
200
|
+
await writeFile(archivePath, source, { encoding: "utf8", flag: "wx", mode: 0o600 });
|
|
201
|
+
const temporary = `${path}.${randomUUID()}.ack.tmp`;
|
|
202
|
+
try {
|
|
203
|
+
await writeFile(temporary, JSON.stringify({ digest: manifestDigest(source), archivePath }), {
|
|
204
|
+
mode: 0o600,
|
|
205
|
+
flag: "wx"
|
|
206
|
+
});
|
|
207
|
+
await rename(temporary, `${path}.acknowledgement`);
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
await rm(temporary, { force: true });
|
|
211
|
+
}
|
|
212
|
+
return { manifestPath: path, archivePath };
|
|
213
|
+
}
|
|
214
|
+
function manifestDigest(source) {
|
|
215
|
+
return createHash("sha256").update(source).digest("hex");
|
|
216
|
+
}
|
|
217
|
+
async function cleanupWasAcknowledged(path, source) {
|
|
218
|
+
try {
|
|
219
|
+
const ack = JSON.parse(await readFile(`${path}.acknowledgement`, "utf8"));
|
|
220
|
+
if (ack.digest !== manifestDigest(source) ||
|
|
221
|
+
typeof ack.archivePath !== "string" ||
|
|
222
|
+
!ack.archivePath.startsWith(path) ||
|
|
223
|
+
!/^\.acknowledged\.[0-9a-f-]{36}\.json$/.test(ack.archivePath.slice(path.length)))
|
|
224
|
+
return false;
|
|
225
|
+
return manifestDigest(await readFile(ack.archivePath, "utf8")) === ack.digest;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function writeManifest(path, snapshot) {
|
|
232
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
233
|
+
const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
234
|
+
try {
|
|
235
|
+
await writeFile(temporary, `${JSON.stringify(snapshot)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
236
|
+
await rename(temporary, path);
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
await rm(temporary, { force: true });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
118
242
|
/** 查询系统启动时间以区分 PID 复用;失败时不返回可用于回收的身份,绝不以 PID 本身兜底。 */
|
|
119
243
|
export async function processStartIdentity(pid) {
|
|
120
244
|
try {
|
|
@@ -160,9 +284,9 @@ async function queryProcessStartIdentity(pid) {
|
|
|
160
284
|
// 保持 UTC ticks 身份格式,不缓存可能已经复用的 PID。
|
|
161
285
|
`$PSModuleAutoLoadingPreference='None'; $target=[System.Diagnostics.Process]::GetProcessById(${pid}); try { [Console]::Out.Write($target.StartTime.ToUniversalTime().Ticks.ToString([Globalization.CultureInfo]::InvariantCulture)) } finally { $target.Dispose() }`
|
|
162
286
|
],
|
|
163
|
-
//
|
|
287
|
+
// PowerShell 冷启动与查询共用 40 秒;Windows CI 曾在 30 秒期限被系统命令超时终止。
|
|
164
288
|
// 身份登记独立于后续 RPC 就绪与关闭预算,失败仍禁止使用未知 PID。
|
|
165
|
-
{ encoding: "utf8", timeout:
|
|
289
|
+
{ encoding: "utf8", timeout: 40_000, windowsHide: true }, (error, stdout) => {
|
|
166
290
|
if (error) {
|
|
167
291
|
reject(error instanceof Error
|
|
168
292
|
? error
|
|
@@ -177,15 +301,22 @@ async function queryProcessStartIdentity(pid) {
|
|
|
177
301
|
return undefined;
|
|
178
302
|
}
|
|
179
303
|
async function terminateProcessGroup(pid) {
|
|
304
|
+
if (process.platform === "win32") {
|
|
305
|
+
const terminated = await new Promise((resolve) => {
|
|
306
|
+
execFile("taskkill.exe", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 5_000 }, (error) => resolve(!error));
|
|
307
|
+
});
|
|
308
|
+
// taskkill 失败即使 leader 随后消失,也不能证明后代已回收。
|
|
309
|
+
return terminated && (await waitForExit(pid, 1_000));
|
|
310
|
+
}
|
|
180
311
|
signalProcessGroup(pid, "SIGTERM");
|
|
181
312
|
if (await waitForExit(pid, 1_000))
|
|
182
|
-
return;
|
|
313
|
+
return true;
|
|
183
314
|
signalProcessGroup(pid, "SIGKILL");
|
|
184
|
-
|
|
315
|
+
return waitForExit(pid, 1_000);
|
|
185
316
|
}
|
|
186
317
|
function signalProcessGroup(pid, signal) {
|
|
187
318
|
try {
|
|
188
|
-
process.kill(
|
|
319
|
+
process.kill(-pid, signal);
|
|
189
320
|
}
|
|
190
321
|
catch (error) {
|
|
191
322
|
if (error.code !== "ESRCH")
|
|
@@ -63,8 +63,15 @@ export function serveWorker(adapters, options = {}) {
|
|
|
63
63
|
await finish(1);
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const onSignal = () => {
|
|
67
|
+
// Windows 控制台事件也会送达 worker;父 Kernel 须先经 RPC 取消并消费终态,再以 EOF 关闭。
|
|
68
|
+
// 抢先退出会丢失终态及树回收所需的 leader。父 IPC 已断开或独立运行时仍自行收尾。
|
|
69
|
+
if (process.platform !== "win32" || !process.connected)
|
|
70
|
+
stop();
|
|
71
|
+
};
|
|
72
|
+
// 保持监听到父进程关闭,避免重复控制台事件恢复默认的立即退出行为。
|
|
73
|
+
process.on("SIGINT", onSignal);
|
|
74
|
+
process.on("SIGTERM", onSignal);
|
|
68
75
|
process.once("SIGHUP", () => stop());
|
|
69
76
|
process.stdin.once("end", () => stop(process.platform === "win32"));
|
|
70
77
|
process.stdin.once("close", () => stop(process.platform === "win32"));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KernelError } from "./types.js";
|
|
2
|
+
/** 包内接纳检查专用;只有当前 client 在请求写出前拒绝时才能创建此证据。 */
|
|
3
|
+
export declare function admissionClosedError(): KernelError;
|
|
4
|
+
/**
|
|
5
|
+
* 判断同一模块实例产生的本地未提交拒绝;包装、序列化及同名错误均返回 false。
|
|
6
|
+
* 只证明本次 invoke 未写出,不证明此前业务尝试没有执行,也不授权自动重放。
|
|
7
|
+
*/
|
|
8
|
+
export declare function isInvocationNotSubmitted(error: unknown): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KernelError } from "./types.js";
|
|
2
|
+
const notSubmitted = new WeakSet();
|
|
3
|
+
/** 包内接纳检查专用;只有当前 client 在请求写出前拒绝时才能创建此证据。 */
|
|
4
|
+
export function admissionClosedError() {
|
|
5
|
+
const error = new KernelError("CLIENT_INVOCATION_ADMISSION_CLOSED");
|
|
6
|
+
notSubmitted.add(error);
|
|
7
|
+
return error;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 判断同一模块实例产生的本地未提交拒绝;包装、序列化及同名错误均返回 false。
|
|
11
|
+
* 只证明本次 invoke 未写出,不证明此前业务尝试没有执行,也不授权自动重放。
|
|
12
|
+
*/
|
|
13
|
+
export function isInvocationNotSubmitted(error) {
|
|
14
|
+
return (error instanceof KernelError &&
|
|
15
|
+
error.code === "CLIENT_INVOCATION_ADMISSION_CLOSED" &&
|
|
16
|
+
notSubmitted.has(error));
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-kernel",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
22
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
23
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
21
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.5",
|
|
22
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.5",
|
|
23
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.5"
|
|
24
24
|
},
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"files": [
|
|
@@ -231,6 +231,62 @@
|
|
|
231
231
|
"description": "允许的群范围 ID(groupNo)。"
|
|
232
232
|
}
|
|
233
233
|
},
|
|
234
|
+
"artifact_delivery": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"additionalProperties": true,
|
|
237
|
+
"description": "workflow 固定产物交付,执行前通过 Context 明示。省略为 channel:成功 final 显式引用的本地文件上传为 IM 附件,普通链接同时保留正文下载链接并发送原生文件卡,图片内嵌展示;tools 保留 Agent 主动工具交付。不扫描目录或自动发布在线文档。",
|
|
238
|
+
"properties": {
|
|
239
|
+
"mode": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"enum": ["channel", "tools"],
|
|
242
|
+
"default": "channel",
|
|
243
|
+
"description": "省略启用渠道固定交付;tools 关闭 Gateway 自动上传,保留普通工具调用。"
|
|
244
|
+
},
|
|
245
|
+
"allowed_roots": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"maxItems": 32,
|
|
248
|
+
"description": "宿主授权的绝对产物目录;省略使用当前本地 Agent 工作区,空列表拒绝全部文件。realpath 后检查包含关系,拒绝 symlink 逃逸;远程 Provider 路径始终不可读。",
|
|
249
|
+
"items": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"pattern": "^(?:/|[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+)"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"allowed_mime_types": {
|
|
255
|
+
"type": "array",
|
|
256
|
+
"maxItems": 32,
|
|
257
|
+
"description": "可选精确 MIME 类型列表;省略不增加类型限制,空列表拒绝所有类型。服务端实际策略仍可拒绝;未知扩展使用 application/octet-stream。",
|
|
258
|
+
"items": { "type": "string", "pattern": "^[\\w.+-]+/[\\w.+-]+$" }
|
|
259
|
+
},
|
|
260
|
+
"max_file_bytes": {
|
|
261
|
+
"type": "integer",
|
|
262
|
+
"minimum": 1,
|
|
263
|
+
"maximum": 20971520,
|
|
264
|
+
"default": 20971520,
|
|
265
|
+
"description": "单个文件上限(字节),宿主可收紧。"
|
|
266
|
+
},
|
|
267
|
+
"max_total_bytes": {
|
|
268
|
+
"type": "integer",
|
|
269
|
+
"minimum": 1,
|
|
270
|
+
"maximum": 52428800,
|
|
271
|
+
"default": 52428800,
|
|
272
|
+
"description": "一次最终回复的文件总字节预算,失败上传也占预算。"
|
|
273
|
+
},
|
|
274
|
+
"max_files": {
|
|
275
|
+
"type": "integer",
|
|
276
|
+
"minimum": 1,
|
|
277
|
+
"maximum": 16,
|
|
278
|
+
"default": 16,
|
|
279
|
+
"description": "一次最终回复最多尝试的不同 realpath 文件数量。"
|
|
280
|
+
},
|
|
281
|
+
"timeout_ms": {
|
|
282
|
+
"type": "integer",
|
|
283
|
+
"minimum": 1,
|
|
284
|
+
"maximum": 30000,
|
|
285
|
+
"default": 30000,
|
|
286
|
+
"description": "整次产物准备的上传时间预算;取消、reset 和关闭可提前结束。"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
234
290
|
"cards": {
|
|
235
291
|
"type": "boolean",
|
|
236
292
|
"default": true,
|