@mininglamp-oss/octo-runtime 1.1.10 → 1.1.11
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/README.md +1 -1
- package/apps/cli/dist/adapters.js +40 -14
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/command-tree.js +2 -3
- package/apps/cli/dist/extras.js +11 -1
- package/apps/cli/dist/index.js +14 -1
- package/apps/cli/dist/main.js +58 -23
- package/apps/cli/dist/module-manifest.js +21 -3
- package/apps/cli/dist/output.d.ts +19 -1
- package/apps/cli/dist/output.js +179 -27
- package/apps/cli/dist/playboard.js +2 -2
- package/apps/cli/dist/state.d.ts +5 -2
- package/apps/cli/dist/state.js +48 -13
- package/dist/public/codex.d.ts +1 -0
- package/dist/public/codex.js +1 -0
- package/dist/public/executor-kernel.d.ts +4 -0
- package/dist/public/executor-kernel.js +2 -0
- package/dist/public/extra.d.ts +1 -1
- package/dist/public/host.d.ts +5 -0
- package/dist/public/host.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +20 -0
- 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/app-server.d.ts +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +68 -253
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +11 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +198 -52
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +58 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +650 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- 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 +2 -0
- 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 +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +25 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +40 -14
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +2 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +11 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/index.js +14 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +58 -23
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +21 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +179 -27
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -13
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -23
- package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.js +199 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +465 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.js +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.d.ts +59 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.js +287 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.js +138 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.d.ts +8 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.js +65 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.d.ts +82 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.js +371 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.js +23 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.d.ts +72 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +1219 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +5988 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +56 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc-fixtures.json +53 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +538 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +116 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +4525 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +761 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +663 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +191 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +26 -18
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +151 -11
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +1 -30
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +2 -199
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +1 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -446
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/endpoint.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +13 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.d.ts +1 -53
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -280
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.d.ts +5 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.d.ts +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.js +180 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +31 -8
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +48 -5
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.js +18 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +1 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +2 -23
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.d.ts +2 -72
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.js +2 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/ports.d.ts +2 -2
- 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/extra.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/ports.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.js +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +12 -5
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.js +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.d.ts +44 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.js +207 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +23 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.d.ts +27 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.js +133 -25
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.d.ts +10 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.js +18 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.d.ts +5 -6
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +33 -45
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/identity.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +5 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +19 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +65 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +33 -27
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +42 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "omitted name",
|
|
4
|
+
"valid": true
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"name": "lowercase name",
|
|
8
|
+
"sessionName": "octo-dm-user-123",
|
|
9
|
+
"valid": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "mixed letters digits and hyphens",
|
|
13
|
+
"sessionName": "WebUI-ABC-xyz-019",
|
|
14
|
+
"valid": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "one letter",
|
|
18
|
+
"sessionName": "A",
|
|
19
|
+
"valid": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "one digit",
|
|
23
|
+
"sessionName": "7",
|
|
24
|
+
"valid": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "one hyphen",
|
|
28
|
+
"sessionName": "-",
|
|
29
|
+
"valid": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "256 ASCII characters",
|
|
33
|
+
"sessionName": "Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-",
|
|
34
|
+
"valid": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "257 ASCII characters",
|
|
38
|
+
"sessionName": "Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-Ab9-x",
|
|
39
|
+
"valid": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "empty name",
|
|
43
|
+
"sessionName": "",
|
|
44
|
+
"valid": false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "whitespace only",
|
|
48
|
+
"sessionName": " \t",
|
|
49
|
+
"valid": false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "embedded space",
|
|
53
|
+
"sessionName": "Team review",
|
|
54
|
+
"valid": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "colon",
|
|
58
|
+
"sessionName": "a:b",
|
|
59
|
+
"valid": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "underscore",
|
|
63
|
+
"sessionName": "a_b",
|
|
64
|
+
"valid": true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "slash",
|
|
68
|
+
"sessionName": "a/b",
|
|
69
|
+
"valid": true
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "percent escape",
|
|
73
|
+
"sessionName": "a%20b",
|
|
74
|
+
"valid": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "non ASCII letters",
|
|
78
|
+
"sessionName": "\u540d\u79f0",
|
|
79
|
+
"valid": true
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "emoji",
|
|
83
|
+
"sessionName": "\ud83d\ude00",
|
|
84
|
+
"valid": true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Unicode line separator",
|
|
88
|
+
"sessionName": "a\u2028b",
|
|
89
|
+
"valid": true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "Unicode paragraph separator",
|
|
93
|
+
"sessionName": "a\u2029b",
|
|
94
|
+
"valid": true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "Unicode BOM whitespace",
|
|
98
|
+
"sessionName": "\ufeff",
|
|
99
|
+
"valid": false
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "Unicode next line",
|
|
103
|
+
"sessionName": "\u0085",
|
|
104
|
+
"valid": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "trailing newline",
|
|
108
|
+
"sessionName": "valid-name\n",
|
|
109
|
+
"valid": false
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "trailing carriage return",
|
|
113
|
+
"sessionName": "valid-name\r",
|
|
114
|
+
"valid": false
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "embedded control character",
|
|
118
|
+
"sessionName": "a\u0001b",
|
|
119
|
+
"valid": false
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "DEL",
|
|
123
|
+
"sessionName": "a\u007fb",
|
|
124
|
+
"valid": false
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "null",
|
|
128
|
+
"sessionName": null,
|
|
129
|
+
"valid": false
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "number",
|
|
133
|
+
"sessionName": 42,
|
|
134
|
+
"valid": false
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "boolean",
|
|
138
|
+
"sessionName": true,
|
|
139
|
+
"valid": false
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "object",
|
|
143
|
+
"sessionName": {},
|
|
144
|
+
"valid": false
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "array",
|
|
148
|
+
"sessionName": [],
|
|
149
|
+
"valid": false
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "space only",
|
|
153
|
+
"sessionName": " ",
|
|
154
|
+
"valid": false
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "no-break space only",
|
|
158
|
+
"sessionName": "\u00a0",
|
|
159
|
+
"valid": false
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "Unicode spaces only",
|
|
163
|
+
"sessionName": "\u1680\u2000\u200a\u2028\u2029\u202f\u205f\u3000\ufeff",
|
|
164
|
+
"valid": false
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "all 256 Unicode code points",
|
|
168
|
+
"sessionName": "\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00",
|
|
169
|
+
"valid": true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "257 Unicode code points",
|
|
173
|
+
"sessionName": "\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00",
|
|
174
|
+
"valid": false
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "Unicode display with separators",
|
|
178
|
+
"sessionName": "\u4e2d\u6587:my_session-1.\u6b22\u8fce",
|
|
179
|
+
"valid": true
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "preserved surrounding spaces",
|
|
183
|
+
"sessionName": " caller name ",
|
|
184
|
+
"valid": true
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "C1 control suffix",
|
|
188
|
+
"sessionName": "name\u009f",
|
|
189
|
+
"valid": false
|
|
190
|
+
}
|
|
191
|
+
]
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
export { prepareInvokeInput } from "./invoke-input.js";
|
|
2
2
|
export { resolveLocalContext, localRuntimeLimits } from "./context.js";
|
|
3
3
|
export { prepareRunContext, type PreparedRunContext, type WorkspaceAssignments } from "./execution-preparation.js";
|
|
4
|
-
import type { AdapterInvocationContext, AdapterProbeOptions, AdapterOutput } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
|
-
import { type InvokeInput, type InvokeEnvironment, type
|
|
4
|
+
import type { AdapterInvocationContext, AdapterProbeOptions, AdapterOutput, CreateAdapterExecutionScope, ServiceProcessSnapshot } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
|
+
import { type InvokeInput, type InvokeEnvironment, type HostRunReceipt, type HostFrame, type NativeInteractionResponse, type InteractionResponse, type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
|
|
6
6
|
import { type RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
7
7
|
export type { AdapterInvocationContext, AdapterOutput, AdapterProbeOptions, RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
/** False skips Runtime workspace preparation for this Provider. */
|
|
11
|
-
workspace?: boolean;
|
|
12
|
-
/** 注册输入必须完整;不得因编写阶段可省略而将此字段改成可选或在注册时猜测支持范围。 */
|
|
13
|
-
protocolSupport: AdapterProtocolSupport;
|
|
14
|
-
type: string;
|
|
15
|
-
agentSources: ("preset" | "provisioned")[];
|
|
16
|
-
processModel?: string;
|
|
17
|
-
transport?: string;
|
|
18
|
-
providerVersion?: string | null;
|
|
19
|
-
providerPath?: string | null;
|
|
20
|
-
available?: boolean;
|
|
21
|
-
unavailableReason?: string | null;
|
|
22
|
-
}
|
|
8
|
+
import type { HostedAdapterMetadata } from "@mininglamp-oss/octo-runtime-protocol";
|
|
9
|
+
export type { HostedAdapterMetadata } from "@mininglamp-oss/octo-runtime-protocol";
|
|
23
10
|
/**
|
|
24
11
|
* Adapter 的最小注册合同;必须声明实际支持的输出模式。
|
|
25
12
|
* invoke 可封装子进程、ACP、WebSocket 或进程内实现,按 context.protocolMode
|
|
@@ -28,6 +15,7 @@ export interface HostedAdapterMetadata {
|
|
|
28
15
|
*/
|
|
29
16
|
export interface HostedAdapter {
|
|
30
17
|
metadata: HostedAdapterMetadata;
|
|
18
|
+
createExecutionScope?: CreateAdapterExecutionScope;
|
|
31
19
|
probe?: (options?: AdapterProbeOptions) => unknown;
|
|
32
20
|
/** Execute a turn and report progress for host deadline enforcement. */
|
|
33
21
|
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncIterable<AdapterOutput>;
|
|
@@ -41,7 +29,11 @@ export interface ExecutorShutdownResult {
|
|
|
41
29
|
cleanup: "complete" | "incomplete";
|
|
42
30
|
unresolvedInvocationIds: readonly string[];
|
|
43
31
|
failedCleanupInvocationIds: readonly string[];
|
|
32
|
+
unresolvedServiceIds: readonly string[];
|
|
33
|
+
failedCleanupServiceIds: readonly string[];
|
|
44
34
|
}
|
|
35
|
+
/** 单次已接纳调用的资源事实;unknown 不表示已清理,pending 不触发取消或重试。 */
|
|
36
|
+
export type InvocationCleanupState = "complete" | "pending" | "failed" | "unknown";
|
|
45
37
|
/**
|
|
46
38
|
* 唯一的进程内执行实现:校验输入/Adapter 输出、补齐消息生命周期、约束单个终态并传递取消。
|
|
47
39
|
* 由 Kernel 在宿主进程持有;它不拥有 RPC 端点、业务会话或 IM 投递。
|
|
@@ -57,12 +49,28 @@ export declare class AgentExecutor {
|
|
|
57
49
|
* 与 Kernel 的观察 iterator 不同,本地 Core 提前结束迭代会请求取消并进入 Adapter 清理。
|
|
58
50
|
*/
|
|
59
51
|
readonly invoke: import("@mininglamp-oss/octo-runtime-protocol").InputInvoke;
|
|
52
|
+
/** 只报告 Core 准入状态,不探测 Provider,也不代表认证或业务连接可用。 */
|
|
53
|
+
status(): {
|
|
54
|
+
state: "open" | "closing" | "closed";
|
|
55
|
+
available: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 按完整接纳凭据等待首次 Adapter 清理结果;借用方只观察自己的调用,不能由此关闭共享 Core。
|
|
59
|
+
* deadline 是绝对毫秒截止;过期、错误凭据和 finally 失败均不能推定成功。
|
|
60
|
+
*/
|
|
61
|
+
waitForInvocationCleanup(receipt: HostRunReceipt, options?: {
|
|
62
|
+
deadline: number;
|
|
63
|
+
}): Promise<InvocationCleanupState>;
|
|
60
64
|
/** 按 type 注册完整 Adapter 并校验协议声明,不补默认值或启动 Provider;同类型不可覆盖。 */
|
|
61
65
|
register(adapter: HostedAdapter): void;
|
|
66
|
+
/** 只取已拥有的常驻进程快照,不启动、探测或发现其他宿主的 Provider。 */
|
|
67
|
+
processes(): readonly ServiceProcessSnapshot[];
|
|
62
68
|
/** List registered adapters, for Agent registration and control-plane display. */
|
|
63
69
|
list(): HostedAdapterMetadata[];
|
|
64
70
|
/** Report installed provider identity separately from adapter registration. */
|
|
65
|
-
describe(configurations?: Record<string, AdapterProbeOptions
|
|
71
|
+
describe(configurations?: Record<string, AdapterProbeOptions>, lifecycle?: {
|
|
72
|
+
onProbe: (pending: Promise<unknown>) => void;
|
|
73
|
+
}): Promise<HostedAdapterMetadata[]>;
|
|
66
74
|
/**
|
|
67
75
|
* 同步校验并冻结单次输入,开始迭代时接纳执行;native 为默认,canonical 须显式选择。
|
|
68
76
|
* signal、执行环境和容量限制来自本次 environment,不从业务会话或其他 Run 继承。
|
|
@@ -6,7 +6,7 @@ import { sanitizePublicValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
|
6
6
|
export { prepareInvokeInput } from "./invoke-input.js";
|
|
7
7
|
export { resolveLocalContext, localRuntimeLimits } from "./context.js";
|
|
8
8
|
export { prepareRunContext } from "./execution-preparation.js";
|
|
9
|
-
import { createInputInvoke, assertInvokeRequestSize, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isCodexLocalFailure, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
9
|
+
import { createInputInvoke, assertInvokeRequestSize, assertServiceProcessSnapshot, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isCodexLocalFailure, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
10
10
|
import { InvocationExperience } from "./experience.js";
|
|
11
11
|
import { withModelContexts } from "./model-input.js";
|
|
12
12
|
import { noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
@@ -36,6 +36,8 @@ export class AgentExecutor {
|
|
|
36
36
|
*/
|
|
37
37
|
invoke = createInputInvoke((input, environment) => this.invokeFrames(input, environment));
|
|
38
38
|
#adapters = new Map();
|
|
39
|
+
#scopes = new Map();
|
|
40
|
+
#scopeCleanup = new Map();
|
|
39
41
|
#active = new Map();
|
|
40
42
|
#activeAdapters = new Map();
|
|
41
43
|
// 资源所有权独立于活动执行/终态:清理未确认的 owner 必须留存,供 shutdown 返回真实遗留项。
|
|
@@ -48,13 +50,73 @@ export class AgentExecutor {
|
|
|
48
50
|
#acceptedTerminals = new Set();
|
|
49
51
|
#runs = new Map();
|
|
50
52
|
#modes = new Map();
|
|
53
|
+
/** 只报告 Core 准入状态,不探测 Provider,也不代表认证或业务连接可用。 */
|
|
54
|
+
status() {
|
|
55
|
+
return { state: this.#state, available: this.#state === "open" };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 按完整接纳凭据等待首次 Adapter 清理结果;借用方只观察自己的调用,不能由此关闭共享 Core。
|
|
59
|
+
* deadline 是绝对毫秒截止;过期、错误凭据和 finally 失败均不能推定成功。
|
|
60
|
+
*/
|
|
61
|
+
async waitForInvocationCleanup(receipt, options) {
|
|
62
|
+
if (options && !Number.isFinite(options.deadline))
|
|
63
|
+
throw new TypeError("CLEANUP_DEADLINE_INVALID");
|
|
64
|
+
const run = this.#runs.get(receipt.invocation_id);
|
|
65
|
+
if (!run ||
|
|
66
|
+
Object.entries(run.receipt).some(([key, value]) => receipt[key] !== value))
|
|
67
|
+
return "unknown";
|
|
68
|
+
if (!options)
|
|
69
|
+
return run.cleanup;
|
|
70
|
+
let timer;
|
|
71
|
+
try {
|
|
72
|
+
return await Promise.race([
|
|
73
|
+
run.cleanup,
|
|
74
|
+
new Promise((resolve) => {
|
|
75
|
+
timer = setTimeout(() => resolve("pending"), Math.max(0, options.deadline - Date.now()));
|
|
76
|
+
})
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
51
83
|
/** 按 type 注册完整 Adapter 并校验协议声明,不补默认值或启动 Provider;同类型不可覆盖。 */
|
|
52
84
|
register(adapter) {
|
|
53
85
|
this.#assertOpen();
|
|
54
86
|
assertAdapterProtocolSupport(adapter.metadata.protocolSupport);
|
|
55
87
|
if (this.#adapters.has(adapter.metadata.type))
|
|
56
88
|
throw new Error(`duplicate adapter: ${adapter.metadata.type}`);
|
|
57
|
-
this
|
|
89
|
+
// 先完整构造再发布;不展开对象,以免丢失宿主方法的 this 或原型。
|
|
90
|
+
const scope = adapter.createExecutionScope?.({ log: this.#log });
|
|
91
|
+
if (scope) {
|
|
92
|
+
if (typeof scope.invoke !== "function" ||
|
|
93
|
+
typeof scope.beginShutdown !== "function" ||
|
|
94
|
+
typeof scope.close !== "function")
|
|
95
|
+
throw new TypeError("ADAPTER_EXECUTION_SCOPE_INVALID");
|
|
96
|
+
this.#scopes.set(adapter.metadata.type, scope);
|
|
97
|
+
this.#adapters.set(adapter.metadata.type, {
|
|
98
|
+
metadata: adapter.metadata,
|
|
99
|
+
...(adapter.probe ? { probe: adapter.probe.bind(adapter) } : {}),
|
|
100
|
+
invoke: scope.invoke.bind(scope),
|
|
101
|
+
...(scope.respondInteraction
|
|
102
|
+
? { respondInteraction: scope.respondInteraction.bind(scope) }
|
|
103
|
+
: {}),
|
|
104
|
+
...(scope.respondNative ? { respondNative: scope.respondNative.bind(scope) } : {})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
this.#adapters.set(adapter.metadata.type, adapter);
|
|
109
|
+
}
|
|
110
|
+
/** 只取已拥有的常驻进程快照,不启动、探测或发现其他宿主的 Provider。 */
|
|
111
|
+
processes() {
|
|
112
|
+
const snapshots = [...this.#scopes.values()].flatMap((scope) => [
|
|
113
|
+
...(scope.processes?.() ?? [])
|
|
114
|
+
]);
|
|
115
|
+
if (snapshots.length > 256)
|
|
116
|
+
throw new Error("SERVICE_PROCESS_SNAPSHOT_LIMIT");
|
|
117
|
+
for (const snapshot of snapshots)
|
|
118
|
+
assertServiceProcessSnapshot(snapshot);
|
|
119
|
+
return snapshots.map((snapshot) => ({ ...snapshot }));
|
|
58
120
|
}
|
|
59
121
|
/** List registered adapters, for Agent registration and control-plane display. */
|
|
60
122
|
list() {
|
|
@@ -64,7 +126,7 @@ export class AgentExecutor {
|
|
|
64
126
|
}));
|
|
65
127
|
}
|
|
66
128
|
/** Report installed provider identity separately from adapter registration. */
|
|
67
|
-
async describe(configurations = {}) {
|
|
129
|
+
async describe(configurations = {}, lifecycle) {
|
|
68
130
|
this.#assertOpen();
|
|
69
131
|
return Promise.all([...this.#adapters.values()].map(async (adapter) => {
|
|
70
132
|
let probe = {};
|
|
@@ -72,9 +134,14 @@ export class AgentExecutor {
|
|
|
72
134
|
let timer;
|
|
73
135
|
try {
|
|
74
136
|
const result = await Promise.race([
|
|
75
|
-
Promise.resolve().then(() =>
|
|
76
|
-
|
|
77
|
-
|
|
137
|
+
Promise.resolve().then(() => {
|
|
138
|
+
if (!adapter.probe)
|
|
139
|
+
return undefined;
|
|
140
|
+
const pending = Promise.resolve(this.probe(adapter.metadata.type, configurations[adapter.metadata.type]));
|
|
141
|
+
// 展示超时不结束实际探测;借用方可据此等待自己发起的操作而不排空整个 Core。
|
|
142
|
+
lifecycle?.onProbe(pending);
|
|
143
|
+
return pending;
|
|
144
|
+
}),
|
|
78
145
|
new Promise((resolve) => {
|
|
79
146
|
timer = setTimeout(() => {
|
|
80
147
|
unavailableReason = "probe_timeout";
|
|
@@ -148,9 +215,15 @@ export class AgentExecutor {
|
|
|
148
215
|
protocol_mode: resolved.protocolMode,
|
|
149
216
|
protocol: support.protocol
|
|
150
217
|
};
|
|
218
|
+
let finishCleanup;
|
|
219
|
+
const cleanup = new Promise((resolve) => {
|
|
220
|
+
finishCleanup = resolve;
|
|
221
|
+
});
|
|
151
222
|
this.#runs.set(request.invocationId, {
|
|
152
223
|
receipt,
|
|
153
|
-
at: Date.now()
|
|
224
|
+
at: Date.now(),
|
|
225
|
+
cleanup,
|
|
226
|
+
finishCleanup
|
|
154
227
|
});
|
|
155
228
|
return { ...receipt };
|
|
156
229
|
}
|
|
@@ -243,6 +316,8 @@ export class AgentExecutor {
|
|
|
243
316
|
owner.cleanupAttempt = Promise.resolve()
|
|
244
317
|
.then(() => owner.close?.())
|
|
245
318
|
.then(() => {
|
|
319
|
+
if (this.#isCurrent(id, owner))
|
|
320
|
+
this.#runs.get(id).finishCleanup("complete");
|
|
246
321
|
if (this.#owners.get(id) === owner)
|
|
247
322
|
this.#owners.delete(id);
|
|
248
323
|
if (this.#isCurrent(id, owner)) {
|
|
@@ -253,6 +328,8 @@ export class AgentExecutor {
|
|
|
253
328
|
}
|
|
254
329
|
}, (error) => {
|
|
255
330
|
owner.cleanupState = "failed";
|
|
331
|
+
if (this.#isCurrent(id, owner))
|
|
332
|
+
this.#runs.get(id).finishCleanup("failed");
|
|
256
333
|
throw error;
|
|
257
334
|
})
|
|
258
335
|
.finally(() => {
|
|
@@ -521,6 +598,7 @@ export class AgentExecutor {
|
|
|
521
598
|
let iteratorDone = false;
|
|
522
599
|
let cleanupWait;
|
|
523
600
|
let cleanupDeadline;
|
|
601
|
+
let completedBeforeCleanup = false;
|
|
524
602
|
const beginCleanup = () => (cleanupDeadline ??= performance.now() + watchdog.limits.cancelGraceMs);
|
|
525
603
|
const remainingCleanup = () => Math.max(0, beginCleanup() - performance.now());
|
|
526
604
|
owner.close = async () => {
|
|
@@ -571,7 +649,13 @@ export class AgentExecutor {
|
|
|
571
649
|
throw protocolError("EXECUTION_PROTOCOL_MISMATCH", "Native execution invoked a canonical converter");
|
|
572
650
|
conversions++;
|
|
573
651
|
},
|
|
574
|
-
reportActivity: (activity) => watchdog.activity(activity)
|
|
652
|
+
reportActivity: (activity) => watchdog.activity(activity),
|
|
653
|
+
reportExecutionResult: (result) => {
|
|
654
|
+
if (result.status === "completed" &&
|
|
655
|
+
result.basis === "final_answer_cleanup_fallback" &&
|
|
656
|
+
!controller.signal.aborted)
|
|
657
|
+
completedBeforeCleanup = true;
|
|
658
|
+
}
|
|
575
659
|
};
|
|
576
660
|
// A provider may emit only deltas; here the host fills in the message lifecycle and stabilizes the messageId.
|
|
577
661
|
const prepareMessage = (event) => {
|
|
@@ -795,6 +879,19 @@ export class AgentExecutor {
|
|
|
795
879
|
if (!controller.signal.aborted)
|
|
796
880
|
controller.abort(error);
|
|
797
881
|
await waitCleanup().catch(() => undefined);
|
|
882
|
+
// #307:仅已确认的最终回答 fallback 保留成功;owner 的清理失败仍由 cleanup/shutdown 报告。
|
|
883
|
+
if (completedBeforeCleanup &&
|
|
884
|
+
(terminal?.type === "run.completed" || nativeTerminal?.state === "completed")) {
|
|
885
|
+
outcome = "completed";
|
|
886
|
+
if (protocolMode === "native")
|
|
887
|
+
yield { kind: "control", control: nativeTerminal };
|
|
888
|
+
else {
|
|
889
|
+
for (const event of closeMessages("completed"))
|
|
890
|
+
yield event;
|
|
891
|
+
yield terminal;
|
|
892
|
+
}
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
798
895
|
if (protocolMode === "native") {
|
|
799
896
|
const nativeFailureCode = errorCode(error);
|
|
800
897
|
if (!userCancelled)
|
|
@@ -926,22 +1023,65 @@ export class AgentExecutor {
|
|
|
926
1023
|
if (this.#shutdownResult?.cleanup === "complete")
|
|
927
1024
|
return Promise.resolve(this.#shutdownResult);
|
|
928
1025
|
this.#state = "closing";
|
|
1026
|
+
const deadline = performance.now() + timeoutMs;
|
|
929
1027
|
const pending = [...this.#probes];
|
|
1028
|
+
// 关闭恢复许可必须先于取消各轮,避免空闲服务在 shutdown 期间又启动新进程。
|
|
1029
|
+
for (const [type, scope] of this.#scopes) {
|
|
1030
|
+
try {
|
|
1031
|
+
scope.beginShutdown(reason);
|
|
1032
|
+
}
|
|
1033
|
+
catch {
|
|
1034
|
+
this.#scopeCleanup.set(type, {
|
|
1035
|
+
complete: false,
|
|
1036
|
+
unresolvedServiceIds: [type],
|
|
1037
|
+
failedCleanupServiceIds: [type]
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
930
1041
|
for (const [id, owner] of this.#owners) {
|
|
931
1042
|
if (!this.#acceptedTerminals.has(id))
|
|
932
1043
|
owner.controller.abort(reason);
|
|
933
1044
|
pending.push(this.#cleanupOwner(id, owner));
|
|
934
1045
|
}
|
|
935
|
-
|
|
1046
|
+
for (const [type, scope] of this.#scopes) {
|
|
1047
|
+
pending.push(Promise.resolve()
|
|
1048
|
+
.then(() => scope.close({ deadline }))
|
|
1049
|
+
.then((result) => {
|
|
1050
|
+
this.#scopeCleanup.set(type, result);
|
|
1051
|
+
}, () => {
|
|
1052
|
+
this.#scopeCleanup.set(type, {
|
|
1053
|
+
complete: false,
|
|
1054
|
+
unresolvedServiceIds: [type],
|
|
1055
|
+
failedCleanupServiceIds: [type]
|
|
1056
|
+
});
|
|
1057
|
+
}));
|
|
1058
|
+
}
|
|
1059
|
+
this.#shutdownAttempt = boundedCleanup(Promise.allSettled(pending), Math.max(0, deadline - performance.now())).then(() => {
|
|
936
1060
|
this.#state = "closed";
|
|
937
1061
|
const unresolvedInvocationIds = Object.freeze([...this.#owners.keys()]);
|
|
938
1062
|
const failedCleanupInvocationIds = Object.freeze([...this.#owners].filter(([, owner]) => owner.cleanupState === "failed").map(([id]) => id));
|
|
1063
|
+
const unresolvedServiceIds = Object.freeze([...this.#scopes.keys()].flatMap((type) => {
|
|
1064
|
+
const result = this.#scopeCleanup.get(type);
|
|
1065
|
+
return result?.complete === true
|
|
1066
|
+
? result.unresolvedServiceIds
|
|
1067
|
+
: result?.unresolvedServiceIds.length
|
|
1068
|
+
? result.unresolvedServiceIds
|
|
1069
|
+
: [type];
|
|
1070
|
+
}));
|
|
1071
|
+
const failedCleanupServiceIds = Object.freeze([...this.#scopeCleanup.values()].flatMap((result) => result.failedCleanupServiceIds));
|
|
939
1072
|
const result = Object.freeze({
|
|
940
1073
|
state: "closed",
|
|
941
1074
|
// probe 不属于某个 invocation,不能伪造 invocationId;仍在途时独立阻止 complete。
|
|
942
|
-
cleanup: unresolvedInvocationIds.length ||
|
|
1075
|
+
cleanup: unresolvedInvocationIds.length ||
|
|
1076
|
+
unresolvedServiceIds.length ||
|
|
1077
|
+
failedCleanupServiceIds.length ||
|
|
1078
|
+
this.#probes.size
|
|
1079
|
+
? "incomplete"
|
|
1080
|
+
: "complete",
|
|
943
1081
|
unresolvedInvocationIds,
|
|
944
|
-
failedCleanupInvocationIds
|
|
1082
|
+
failedCleanupInvocationIds,
|
|
1083
|
+
unresolvedServiceIds,
|
|
1084
|
+
failedCleanupServiceIds
|
|
945
1085
|
});
|
|
946
1086
|
this.#shutdownResult = result;
|
|
947
1087
|
this.#shutdownAttempt = undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
9
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
8
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.11",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.11"
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"files": [
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type KernelClient } from "./types.js";
|
|
3
|
-
export type AsyncQuestionReplyResult = {
|
|
4
|
-
route: "steer";
|
|
5
|
-
acceptance: "provider_accepted";
|
|
6
|
-
} | {
|
|
7
|
-
route: "new_run";
|
|
8
|
-
input: InvokeInput;
|
|
9
|
-
events: AsyncGenerator<CanonicalEvent>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* 宿主持有的一份旁路问题控制者,不拥有 Kernel 或数据库。
|
|
13
|
-
* 活动时 steer,确认正常完成后复用 invoke;宿主须串行管理同会话、
|
|
14
|
-
* 保存提交状态并消费新 Run 尾流。新流返回不代表 Provider 接纳。
|
|
15
|
-
*/
|
|
16
|
-
export declare class AsyncQuestionReply {
|
|
17
|
-
#private;
|
|
18
|
-
readonly client: KernelClient;
|
|
19
|
-
readonly continuation: () => InvokeInput;
|
|
20
|
-
readonly environment?: InvokeEnvironment | undefined;
|
|
21
|
-
constructor(client: KernelClient, snapshot: AsyncQuestionReplySnapshot, continuation: () => InvokeInput, environment?: InvokeEnvironment | undefined);
|
|
22
|
-
/** 独立 JSON 副本供宿主保存;恢复 submitting/unknown 不会再次投递。 */
|
|
23
|
-
snapshot(): AsyncQuestionReplySnapshot;
|
|
24
|
-
/** 只接受原源流事实;消息 final 或查不到 Run 不能证明正常完成。 */
|
|
25
|
-
observe(frame: HostFrame): void;
|
|
26
|
-
/** 关闭旁路,不中断模型;原活动交互同步关闭,未知响应不重试。 */
|
|
27
|
-
cancel(): Promise<void>;
|
|
28
|
-
/** 整批一次。steer 等待 Provider ACK;new_run 必须消费返回流,沿原 invoke 管理执行。 */
|
|
29
|
-
respond(value: unknown): Promise<AsyncQuestionReplyResult>;
|
|
30
|
-
}
|
|
1
|
+
export { AsyncQuestionReply, type AsyncQuestionReplyResult } from "@mininglamp-oss/octo-runtime-client";
|