doukui 0.6.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +85 -18
- package/README.md +32 -72
- package/bin/commands/help.js +2 -25
- package/bin/commands/plan-lint.js +105 -0
- package/bin/commands/verify.js +263 -0
- package/bin/doukui.js +3 -3
- package/package.json +2 -3
- package/plugins/core/hook-session-start/index.js +1 -1
- package/plugins/core/hook-skill-gate/index.js +64 -15
- package/plugins/core/hook-skill-gate/plugin.json +1 -1
- package/plugins/core/skill-agent-dispatcher/cleanup-reference.md +7 -28
- package/plugins/core/skill-agent-dispatcher/monitoring-reference.md +89 -0
- package/plugins/core/skill-agent-dispatcher/plugin.json +1 -1
- package/plugins/core/skill-agent-dispatcher/recovery-reference.md +132 -0
- package/plugins/core/skill-agent-dispatcher/roles-reference.md +9 -22
- package/plugins/core/skill-agent-dispatcher/skill.md +124 -796
- package/plugins/core/skill-agentic-loop/mirror-rules.md +95 -24
- package/plugins/core/skill-agentic-loop/plugin.json +2 -7
- package/plugins/core/skill-agentic-loop/skill.md +125 -354
- package/plugins/core/skill-batch-task-creator/plugin.json +1 -1
- package/plugins/core/skill-checklist/skill.md +15 -141
- package/plugins/core/skill-completion-report/plugin.json +1 -1
- package/plugins/core/skill-completion-report/skill.md +7 -1
- package/plugins/core/skill-doukui-plan/plugin.json +1 -1
- package/plugins/core/skill-doukui-plan/skill.md +24 -21
- package/plugins/core/skill-experience-logger/plugin.json +1 -1
- package/plugins/core/skill-human-checkpoint/skill.md +1 -0
- package/plugins/core/skill-split-work-package/plugin.json +1 -1
- package/plugins/core/skill-task-creator/plugin.json +1 -1
- package/plugins/core/skill-task-creator/skill.md +1 -139
- package/plugins/core/skill-workflow-orchestrator/plugin.json +1 -1
- package/plugins/plugin-registry.json +0 -48
- package/plugins/runtime/harness-build.js +5 -5
- package/plugins/runtime/plan-reader.js +54 -21
- package/plugins/runtime/resolve-plugin-path.js +2 -2
- package/templates/harness-config.yaml +0 -100
- package/bin/commands/loop-server.js +0 -357
- package/bin/commands/loop.js +0 -1508
- package/plugins/contracts/capabilities.js +0 -268
- package/plugins/contracts/checkresult-schema.json +0 -75
- package/plugins/core/provider-loop-engine/index.js +0 -1411
- package/plugins/core/provider-loop-engine/plugin.json +0 -15
- package/plugins/core/provider-memory-store/index.js +0 -510
- package/plugins/core/provider-memory-store/plugin.json +0 -9
- package/plugins/core/provider-state-store/index.js +0 -244
- package/plugins/core/provider-state-store/plugin.json +0 -9
- package/plugins/core/provider-watchdog/assets/daemon-config.template.json +0 -32
- package/plugins/core/provider-watchdog/assets/lib/watchdog-multi-window.js +0 -676
- package/plugins/core/provider-watchdog/assets/watchdog.js +0 -754
- package/plugins/core/provider-watchdog/index.js +0 -151
- package/plugins/core/provider-watchdog/plugin.json +0 -13
- package/plugins/core/skill-agent-dispatcher/daemon-helpers-reference.md +0 -249
- package/plugins/core/skill-watchdog-manager/plugin.json +0 -10
- package/plugins/core/skill-watchdog-manager/skill.md +0 -143
- package/plugins/core/validator-doc-sync/index.js +0 -248
- package/plugins/core/validator-doc-sync/plugin.json +0 -12
- package/plugins/core/validator-work-package/index.js +0 -300
- package/plugins/core/validator-work-package/plugin.json +0 -12
- package/plugins/runtime/audit-logger.js +0 -311
- package/plugins/runtime/build-cli.js +0 -89
- package/plugins/runtime/checkresult-validator.js +0 -131
- package/plugins/runtime/context-window.js +0 -81
- package/plugins/runtime/event-bus.js +0 -207
- package/plugins/runtime/executor-claude.js +0 -604
- package/plugins/runtime/executor-default.js +0 -448
- package/plugins/runtime/executor-local.js +0 -178
- package/plugins/runtime/executor-sdk.js +0 -415
- package/plugins/runtime/hook-dispatcher.js +0 -315
- package/plugins/runtime/loop-actuator.js +0 -292
- package/plugins/runtime/loop-coordinator.js +0 -347
- package/plugins/runtime/loop-defaults.js +0 -29
- package/plugins/runtime/loop-dispatch-batch.js +0 -351
- package/plugins/runtime/loop-executor.js +0 -120
- package/plugins/runtime/loop-report.js +0 -395
- package/plugins/runtime/loop-server-core.js +0 -750
- package/plugins/runtime/loop-snapshot.js +0 -581
- package/plugins/runtime/loop-trace.js +0 -242
- package/plugins/runtime/loop-worktree.js +0 -404
- package/plugins/runtime/multi-window-coordinator.js +0 -560
- package/plugins/runtime/objective-verifier.js +0 -136
- package/plugins/runtime/plan-lint.js +0 -106
- package/plugins/runtime/plugin-loader.js +0 -798
- package/plugins/runtime/plugin-trust.js +0 -182
- package/plugins/runtime/provider-failover.js +0 -114
- package/plugins/runtime/provider-resolver.js +0 -342
- package/plugins/runtime/reflection-evaluator.js +0 -545
- package/plugins/runtime/sandbox-context.js +0 -235
- package/plugins/runtime/sandbox-manager.js +0 -609
- package/plugins/runtime/sandbox-worker.js +0 -215
- package/plugins/runtime/self-rescue-ladder.js +0 -51
- package/plugins/runtime/text-tokenize.js +0 -25
- package/plugins/runtime/validator-pipeline.js +0 -475
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SandboxContext - Standalone RPC proxy context factory
|
|
3
|
-
*
|
|
4
|
-
* Provides two utilities:
|
|
5
|
-
* 1. createSandboxProxy() - creates a PluginContext-like proxy object that
|
|
6
|
-
* forwards method calls through a message port (used inside Worker Threads)
|
|
7
|
-
* 2. createMainThreadBridge() - creates a message handler for the main thread
|
|
8
|
-
* side that dispatches RPC calls to real services
|
|
9
|
-
*
|
|
10
|
-
* This module complements the inline SandboxContext in sandbox-worker.js by
|
|
11
|
-
* providing a testable factory that can be used outside of Worker Threads.
|
|
12
|
-
*
|
|
13
|
-
* @module sandbox-context
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a sandbox proxy object that mimics PluginContext interface.
|
|
20
|
-
* All method calls are forwarded as RPC messages through the given port.
|
|
21
|
-
*
|
|
22
|
-
* This is the main-thread side factory for creating proxy objects
|
|
23
|
-
* that can be tested without Worker Threads.
|
|
24
|
-
*
|
|
25
|
-
* @experimental
|
|
26
|
-
* @param {string} pluginName - plugin name
|
|
27
|
-
* @param {object} port - message port with postMessage/on/off methods
|
|
28
|
-
* @returns {object} proxy context object
|
|
29
|
-
*/
|
|
30
|
-
function createSandboxProxy(pluginName, port) {
|
|
31
|
-
var rpcId = 0;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Send an RPC call and wait for the response.
|
|
35
|
-
* @param {string} method
|
|
36
|
-
* @param {Array} args
|
|
37
|
-
* @returns {Promise<any>}
|
|
38
|
-
*/
|
|
39
|
-
function rpc(method, args) {
|
|
40
|
-
var id = ++rpcId;
|
|
41
|
-
|
|
42
|
-
return new Promise(function (resolve, reject) {
|
|
43
|
-
var handler = function (msg) {
|
|
44
|
-
if (msg.type === 'rpc-response' && msg.id === id) {
|
|
45
|
-
port.off('message', handler);
|
|
46
|
-
if (msg.error) {
|
|
47
|
-
reject(new Error(msg.error));
|
|
48
|
-
} else {
|
|
49
|
-
resolve(msg.result);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
port.on('message', handler);
|
|
55
|
-
port.postMessage({
|
|
56
|
-
type: 'rpc-request',
|
|
57
|
-
id: id,
|
|
58
|
-
method: method,
|
|
59
|
-
args: args,
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
pluginName: pluginName,
|
|
66
|
-
_rpc: rpc,
|
|
67
|
-
|
|
68
|
-
eventBus: {
|
|
69
|
-
emit: function (event, data) {
|
|
70
|
-
return rpc('eventBus.emit', [event, data]);
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
stateStore: {
|
|
75
|
-
get: function (key) {
|
|
76
|
-
return rpc('stateStore.get', [key]);
|
|
77
|
-
},
|
|
78
|
-
set: function (key, value) {
|
|
79
|
-
return rpc('stateStore.set', [key, value]);
|
|
80
|
-
},
|
|
81
|
-
delete: function (key) {
|
|
82
|
-
return rpc('stateStore.delete', [key]);
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
logger: {
|
|
87
|
-
info: function (msg) {
|
|
88
|
-
return rpc('logger.info', [msg]);
|
|
89
|
-
},
|
|
90
|
-
warn: function (msg) {
|
|
91
|
-
return rpc('logger.warn', [msg]);
|
|
92
|
-
},
|
|
93
|
-
error: function (msg) {
|
|
94
|
-
return rpc('logger.error', [msg]);
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
config: {
|
|
99
|
-
get: function (key) {
|
|
100
|
-
return rpc('config.get', [key]);
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
getProvider: function (name) {
|
|
105
|
-
return rpc('getProvider', [name]);
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
getPlugin: function () {
|
|
109
|
-
return undefined; // Not supported in sandbox
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Create a main-thread RPC handler that dispatches calls to real services.
|
|
116
|
-
*
|
|
117
|
-
* @experimental
|
|
118
|
-
* @param {object} services - { eventBus, stateStore, logger, configManager, getProvider }
|
|
119
|
-
* @param {object} options
|
|
120
|
-
* @param {Function} [options.onRpc] - callback for each RPC call (for testing/auditing)
|
|
121
|
-
* @returns {Function} message handler function (to attach to worker/port 'message' event)
|
|
122
|
-
*/
|
|
123
|
-
function createMainThreadBridge(services, options) {
|
|
124
|
-
options = options || {};
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Message handler for RPC dispatch.
|
|
128
|
-
*
|
|
129
|
-
* @param {object} msg - RPC request message
|
|
130
|
-
* @param {object} [respondTo] - object with postMessage method (e.g. Worker or test port)
|
|
131
|
-
*/
|
|
132
|
-
return function handleRpcMessage(msg, respondTo) {
|
|
133
|
-
if (!msg || msg.type !== 'rpc-request') return;
|
|
134
|
-
|
|
135
|
-
var id = msg.id;
|
|
136
|
-
var method = msg.method;
|
|
137
|
-
var args = msg.args || [];
|
|
138
|
-
|
|
139
|
-
// Notify callback
|
|
140
|
-
if (options.onRpc) {
|
|
141
|
-
options.onRpc(method, args);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Execute the method
|
|
145
|
-
try {
|
|
146
|
-
var result = callService(services, method, args);
|
|
147
|
-
|
|
148
|
-
if (result && typeof result.then === 'function') {
|
|
149
|
-
result.then(function (resolved) {
|
|
150
|
-
sendResponse(respondTo, id, resolved, null);
|
|
151
|
-
}).catch(function (err) {
|
|
152
|
-
sendResponse(respondTo, id, null, err.message);
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
sendResponse(respondTo, id, result, null);
|
|
156
|
-
}
|
|
157
|
-
} catch (err) {
|
|
158
|
-
sendResponse(respondTo, id, null, err.message);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Call a service method by name.
|
|
165
|
-
*
|
|
166
|
-
* @internal
|
|
167
|
-
* @param {object} services
|
|
168
|
-
* @param {string} method
|
|
169
|
-
* @param {Array} args
|
|
170
|
-
* @returns {*}
|
|
171
|
-
*/
|
|
172
|
-
function callService(services, method, args) {
|
|
173
|
-
// Known methods: if service is available, call it; if not, return undefined
|
|
174
|
-
if (method === 'eventBus.emit') {
|
|
175
|
-
return services.eventBus ? services.eventBus.emit(args[0], args[1]) : undefined;
|
|
176
|
-
}
|
|
177
|
-
if (method === 'stateStore.get') {
|
|
178
|
-
return services.stateStore ? services.stateStore.get(args[0]) : undefined;
|
|
179
|
-
}
|
|
180
|
-
if (method === 'stateStore.set') {
|
|
181
|
-
return services.stateStore ? services.stateStore.set(args[0], args[1]) : undefined;
|
|
182
|
-
}
|
|
183
|
-
if (method === 'stateStore.delete') {
|
|
184
|
-
return services.stateStore ? services.stateStore.delete(args[0]) : undefined;
|
|
185
|
-
}
|
|
186
|
-
if (method === 'logger.info') {
|
|
187
|
-
return services.logger ? services.logger.info(args[0]) : undefined;
|
|
188
|
-
}
|
|
189
|
-
if (method === 'logger.warn') {
|
|
190
|
-
return services.logger ? services.logger.warn(args[0]) : undefined;
|
|
191
|
-
}
|
|
192
|
-
if (method === 'logger.error') {
|
|
193
|
-
return services.logger ? services.logger.error(args[0]) : undefined;
|
|
194
|
-
}
|
|
195
|
-
if (method === 'config.get') {
|
|
196
|
-
return services.configManager ? services.configManager.get(args[0]) : undefined;
|
|
197
|
-
}
|
|
198
|
-
if (method === 'getProvider') {
|
|
199
|
-
return services.getProvider ? services.getProvider(args[0]) : undefined;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
throw new Error('Unknown RPC method: ' + method);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Send an RPC response.
|
|
207
|
-
*
|
|
208
|
-
* @internal
|
|
209
|
-
* @param {object|null} respondTo - object with postMessage method
|
|
210
|
-
* @param {number} id - RPC call ID
|
|
211
|
-
* @param {*} result - result value
|
|
212
|
-
* @param {string|null} error - error message
|
|
213
|
-
*/
|
|
214
|
-
function sendResponse(respondTo, id, result, error) {
|
|
215
|
-
if (!respondTo) return;
|
|
216
|
-
|
|
217
|
-
var response = {
|
|
218
|
-
type: 'rpc-response',
|
|
219
|
-
id: id,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
if (error) {
|
|
223
|
-
response.error = error;
|
|
224
|
-
} else {
|
|
225
|
-
response.result = result;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
respondTo.postMessage(response);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
module.exports = {
|
|
232
|
-
createSandboxProxy: createSandboxProxy,
|
|
233
|
-
createMainThreadBridge: createMainThreadBridge,
|
|
234
|
-
callService: callService,
|
|
235
|
-
};
|