chainlesschain 0.81.0 → 0.143.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/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +62 -0
- package/src/commands/activitypub.js +61 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/agent.js +117 -0
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +61 -0
- package/src/commands/bm25.js +78 -0
- package/src/commands/browse.js +64 -0
- package/src/commands/ccron.js +78 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1075 -0
- package/src/commands/compt.js +78 -0
- package/src/commands/consol.js +231 -0
- package/src/commands/cowork.js +263 -0
- package/src/commands/crosschain.js +62 -0
- package/src/commands/dao.js +62 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +61 -0
- package/src/commands/economy.js +56 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evolution.js +56 -0
- package/src/commands/evomap.js +61 -0
- package/src/commands/export.js +256 -1
- package/src/commands/fflag.js +178 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/git.js +45 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hmemory.js +56 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +42 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/itbudget.js +45 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +44 -0
- package/src/commands/matrix.js +62 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/mcpscaf.js +41 -0
- package/src/commands/meminj.js +41 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/nostr.js +62 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/orchgov.js +45 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/pdfp.js +78 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/perf.js +39 -0
- package/src/commands/perm.js +45 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/pipeline.js +57 -1
- package/src/commands/planmode.js +45 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/promcomp.js +82 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +382 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/seshhook.js +41 -0
- package/src/commands/seshsearch.js +41 -0
- package/src/commands/seshtail.js +41 -0
- package/src/commands/seshu.js +41 -0
- package/src/commands/session.js +258 -0
- package/src/commands/sganal.js +78 -0
- package/src/commands/siem.js +40 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/slotfill.js +41 -0
- package/src/commands/social.js +290 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/svccont.js +45 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/tms.js +45 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/topiccls.js +45 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/uprof.js +45 -0
- package/src/commands/vcheck.js +78 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/webfetch.js +41 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +62 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +65 -1
- package/src/lib/a2a-protocol.js +105 -0
- package/src/lib/activitypub-bridge.js +105 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-economy.js +105 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +105 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-agent.js +105 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +105 -0
- package/src/lib/bm25-search.js +81 -0
- package/src/lib/browser-automation.js +105 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-framework-reporter.js +105 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/compression-telemetry.js +81 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/content-recommender.js +105 -0
- package/src/lib/cowork-cron.js +81 -0
- package/src/lib/cowork-task-runner.js +105 -0
- package/src/lib/cross-chain.js +105 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dao-governance.js +105 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +105 -0
- package/src/lib/evolution-system.js +105 -0
- package/src/lib/evomap-manager.js +105 -0
- package/src/lib/execution-backend.js +105 -0
- package/src/lib/feature-flags.js +85 -0
- package/src/lib/git-integration.js +105 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hierarchical-memory.js +105 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +105 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/iteration-budget.js +105 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/matrix-bridge.js +105 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/mcp-scaffold.js +81 -0
- package/src/lib/memory-injection.js +81 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/nostr-bridge.js +105 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/orchestrator.js +105 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/pdf-parser.js +81 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +109 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/permission-engine.js +81 -0
- package/src/lib/pipeline-orchestrator.js +105 -0
- package/src/lib/plan-mode.js +81 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/prompt-compressor.js +1 -10
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/service-container.js +81 -0
- package/src/lib/session-consolidator.js +105 -0
- package/src/lib/session-hooks.js +81 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/session-search.js +81 -0
- package/src/lib/session-tail.js +81 -0
- package/src/lib/session-usage.js +83 -0
- package/src/lib/siem-exporter.js +105 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/slot-filler.js +81 -0
- package/src/lib/social-graph-analytics.js +81 -0
- package/src/lib/social-graph.js +81 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/sub-agent-registry.js +110 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/task-model-selector.js +81 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/todo-manager.js +105 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/topic-classifier.js +105 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/user-profile.js +81 -0
- package/src/lib/version-checker.js +81 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/web-fetch.js +81 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +105 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BM25 Search V2 governance commands — `cc bm25 ...`
|
|
3
|
+
* 在内存中治理 BM25 profile (pending/active/stale/archived) + query 生命周期。
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
BM25_PROFILE_MATURITY_V2,
|
|
7
|
+
BM25_QUERY_LIFECYCLE_V2,
|
|
8
|
+
registerBm25ProfileV2,
|
|
9
|
+
activateBm25ProfileV2,
|
|
10
|
+
staleBm25ProfileV2,
|
|
11
|
+
archiveBm25ProfileV2,
|
|
12
|
+
touchBm25ProfileV2,
|
|
13
|
+
getBm25ProfileV2,
|
|
14
|
+
listBm25ProfilesV2,
|
|
15
|
+
createBm25QueryV2,
|
|
16
|
+
searchingBm25QueryV2,
|
|
17
|
+
completeBm25QueryV2,
|
|
18
|
+
failBm25QueryV2,
|
|
19
|
+
cancelBm25QueryV2,
|
|
20
|
+
getBm25QueryV2,
|
|
21
|
+
listBm25QueriesV2,
|
|
22
|
+
setMaxActiveBm25ProfilesPerOwnerV2,
|
|
23
|
+
getMaxActiveBm25ProfilesPerOwnerV2,
|
|
24
|
+
setMaxPendingBm25QueriesPerProfileV2,
|
|
25
|
+
getMaxPendingBm25QueriesPerProfileV2,
|
|
26
|
+
setBm25ProfileIdleMsV2,
|
|
27
|
+
getBm25ProfileIdleMsV2,
|
|
28
|
+
setBm25QueryStuckMsV2,
|
|
29
|
+
getBm25QueryStuckMsV2,
|
|
30
|
+
autoStaleIdleBm25ProfilesV2,
|
|
31
|
+
autoFailStuckBm25QueriesV2,
|
|
32
|
+
getBm25SearchGovStatsV2,
|
|
33
|
+
} from "../lib/bm25-search.js";
|
|
34
|
+
|
|
35
|
+
export function registerBm25Command(program) {
|
|
36
|
+
const b = program
|
|
37
|
+
.command("bm25")
|
|
38
|
+
.description("BM25 Search V2 governance (in-memory, CLI v0.143.0)");
|
|
39
|
+
|
|
40
|
+
b.command("enums-v2").action(() => console.log(JSON.stringify({ BM25_PROFILE_MATURITY_V2, BM25_QUERY_LIFECYCLE_V2 }, null, 2)));
|
|
41
|
+
b.command("register-profile-v2")
|
|
42
|
+
.requiredOption("--id <id>")
|
|
43
|
+
.requiredOption("--owner <owner>")
|
|
44
|
+
.option("--field <field>", "indexed field", "content")
|
|
45
|
+
.action((o) => console.log(JSON.stringify(registerBm25ProfileV2(o), null, 2)));
|
|
46
|
+
b.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateBm25ProfileV2(id), null, 2)));
|
|
47
|
+
b.command("stale-profile-v2 <id>").action((id) => console.log(JSON.stringify(staleBm25ProfileV2(id), null, 2)));
|
|
48
|
+
b.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveBm25ProfileV2(id), null, 2)));
|
|
49
|
+
b.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchBm25ProfileV2(id), null, 2)));
|
|
50
|
+
b.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getBm25ProfileV2(id), null, 2)));
|
|
51
|
+
b.command("list-profiles-v2").action(() => console.log(JSON.stringify(listBm25ProfilesV2(), null, 2)));
|
|
52
|
+
|
|
53
|
+
b.command("create-query-v2")
|
|
54
|
+
.requiredOption("--id <id>")
|
|
55
|
+
.requiredOption("--profile-id <profileId>")
|
|
56
|
+
.option("--q <q>", "query text", "")
|
|
57
|
+
.action((o) => console.log(JSON.stringify(createBm25QueryV2(o), null, 2)));
|
|
58
|
+
b.command("searching-query-v2 <id>").action((id) => console.log(JSON.stringify(searchingBm25QueryV2(id), null, 2)));
|
|
59
|
+
b.command("complete-query-v2 <id>").action((id) => console.log(JSON.stringify(completeBm25QueryV2(id), null, 2)));
|
|
60
|
+
b.command("fail-query-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failBm25QueryV2(id, o.reason), null, 2)));
|
|
61
|
+
b.command("cancel-query-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelBm25QueryV2(id, o.reason), null, 2)));
|
|
62
|
+
b.command("get-query-v2 <id>").action((id) => console.log(JSON.stringify(getBm25QueryV2(id), null, 2)));
|
|
63
|
+
b.command("list-queries-v2").action(() => console.log(JSON.stringify(listBm25QueriesV2(), null, 2)));
|
|
64
|
+
|
|
65
|
+
b.command("config-v2").action(() => console.log(JSON.stringify({
|
|
66
|
+
maxActiveBm25ProfilesPerOwner: getMaxActiveBm25ProfilesPerOwnerV2(),
|
|
67
|
+
maxPendingBm25QueriesPerProfile: getMaxPendingBm25QueriesPerProfileV2(),
|
|
68
|
+
bm25ProfileIdleMs: getBm25ProfileIdleMsV2(),
|
|
69
|
+
bm25QueryStuckMs: getBm25QueryStuckMsV2(),
|
|
70
|
+
}, null, 2)));
|
|
71
|
+
b.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveBm25ProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveBm25ProfilesPerOwner: getMaxActiveBm25ProfilesPerOwnerV2() }, null, 2)); });
|
|
72
|
+
b.command("set-max-pending-queries-v2 <n>").action((n) => { setMaxPendingBm25QueriesPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingBm25QueriesPerProfile: getMaxPendingBm25QueriesPerProfileV2() }, null, 2)); });
|
|
73
|
+
b.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setBm25ProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ bm25ProfileIdleMs: getBm25ProfileIdleMsV2() }, null, 2)); });
|
|
74
|
+
b.command("set-query-stuck-ms-v2 <ms>").action((ms) => { setBm25QueryStuckMsV2(Number(ms)); console.log(JSON.stringify({ bm25QueryStuckMs: getBm25QueryStuckMsV2() }, null, 2)); });
|
|
75
|
+
b.command("auto-stale-idle-v2").action(() => console.log(JSON.stringify(autoStaleIdleBm25ProfilesV2(), null, 2)));
|
|
76
|
+
b.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckBm25QueriesV2(), null, 2)));
|
|
77
|
+
b.command("gov-stats-v2").action(() => console.log(JSON.stringify(getBm25SearchGovStatsV2(), null, 2)));
|
|
78
|
+
}
|
package/src/commands/browse.js
CHANGED
|
@@ -181,4 +181,68 @@ export function registerBrowseCommand(program) {
|
|
|
181
181
|
process.exit(1);
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
+
|
|
185
|
+
registerBrowseV2Command(browse);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
import {
|
|
190
|
+
BROWSE_TARGET_MATURITY_V2,
|
|
191
|
+
BROWSE_ACTION_LIFECYCLE_V2,
|
|
192
|
+
registerBrowseTargetV2,
|
|
193
|
+
activateBrowseTargetV2,
|
|
194
|
+
degradeBrowseTargetV2,
|
|
195
|
+
retireBrowseTargetV2,
|
|
196
|
+
touchBrowseTargetV2,
|
|
197
|
+
getBrowseTargetV2,
|
|
198
|
+
listBrowseTargetsV2,
|
|
199
|
+
createBrowseActionV2,
|
|
200
|
+
startBrowseActionV2,
|
|
201
|
+
completeBrowseActionV2,
|
|
202
|
+
failBrowseActionV2,
|
|
203
|
+
cancelBrowseActionV2,
|
|
204
|
+
getBrowseActionV2,
|
|
205
|
+
listBrowseActionsV2,
|
|
206
|
+
setMaxActiveBrowseTargetsPerOwnerV2,
|
|
207
|
+
getMaxActiveBrowseTargetsPerOwnerV2,
|
|
208
|
+
setMaxPendingBrowseActionsPerTargetV2,
|
|
209
|
+
getMaxPendingBrowseActionsPerTargetV2,
|
|
210
|
+
setBrowseTargetIdleMsV2,
|
|
211
|
+
getBrowseTargetIdleMsV2,
|
|
212
|
+
setBrowseActionStuckMsV2,
|
|
213
|
+
getBrowseActionStuckMsV2,
|
|
214
|
+
autoDegradeIdleBrowseTargetsV2,
|
|
215
|
+
autoFailStuckBrowseActionsV2,
|
|
216
|
+
getBrowserAutomationStatsV2,
|
|
217
|
+
} from "../lib/browser-automation.js";
|
|
218
|
+
|
|
219
|
+
export function registerBrowseV2Command(browse) {
|
|
220
|
+
browse.command("enums-v2").description("Show V2 enums").action(() => {
|
|
221
|
+
console.log(JSON.stringify({ BROWSE_TARGET_MATURITY_V2, BROWSE_ACTION_LIFECYCLE_V2 }, null, 2));
|
|
222
|
+
});
|
|
223
|
+
browse.command("register-target-v2").description("Register a browse target (pending)")
|
|
224
|
+
.requiredOption("--id <id>").requiredOption("--owner <owner>").option("--url <url>")
|
|
225
|
+
.action((o) => { console.log(JSON.stringify(registerBrowseTargetV2(o), null, 2)); });
|
|
226
|
+
browse.command("activate-target-v2 <id>").description("Activate target").action((id) => { console.log(JSON.stringify(activateBrowseTargetV2(id), null, 2)); });
|
|
227
|
+
browse.command("degrade-target-v2 <id>").description("Degrade target").action((id) => { console.log(JSON.stringify(degradeBrowseTargetV2(id), null, 2)); });
|
|
228
|
+
browse.command("retire-target-v2 <id>").description("Retire target (terminal)").action((id) => { console.log(JSON.stringify(retireBrowseTargetV2(id), null, 2)); });
|
|
229
|
+
browse.command("touch-target-v2 <id>").description("Refresh lastTouchedAt").action((id) => { console.log(JSON.stringify(touchBrowseTargetV2(id), null, 2)); });
|
|
230
|
+
browse.command("get-target-v2 <id>").description("Get a target").action((id) => { console.log(JSON.stringify(getBrowseTargetV2(id), null, 2)); });
|
|
231
|
+
browse.command("list-targets-v2").description("List targets").action(() => { console.log(JSON.stringify(listBrowseTargetsV2(), null, 2)); });
|
|
232
|
+
browse.command("create-action-v2").description("Create a browse action (queued)")
|
|
233
|
+
.requiredOption("--id <id>").requiredOption("--target-id <targetId>").option("--kind <kind>", "fetch/scrape/screenshot", "fetch")
|
|
234
|
+
.action((o) => { console.log(JSON.stringify(createBrowseActionV2({ id: o.id, targetId: o.targetId, kind: o.kind }), null, 2)); });
|
|
235
|
+
browse.command("start-action-v2 <id>").description("Start action").action((id) => { console.log(JSON.stringify(startBrowseActionV2(id), null, 2)); });
|
|
236
|
+
browse.command("complete-action-v2 <id>").description("Complete action").action((id) => { console.log(JSON.stringify(completeBrowseActionV2(id), null, 2)); });
|
|
237
|
+
browse.command("fail-action-v2 <id>").description("Fail action").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(failBrowseActionV2(id, o.reason), null, 2)); });
|
|
238
|
+
browse.command("cancel-action-v2 <id>").description("Cancel action").option("--reason <r>").action((id, o) => { console.log(JSON.stringify(cancelBrowseActionV2(id, o.reason), null, 2)); });
|
|
239
|
+
browse.command("get-action-v2 <id>").description("Get action").action((id) => { console.log(JSON.stringify(getBrowseActionV2(id), null, 2)); });
|
|
240
|
+
browse.command("list-actions-v2").description("List actions").action(() => { console.log(JSON.stringify(listBrowseActionsV2(), null, 2)); });
|
|
241
|
+
browse.command("set-max-active-targets-v2 <n>").description("Set per-owner active cap").action((n) => { setMaxActiveBrowseTargetsPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveBrowseTargetsPerOwner: getMaxActiveBrowseTargetsPerOwnerV2() }, null, 2)); });
|
|
242
|
+
browse.command("set-max-pending-actions-v2 <n>").description("Set per-target pending cap").action((n) => { setMaxPendingBrowseActionsPerTargetV2(Number(n)); console.log(JSON.stringify({ maxPendingBrowseActionsPerTarget: getMaxPendingBrowseActionsPerTargetV2() }, null, 2)); });
|
|
243
|
+
browse.command("set-target-idle-ms-v2 <n>").description("Set idle threshold").action((n) => { setBrowseTargetIdleMsV2(Number(n)); console.log(JSON.stringify({ browseTargetIdleMs: getBrowseTargetIdleMsV2() }, null, 2)); });
|
|
244
|
+
browse.command("set-action-stuck-ms-v2 <n>").description("Set stuck threshold").action((n) => { setBrowseActionStuckMsV2(Number(n)); console.log(JSON.stringify({ browseActionStuckMs: getBrowseActionStuckMsV2() }, null, 2)); });
|
|
245
|
+
browse.command("auto-degrade-idle-targets-v2").description("Auto-degrade idle targets").action(() => { console.log(JSON.stringify(autoDegradeIdleBrowseTargetsV2(), null, 2)); });
|
|
246
|
+
browse.command("auto-fail-stuck-actions-v2").description("Auto-fail stuck actions").action(() => { console.log(JSON.stringify(autoFailStuckBrowseActionsV2(), null, 2)); });
|
|
247
|
+
browse.command("stats-v2").description("V2 aggregate stats").action(() => { console.log(JSON.stringify(getBrowserAutomationStatsV2(), null, 2)); });
|
|
184
248
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cowork Cron V2 governance commands — `cc ccron ...`
|
|
3
|
+
* 在内存中治理 CCRON profile (pending/active/paused/archived) + tick 生命周期。
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
CCRON_PROFILE_MATURITY_V2,
|
|
7
|
+
CCRON_TICK_LIFECYCLE_V2,
|
|
8
|
+
registerCcronProfileV2,
|
|
9
|
+
activateCcronProfileV2,
|
|
10
|
+
pauseCcronProfileV2,
|
|
11
|
+
archiveCcronProfileV2,
|
|
12
|
+
touchCcronProfileV2,
|
|
13
|
+
getCcronProfileV2,
|
|
14
|
+
listCcronProfilesV2,
|
|
15
|
+
createCcronTickV2,
|
|
16
|
+
runningCcronTickV2,
|
|
17
|
+
completeCcronTickV2,
|
|
18
|
+
failCcronTickV2,
|
|
19
|
+
cancelCcronTickV2,
|
|
20
|
+
getCcronTickV2,
|
|
21
|
+
listCcronTicksV2,
|
|
22
|
+
setMaxActiveCcronProfilesPerOwnerV2,
|
|
23
|
+
getMaxActiveCcronProfilesPerOwnerV2,
|
|
24
|
+
setMaxPendingCcronTicksPerProfileV2,
|
|
25
|
+
getMaxPendingCcronTicksPerProfileV2,
|
|
26
|
+
setCcronProfileIdleMsV2,
|
|
27
|
+
getCcronProfileIdleMsV2,
|
|
28
|
+
setCcronTickStuckMsV2,
|
|
29
|
+
getCcronTickStuckMsV2,
|
|
30
|
+
autoPauseIdleCcronProfilesV2,
|
|
31
|
+
autoFailStuckCcronTicksV2,
|
|
32
|
+
getCoworkCronGovStatsV2,
|
|
33
|
+
} from "../lib/cowork-cron.js";
|
|
34
|
+
|
|
35
|
+
export function registerCcronCommand(program) {
|
|
36
|
+
const c = program
|
|
37
|
+
.command("ccron")
|
|
38
|
+
.description("Cowork Cron V2 governance (in-memory, CLI v0.143.0)");
|
|
39
|
+
|
|
40
|
+
c.command("enums-v2").action(() => console.log(JSON.stringify({ CCRON_PROFILE_MATURITY_V2, CCRON_TICK_LIFECYCLE_V2 }, null, 2)));
|
|
41
|
+
c.command("register-profile-v2")
|
|
42
|
+
.requiredOption("--id <id>")
|
|
43
|
+
.requiredOption("--owner <owner>")
|
|
44
|
+
.option("--expr <expr>", "cron expression", "0 0 * * *")
|
|
45
|
+
.action((o) => console.log(JSON.stringify(registerCcronProfileV2(o), null, 2)));
|
|
46
|
+
c.command("activate-profile-v2 <id>").action((id) => console.log(JSON.stringify(activateCcronProfileV2(id), null, 2)));
|
|
47
|
+
c.command("pause-profile-v2 <id>").action((id) => console.log(JSON.stringify(pauseCcronProfileV2(id), null, 2)));
|
|
48
|
+
c.command("archive-profile-v2 <id>").action((id) => console.log(JSON.stringify(archiveCcronProfileV2(id), null, 2)));
|
|
49
|
+
c.command("touch-profile-v2 <id>").action((id) => console.log(JSON.stringify(touchCcronProfileV2(id), null, 2)));
|
|
50
|
+
c.command("get-profile-v2 <id>").action((id) => console.log(JSON.stringify(getCcronProfileV2(id), null, 2)));
|
|
51
|
+
c.command("list-profiles-v2").action(() => console.log(JSON.stringify(listCcronProfilesV2(), null, 2)));
|
|
52
|
+
|
|
53
|
+
c.command("create-tick-v2")
|
|
54
|
+
.requiredOption("--id <id>")
|
|
55
|
+
.requiredOption("--profile-id <profileId>")
|
|
56
|
+
.option("--tick-at <ts>", "tick timestamp", "")
|
|
57
|
+
.action((o) => console.log(JSON.stringify(createCcronTickV2({ id: o.id, profileId: o.profileId, tickAt: o.tickAt }), null, 2)));
|
|
58
|
+
c.command("running-tick-v2 <id>").action((id) => console.log(JSON.stringify(runningCcronTickV2(id), null, 2)));
|
|
59
|
+
c.command("complete-tick-v2 <id>").action((id) => console.log(JSON.stringify(completeCcronTickV2(id), null, 2)));
|
|
60
|
+
c.command("fail-tick-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(failCcronTickV2(id, o.reason), null, 2)));
|
|
61
|
+
c.command("cancel-tick-v2 <id>").option("--reason <r>").action((id, o) => console.log(JSON.stringify(cancelCcronTickV2(id, o.reason), null, 2)));
|
|
62
|
+
c.command("get-tick-v2 <id>").action((id) => console.log(JSON.stringify(getCcronTickV2(id), null, 2)));
|
|
63
|
+
c.command("list-ticks-v2").action(() => console.log(JSON.stringify(listCcronTicksV2(), null, 2)));
|
|
64
|
+
|
|
65
|
+
c.command("config-v2").action(() => console.log(JSON.stringify({
|
|
66
|
+
maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2(),
|
|
67
|
+
maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2(),
|
|
68
|
+
ccronProfileIdleMs: getCcronProfileIdleMsV2(),
|
|
69
|
+
ccronTickStuckMs: getCcronTickStuckMsV2(),
|
|
70
|
+
}, null, 2)));
|
|
71
|
+
c.command("set-max-active-profiles-v2 <n>").action((n) => { setMaxActiveCcronProfilesPerOwnerV2(Number(n)); console.log(JSON.stringify({ maxActiveCcronProfilesPerOwner: getMaxActiveCcronProfilesPerOwnerV2() }, null, 2)); });
|
|
72
|
+
c.command("set-max-pending-ticks-v2 <n>").action((n) => { setMaxPendingCcronTicksPerProfileV2(Number(n)); console.log(JSON.stringify({ maxPendingCcronTicksPerProfile: getMaxPendingCcronTicksPerProfileV2() }, null, 2)); });
|
|
73
|
+
c.command("set-profile-idle-ms-v2 <ms>").action((ms) => { setCcronProfileIdleMsV2(Number(ms)); console.log(JSON.stringify({ ccronProfileIdleMs: getCcronProfileIdleMsV2() }, null, 2)); });
|
|
74
|
+
c.command("set-tick-stuck-ms-v2 <ms>").action((ms) => { setCcronTickStuckMsV2(Number(ms)); console.log(JSON.stringify({ ccronTickStuckMs: getCcronTickStuckMsV2() }, null, 2)); });
|
|
75
|
+
c.command("auto-pause-idle-v2").action(() => console.log(JSON.stringify(autoPauseIdleCcronProfilesV2(), null, 2)));
|
|
76
|
+
c.command("auto-fail-stuck-v2").action(() => console.log(JSON.stringify(autoFailStuckCcronTicksV2(), null, 2)));
|
|
77
|
+
c.command("gov-stats-v2").action(() => console.log(JSON.stringify(getCoworkCronGovStatsV2(), null, 2)));
|
|
78
|
+
}
|
package/src/commands/codegen.js
CHANGED
|
@@ -20,8 +20,52 @@ import {
|
|
|
20
20
|
getScaffold,
|
|
21
21
|
listScaffolds,
|
|
22
22
|
getCodeAgentStats,
|
|
23
|
+
|
|
24
|
+
// Phase 86 V2
|
|
25
|
+
AGENT_MATURITY_V2,
|
|
26
|
+
GEN_JOB_V2,
|
|
27
|
+
getDefaultMaxActiveAgentsPerOwnerV2,
|
|
28
|
+
getMaxActiveAgentsPerOwnerV2,
|
|
29
|
+
setMaxActiveAgentsPerOwnerV2,
|
|
30
|
+
getDefaultMaxRunningJobsPerOwnerV2,
|
|
31
|
+
getMaxRunningJobsPerOwnerV2,
|
|
32
|
+
setMaxRunningJobsPerOwnerV2,
|
|
33
|
+
getDefaultAgentIdleMsV2,
|
|
34
|
+
getAgentIdleMsV2,
|
|
35
|
+
setAgentIdleMsV2,
|
|
36
|
+
getDefaultJobStuckMsV2,
|
|
37
|
+
getJobStuckMsV2,
|
|
38
|
+
setJobStuckMsV2,
|
|
39
|
+
registerAgentV2,
|
|
40
|
+
getAgentV2,
|
|
41
|
+
setAgentMaturityV2,
|
|
42
|
+
activateAgent,
|
|
43
|
+
deprecateAgent,
|
|
44
|
+
retireAgent,
|
|
45
|
+
touchAgentInvocation,
|
|
46
|
+
enqueueGenJobV2,
|
|
47
|
+
getGenJobV2,
|
|
48
|
+
setGenJobStatusV2,
|
|
49
|
+
startGenJob,
|
|
50
|
+
succeedGenJob,
|
|
51
|
+
failGenJob,
|
|
52
|
+
cancelGenJob,
|
|
53
|
+
getActiveAgentCount,
|
|
54
|
+
getRunningJobCount,
|
|
55
|
+
autoRetireIdleAgents,
|
|
56
|
+
autoFailStuckGenJobs,
|
|
57
|
+
getCodeAgentStatsV2,
|
|
23
58
|
} from "../lib/code-agent.js";
|
|
24
59
|
|
|
60
|
+
function _parseMetaV2(raw) {
|
|
61
|
+
if (!raw) return undefined;
|
|
62
|
+
try {
|
|
63
|
+
return JSON.parse(raw);
|
|
64
|
+
} catch {
|
|
65
|
+
throw new Error("--metadata must be valid JSON");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
25
69
|
function _dbFromCtx(cmd) {
|
|
26
70
|
const root = cmd?.parent?.parent ?? cmd?.parent;
|
|
27
71
|
return root?._db;
|
|
@@ -299,5 +343,185 @@ export function registerCodegenCommand(program) {
|
|
|
299
343
|
}
|
|
300
344
|
});
|
|
301
345
|
|
|
346
|
+
/* ═══════════════════════════════════════════════════ *
|
|
347
|
+
* Phase 86 V2
|
|
348
|
+
* ═══════════════════════════════════════════════════ */
|
|
349
|
+
|
|
350
|
+
cg.command("agent-maturities-v2")
|
|
351
|
+
.description("List V2 agent maturity states")
|
|
352
|
+
.option("--json", "JSON")
|
|
353
|
+
.action((opts) => {
|
|
354
|
+
const xs = Object.values(AGENT_MATURITY_V2);
|
|
355
|
+
if (opts.json) return console.log(JSON.stringify(xs, null, 2));
|
|
356
|
+
for (const x of xs) console.log(` ${x}`);
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
cg.command("gen-jobs-v2")
|
|
360
|
+
.description("List V2 generation-job states")
|
|
361
|
+
.option("--json", "JSON")
|
|
362
|
+
.action((opts) => {
|
|
363
|
+
const xs = Object.values(GEN_JOB_V2);
|
|
364
|
+
if (opts.json) return console.log(JSON.stringify(xs, null, 2));
|
|
365
|
+
for (const x of xs) console.log(` ${x}`);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
cg.command("default-max-active-agents-per-owner").action(() =>
|
|
369
|
+
console.log(getDefaultMaxActiveAgentsPerOwnerV2()),
|
|
370
|
+
);
|
|
371
|
+
cg.command("max-active-agents-per-owner").action(() =>
|
|
372
|
+
console.log(getMaxActiveAgentsPerOwnerV2()),
|
|
373
|
+
);
|
|
374
|
+
cg.command("set-max-active-agents-per-owner <n>").action((n) =>
|
|
375
|
+
console.log(setMaxActiveAgentsPerOwnerV2(n)),
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
cg.command("default-max-running-jobs-per-owner").action(() =>
|
|
379
|
+
console.log(getDefaultMaxRunningJobsPerOwnerV2()),
|
|
380
|
+
);
|
|
381
|
+
cg.command("max-running-jobs-per-owner").action(() =>
|
|
382
|
+
console.log(getMaxRunningJobsPerOwnerV2()),
|
|
383
|
+
);
|
|
384
|
+
cg.command("set-max-running-jobs-per-owner <n>").action((n) =>
|
|
385
|
+
console.log(setMaxRunningJobsPerOwnerV2(n)),
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
cg.command("default-agent-idle-ms").action(() =>
|
|
389
|
+
console.log(getDefaultAgentIdleMsV2()),
|
|
390
|
+
);
|
|
391
|
+
cg.command("agent-idle-ms").action(() => console.log(getAgentIdleMsV2()));
|
|
392
|
+
cg.command("set-agent-idle-ms <ms>").action((ms) =>
|
|
393
|
+
console.log(setAgentIdleMsV2(ms)),
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
cg.command("default-job-stuck-ms").action(() =>
|
|
397
|
+
console.log(getDefaultJobStuckMsV2()),
|
|
398
|
+
);
|
|
399
|
+
cg.command("job-stuck-ms").action(() => console.log(getJobStuckMsV2()));
|
|
400
|
+
cg.command("set-job-stuck-ms <ms>").action((ms) =>
|
|
401
|
+
console.log(setJobStuckMsV2(ms)),
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
cg.command("active-agent-count")
|
|
405
|
+
.option("-o, --owner <id>")
|
|
406
|
+
.action((opts) => console.log(getActiveAgentCount(opts.owner)));
|
|
407
|
+
cg.command("running-job-count")
|
|
408
|
+
.option("-o, --owner <id>")
|
|
409
|
+
.action((opts) => console.log(getRunningJobCount(opts.owner)));
|
|
410
|
+
|
|
411
|
+
cg.command("register-agent-v2 <agent-id>")
|
|
412
|
+
.requiredOption("-o, --owner <id>")
|
|
413
|
+
.option("-n, --name <name>")
|
|
414
|
+
.option("-i, --initial-status <s>")
|
|
415
|
+
.option("--metadata <json>")
|
|
416
|
+
.action((id, opts) => {
|
|
417
|
+
const r = registerAgentV2(null, {
|
|
418
|
+
agentId: id,
|
|
419
|
+
ownerId: opts.owner,
|
|
420
|
+
name: opts.name,
|
|
421
|
+
initialStatus: opts.initialStatus,
|
|
422
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
423
|
+
});
|
|
424
|
+
console.log(JSON.stringify(r, null, 2));
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
cg.command("agent-v2 <agent-id>").action((id) => {
|
|
428
|
+
const r = getAgentV2(id);
|
|
429
|
+
if (!r) {
|
|
430
|
+
console.error(`Unknown agent: ${id}`);
|
|
431
|
+
process.exitCode = 1;
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
console.log(JSON.stringify(r, null, 2));
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
cg.command("set-agent-maturity-v2 <agent-id> <status>")
|
|
438
|
+
.option("-r, --reason <text>")
|
|
439
|
+
.option("--metadata <json>")
|
|
440
|
+
.action((id, status, opts) => {
|
|
441
|
+
const r = setAgentMaturityV2(null, id, status, {
|
|
442
|
+
reason: opts.reason,
|
|
443
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
444
|
+
});
|
|
445
|
+
console.log(JSON.stringify(r, null, 2));
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
for (const [name, fn] of [
|
|
449
|
+
["activate-agent", activateAgent],
|
|
450
|
+
["deprecate-agent", deprecateAgent],
|
|
451
|
+
["retire-agent", retireAgent],
|
|
452
|
+
]) {
|
|
453
|
+
cg.command(`${name} <agent-id>`)
|
|
454
|
+
.option("-r, --reason <text>")
|
|
455
|
+
.action((id, opts) => {
|
|
456
|
+
const r = fn(null, id, opts.reason);
|
|
457
|
+
console.log(JSON.stringify(r, null, 2));
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
cg.command("touch-agent-invocation <agent-id>").action((id) =>
|
|
462
|
+
console.log(JSON.stringify(touchAgentInvocation(id), null, 2)),
|
|
463
|
+
);
|
|
464
|
+
|
|
465
|
+
cg.command("enqueue-gen-job-v2 <job-id>")
|
|
466
|
+
.requiredOption("-o, --owner <id>")
|
|
467
|
+
.requiredOption("-a, --agent <id>")
|
|
468
|
+
.requiredOption("-p, --prompt <text>")
|
|
469
|
+
.option("--metadata <json>")
|
|
470
|
+
.action((id, opts) => {
|
|
471
|
+
const r = enqueueGenJobV2(null, {
|
|
472
|
+
jobId: id,
|
|
473
|
+
ownerId: opts.owner,
|
|
474
|
+
agentId: opts.agent,
|
|
475
|
+
prompt: opts.prompt,
|
|
476
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
477
|
+
});
|
|
478
|
+
console.log(JSON.stringify(r, null, 2));
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
cg.command("gen-job-v2 <job-id>").action((id) => {
|
|
482
|
+
const r = getGenJobV2(id);
|
|
483
|
+
if (!r) {
|
|
484
|
+
console.error(`Unknown job: ${id}`);
|
|
485
|
+
process.exitCode = 1;
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
console.log(JSON.stringify(r, null, 2));
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
cg.command("set-gen-job-status-v2 <job-id> <status>")
|
|
492
|
+
.option("-r, --reason <text>")
|
|
493
|
+
.option("--metadata <json>")
|
|
494
|
+
.action((id, status, opts) => {
|
|
495
|
+
const r = setGenJobStatusV2(null, id, status, {
|
|
496
|
+
reason: opts.reason,
|
|
497
|
+
metadata: _parseMetaV2(opts.metadata),
|
|
498
|
+
});
|
|
499
|
+
console.log(JSON.stringify(r, null, 2));
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
for (const [name, fn] of [
|
|
503
|
+
["start-gen-job", startGenJob],
|
|
504
|
+
["succeed-gen-job", succeedGenJob],
|
|
505
|
+
["fail-gen-job", failGenJob],
|
|
506
|
+
["cancel-gen-job", cancelGenJob],
|
|
507
|
+
]) {
|
|
508
|
+
cg.command(`${name} <job-id>`)
|
|
509
|
+
.option("-r, --reason <text>")
|
|
510
|
+
.action((id, opts) => {
|
|
511
|
+
const r = fn(null, id, opts.reason);
|
|
512
|
+
console.log(JSON.stringify(r, null, 2));
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
cg.command("auto-retire-idle-agents").action(() =>
|
|
517
|
+
console.log(JSON.stringify(autoRetireIdleAgents(null), null, 2)),
|
|
518
|
+
);
|
|
519
|
+
cg.command("auto-fail-stuck-gen-jobs").action(() =>
|
|
520
|
+
console.log(JSON.stringify(autoFailStuckGenJobs(null), null, 2)),
|
|
521
|
+
);
|
|
522
|
+
cg.command("stats-v2").action(() =>
|
|
523
|
+
console.log(JSON.stringify(getCodeAgentStatsV2(), null, 2)),
|
|
524
|
+
);
|
|
525
|
+
|
|
302
526
|
program.addCommand(cg);
|
|
303
527
|
}
|