chainlesschain 0.132.0 → 0.145.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/package.json +1 -1
- package/src/commands/a2a.js +230 -0
- package/src/commands/activitypub.js +191 -0
- package/src/commands/agent.js +601 -0
- package/src/commands/audit.js +206 -0
- package/src/commands/bi.js +186 -0
- package/src/commands/bm25.js +162 -0
- package/src/commands/browse.js +225 -0
- package/src/commands/ccron.js +178 -0
- package/src/commands/chat.js +207 -0
- package/src/commands/compliance.js +420 -0
- package/src/commands/compt.js +176 -0
- package/src/commands/consol.js +237 -0
- package/src/commands/cowork.js +588 -0
- package/src/commands/crosschain.js +216 -0
- package/src/commands/dao.js +216 -0
- package/src/commands/dlp.js +206 -0
- package/src/commands/economy.js +211 -0
- package/src/commands/evolution.js +209 -0
- package/src/commands/evomap.js +216 -0
- package/src/commands/fflag.js +230 -0
- package/src/commands/git.js +185 -0
- package/src/commands/hardening.js +209 -0
- package/src/commands/hmemory.js +210 -0
- package/src/commands/incentive.js +209 -0
- package/src/commands/inference.js +178 -0
- package/src/commands/itbudget.js +161 -0
- package/src/commands/kg.js +206 -0
- package/src/commands/lowcode.js +201 -0
- package/src/commands/marketplace.js +206 -0
- package/src/commands/matrix.js +214 -0
- package/src/commands/mcpscaf.js +153 -0
- package/src/commands/meminj.js +153 -0
- package/src/commands/nostr.js +213 -0
- package/src/commands/orchestrate.js +217 -0
- package/src/commands/orchgov.js +156 -0
- package/src/commands/pdfp.js +160 -0
- package/src/commands/perf.js +176 -0
- package/src/commands/perm.js +156 -0
- package/src/commands/pipeline.js +211 -0
- package/src/commands/planmode.js +154 -0
- package/src/commands/privacy.js +203 -0
- package/src/commands/promcomp.js +166 -0
- package/src/commands/recommend.js +185 -0
- package/src/commands/reputation.js +208 -0
- package/src/commands/sandbox.js +206 -0
- package/src/commands/seshhook.js +153 -0
- package/src/commands/seshsearch.js +149 -0
- package/src/commands/seshtail.js +152 -0
- package/src/commands/seshu.js +160 -0
- package/src/commands/sganal.js +172 -0
- package/src/commands/siem.js +207 -0
- package/src/commands/sla.js +212 -0
- package/src/commands/slotfill.js +154 -0
- package/src/commands/social.js +159 -0
- package/src/commands/stress.js +206 -0
- package/src/commands/svccont.js +157 -0
- package/src/commands/terraform.js +206 -0
- package/src/commands/tms.js +183 -0
- package/src/commands/topiccls.js +158 -0
- package/src/commands/uprof.js +154 -0
- package/src/commands/vcheck.js +172 -0
- package/src/commands/webfetch.js +150 -0
- package/src/commands/zkp.js +218 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +101 -1
- package/src/lib/a2a-protocol.js +373 -0
- package/src/lib/activitypub-bridge.js +343 -0
- package/src/lib/agent-economy.js +358 -0
- package/src/lib/app-builder.js +338 -0
- package/src/lib/audit-logger.js +321 -0
- package/src/lib/autonomous-agent.js +341 -0
- package/src/lib/bi-engine.js +339 -0
- package/src/lib/bm25-search.js +333 -0
- package/src/lib/browser-automation.js +352 -0
- package/src/lib/chat-core.js +336 -0
- package/src/lib/claude-code-bridge.js +341 -0
- package/src/lib/compliance-framework-reporter.js +359 -0
- package/src/lib/compliance-manager.js +330 -0
- package/src/lib/compression-telemetry.js +333 -0
- package/src/lib/content-recommender.js +370 -0
- package/src/lib/cowork-cron.js +330 -0
- package/src/lib/cowork-learning.js +333 -0
- package/src/lib/cowork-task-runner.js +362 -0
- package/src/lib/cowork-workflow.js +327 -0
- package/src/lib/cross-chain.js +365 -0
- package/src/lib/dao-governance.js +339 -0
- package/src/lib/dlp-engine.js +343 -0
- package/src/lib/evolution-system.js +336 -0
- package/src/lib/evomap-manager.js +339 -0
- package/src/lib/execution-backend.js +351 -0
- package/src/lib/feature-flags.js +330 -0
- package/src/lib/git-integration.js +343 -0
- package/src/lib/hardening-manager.js +341 -0
- package/src/lib/hierarchical-memory.js +341 -0
- package/src/lib/inference-network.js +362 -0
- package/src/lib/iteration-budget.js +357 -0
- package/src/lib/knowledge-graph.js +333 -0
- package/src/lib/matrix-bridge.js +339 -0
- package/src/lib/mcp-scaffold.js +345 -0
- package/src/lib/memory-injection.js +320 -0
- package/src/lib/nostr-bridge.js +342 -0
- package/src/lib/orchestrator.js +350 -0
- package/src/lib/pdf-parser.js +330 -0
- package/src/lib/perf-tuning.js +364 -0
- package/src/lib/permission-engine.js +319 -0
- package/src/lib/pipeline-orchestrator.js +345 -0
- package/src/lib/plan-mode.js +328 -0
- package/src/lib/privacy-computing.js +335 -0
- package/src/lib/prompt-compressor.js +1 -10
- package/src/lib/reputation-optimizer.js +340 -0
- package/src/lib/sandbox-v2.js +327 -0
- package/src/lib/service-container.js +342 -0
- package/src/lib/session-consolidator.js +352 -0
- package/src/lib/session-hooks.js +340 -0
- package/src/lib/session-search.js +334 -0
- package/src/lib/session-tail.js +320 -0
- package/src/lib/session-usage.js +329 -0
- package/src/lib/siem-exporter.js +352 -0
- package/src/lib/skill-marketplace.js +345 -0
- package/src/lib/sla-manager.js +341 -0
- package/src/lib/slot-filler.js +333 -0
- package/src/lib/social-graph-analytics.js +327 -0
- package/src/lib/social-graph.js +304 -0
- package/src/lib/stress-tester.js +342 -0
- package/src/lib/sub-agent-registry.js +359 -0
- package/src/lib/task-model-selector.js +333 -0
- package/src/lib/terraform-manager.js +333 -0
- package/src/lib/todo-manager.js +339 -0
- package/src/lib/token-incentive.js +341 -0
- package/src/lib/topic-classifier.js +353 -0
- package/src/lib/user-profile.js +325 -0
- package/src/lib/version-checker.js +335 -0
- package/src/lib/web-fetch.js +322 -0
- package/src/lib/zkp-engine.js +342 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc orchgov` — Orchestrator V2 governance overlay.
|
|
3
|
+
*
|
|
4
|
+
* In-memory governance for orchestrator profiles + task lifecycle, layered atop
|
|
5
|
+
* `lib/orchestrator.js`. Independent of the legacy `cc orchestrate` command.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ORCH_PROFILE_MATURITY_V2,
|
|
10
|
+
ORCH_TASK_LIFECYCLE_V2,
|
|
11
|
+
setMaxActiveOrchProfilesPerOwnerV2,
|
|
12
|
+
getMaxActiveOrchProfilesPerOwnerV2,
|
|
13
|
+
setMaxPendingOrchTasksPerProfileV2,
|
|
14
|
+
getMaxPendingOrchTasksPerProfileV2,
|
|
15
|
+
setOrchProfileIdleMsV2,
|
|
16
|
+
getOrchProfileIdleMsV2,
|
|
17
|
+
setOrchTaskStuckMsV2,
|
|
18
|
+
getOrchTaskStuckMsV2,
|
|
19
|
+
registerOrchProfileV2,
|
|
20
|
+
activateOrchProfileV2,
|
|
21
|
+
pauseOrchProfileV2,
|
|
22
|
+
retireOrchProfileV2,
|
|
23
|
+
touchOrchProfileV2,
|
|
24
|
+
getOrchProfileV2,
|
|
25
|
+
listOrchProfilesV2,
|
|
26
|
+
createOrchTaskV2,
|
|
27
|
+
dispatchOrchTaskV2,
|
|
28
|
+
completeOrchTaskV2,
|
|
29
|
+
failOrchTaskV2,
|
|
30
|
+
cancelOrchTaskV2,
|
|
31
|
+
getOrchTaskV2,
|
|
32
|
+
listOrchTasksV2,
|
|
33
|
+
autoPauseIdleOrchProfilesV2,
|
|
34
|
+
autoFailStuckOrchTasksV2,
|
|
35
|
+
getOrchestratorGovStatsV2,
|
|
36
|
+
_resetStateOrchestratorV2,
|
|
37
|
+
} from "../lib/orchestrator.js";
|
|
38
|
+
|
|
39
|
+
export function registerOrchGovCommand(program) {
|
|
40
|
+
const og = program
|
|
41
|
+
.command("orchgov")
|
|
42
|
+
.description("Orchestrator V2 governance");
|
|
43
|
+
og.command("enums-v2").action(() =>
|
|
44
|
+
console.log(
|
|
45
|
+
JSON.stringify(
|
|
46
|
+
{
|
|
47
|
+
profileMaturity: ORCH_PROFILE_MATURITY_V2,
|
|
48
|
+
taskLifecycle: ORCH_TASK_LIFECYCLE_V2,
|
|
49
|
+
},
|
|
50
|
+
null,
|
|
51
|
+
2,
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
og.command("config-v2").action(() =>
|
|
56
|
+
console.log(
|
|
57
|
+
JSON.stringify(
|
|
58
|
+
{
|
|
59
|
+
maxActiveOrchProfilesPerOwner: getMaxActiveOrchProfilesPerOwnerV2(),
|
|
60
|
+
maxPendingOrchTasksPerProfile: getMaxPendingOrchTasksPerProfileV2(),
|
|
61
|
+
orchProfileIdleMs: getOrchProfileIdleMsV2(),
|
|
62
|
+
orchTaskStuckMs: getOrchTaskStuckMsV2(),
|
|
63
|
+
},
|
|
64
|
+
null,
|
|
65
|
+
2,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
og.command("set-max-active-v2 <n>").action((n) => {
|
|
70
|
+
setMaxActiveOrchProfilesPerOwnerV2(Number(n));
|
|
71
|
+
console.log("ok");
|
|
72
|
+
});
|
|
73
|
+
og.command("set-max-pending-v2 <n>").action((n) => {
|
|
74
|
+
setMaxPendingOrchTasksPerProfileV2(Number(n));
|
|
75
|
+
console.log("ok");
|
|
76
|
+
});
|
|
77
|
+
og.command("set-idle-ms-v2 <n>").action((n) => {
|
|
78
|
+
setOrchProfileIdleMsV2(Number(n));
|
|
79
|
+
console.log("ok");
|
|
80
|
+
});
|
|
81
|
+
og.command("set-stuck-ms-v2 <n>").action((n) => {
|
|
82
|
+
setOrchTaskStuckMsV2(Number(n));
|
|
83
|
+
console.log("ok");
|
|
84
|
+
});
|
|
85
|
+
og.command("register-profile-v2 <id> <owner>")
|
|
86
|
+
.option("--source <s>", "source")
|
|
87
|
+
.action((id, owner, o) =>
|
|
88
|
+
console.log(
|
|
89
|
+
JSON.stringify(
|
|
90
|
+
registerOrchProfileV2({ id, owner, source: o.source }),
|
|
91
|
+
null,
|
|
92
|
+
2,
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
og.command("activate-profile-v2 <id>").action((id) =>
|
|
97
|
+
console.log(JSON.stringify(activateOrchProfileV2(id), null, 2)),
|
|
98
|
+
);
|
|
99
|
+
og.command("pause-profile-v2 <id>").action((id) =>
|
|
100
|
+
console.log(JSON.stringify(pauseOrchProfileV2(id), null, 2)),
|
|
101
|
+
);
|
|
102
|
+
og.command("retire-profile-v2 <id>").action((id) =>
|
|
103
|
+
console.log(JSON.stringify(retireOrchProfileV2(id), null, 2)),
|
|
104
|
+
);
|
|
105
|
+
og.command("touch-profile-v2 <id>").action((id) =>
|
|
106
|
+
console.log(JSON.stringify(touchOrchProfileV2(id), null, 2)),
|
|
107
|
+
);
|
|
108
|
+
og.command("get-profile-v2 <id>").action((id) =>
|
|
109
|
+
console.log(JSON.stringify(getOrchProfileV2(id), null, 2)),
|
|
110
|
+
);
|
|
111
|
+
og.command("list-profiles-v2").action(() =>
|
|
112
|
+
console.log(JSON.stringify(listOrchProfilesV2(), null, 2)),
|
|
113
|
+
);
|
|
114
|
+
og.command("create-task-v2 <id> <profileId>")
|
|
115
|
+
.option("--prompt <p>", "prompt")
|
|
116
|
+
.action((id, profileId, o) =>
|
|
117
|
+
console.log(
|
|
118
|
+
JSON.stringify(
|
|
119
|
+
createOrchTaskV2({ id, profileId, prompt: o.prompt }),
|
|
120
|
+
null,
|
|
121
|
+
2,
|
|
122
|
+
),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
og.command("dispatch-task-v2 <id>").action((id) =>
|
|
126
|
+
console.log(JSON.stringify(dispatchOrchTaskV2(id), null, 2)),
|
|
127
|
+
);
|
|
128
|
+
og.command("complete-task-v2 <id>").action((id) =>
|
|
129
|
+
console.log(JSON.stringify(completeOrchTaskV2(id), null, 2)),
|
|
130
|
+
);
|
|
131
|
+
og.command("fail-task-v2 <id> [reason]").action((id, reason) =>
|
|
132
|
+
console.log(JSON.stringify(failOrchTaskV2(id, reason), null, 2)),
|
|
133
|
+
);
|
|
134
|
+
og.command("cancel-task-v2 <id> [reason]").action((id, reason) =>
|
|
135
|
+
console.log(JSON.stringify(cancelOrchTaskV2(id, reason), null, 2)),
|
|
136
|
+
);
|
|
137
|
+
og.command("get-task-v2 <id>").action((id) =>
|
|
138
|
+
console.log(JSON.stringify(getOrchTaskV2(id), null, 2)),
|
|
139
|
+
);
|
|
140
|
+
og.command("list-tasks-v2").action(() =>
|
|
141
|
+
console.log(JSON.stringify(listOrchTasksV2(), null, 2)),
|
|
142
|
+
);
|
|
143
|
+
og.command("auto-pause-idle-v2").action(() =>
|
|
144
|
+
console.log(JSON.stringify(autoPauseIdleOrchProfilesV2(), null, 2)),
|
|
145
|
+
);
|
|
146
|
+
og.command("auto-fail-stuck-v2").action(() =>
|
|
147
|
+
console.log(JSON.stringify(autoFailStuckOrchTasksV2(), null, 2)),
|
|
148
|
+
);
|
|
149
|
+
og.command("gov-stats-v2").action(() =>
|
|
150
|
+
console.log(JSON.stringify(getOrchestratorGovStatsV2(), null, 2)),
|
|
151
|
+
);
|
|
152
|
+
og.command("reset-state-v2").action(() => {
|
|
153
|
+
_resetStateOrchestratorV2();
|
|
154
|
+
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDF Parser V2 governance commands — `cc pdfp ...`
|
|
3
|
+
* 在内存中治理 PDFP profile (pending/active/stale/archived) + parse 生命周期。
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
PDFP_PROFILE_MATURITY_V2,
|
|
7
|
+
PDFP_PARSE_LIFECYCLE_V2,
|
|
8
|
+
registerPdfpProfileV2,
|
|
9
|
+
activatePdfpProfileV2,
|
|
10
|
+
stalePdfpProfileV2,
|
|
11
|
+
archivePdfpProfileV2,
|
|
12
|
+
touchPdfpProfileV2,
|
|
13
|
+
getPdfpProfileV2,
|
|
14
|
+
listPdfpProfilesV2,
|
|
15
|
+
createPdfpParseV2,
|
|
16
|
+
parsingPdfpParseV2,
|
|
17
|
+
parsePdfpParseV2,
|
|
18
|
+
failPdfpParseV2,
|
|
19
|
+
cancelPdfpParseV2,
|
|
20
|
+
getPdfpParseV2,
|
|
21
|
+
listPdfpParsesV2,
|
|
22
|
+
setMaxActivePdfpProfilesPerOwnerV2,
|
|
23
|
+
getMaxActivePdfpProfilesPerOwnerV2,
|
|
24
|
+
setMaxPendingPdfpParsesPerProfileV2,
|
|
25
|
+
getMaxPendingPdfpParsesPerProfileV2,
|
|
26
|
+
setPdfpProfileIdleMsV2,
|
|
27
|
+
getPdfpProfileIdleMsV2,
|
|
28
|
+
setPdfpParseStuckMsV2,
|
|
29
|
+
getPdfpParseStuckMsV2,
|
|
30
|
+
autoStaleIdlePdfpProfilesV2,
|
|
31
|
+
autoFailStuckPdfpParsesV2,
|
|
32
|
+
getPdfParserGovStatsV2,
|
|
33
|
+
} from "../lib/pdf-parser.js";
|
|
34
|
+
|
|
35
|
+
export function registerPdfpCommand(program) {
|
|
36
|
+
const p = program
|
|
37
|
+
.command("pdfp")
|
|
38
|
+
.description("PDF Parser V2 governance (in-memory, CLI v0.143.0)");
|
|
39
|
+
|
|
40
|
+
p.command("enums-v2").action(() =>
|
|
41
|
+
console.log(
|
|
42
|
+
JSON.stringify(
|
|
43
|
+
{ PDFP_PROFILE_MATURITY_V2, PDFP_PARSE_LIFECYCLE_V2 },
|
|
44
|
+
null,
|
|
45
|
+
2,
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
p.command("register-profile-v2")
|
|
50
|
+
.requiredOption("--id <id>")
|
|
51
|
+
.requiredOption("--owner <owner>")
|
|
52
|
+
.option("--encoding <encoding>", "encoding", "utf-8")
|
|
53
|
+
.action((o) =>
|
|
54
|
+
console.log(JSON.stringify(registerPdfpProfileV2(o), null, 2)),
|
|
55
|
+
);
|
|
56
|
+
p.command("activate-profile-v2 <id>").action((id) =>
|
|
57
|
+
console.log(JSON.stringify(activatePdfpProfileV2(id), null, 2)),
|
|
58
|
+
);
|
|
59
|
+
p.command("stale-profile-v2 <id>").action((id) =>
|
|
60
|
+
console.log(JSON.stringify(stalePdfpProfileV2(id), null, 2)),
|
|
61
|
+
);
|
|
62
|
+
p.command("archive-profile-v2 <id>").action((id) =>
|
|
63
|
+
console.log(JSON.stringify(archivePdfpProfileV2(id), null, 2)),
|
|
64
|
+
);
|
|
65
|
+
p.command("touch-profile-v2 <id>").action((id) =>
|
|
66
|
+
console.log(JSON.stringify(touchPdfpProfileV2(id), null, 2)),
|
|
67
|
+
);
|
|
68
|
+
p.command("get-profile-v2 <id>").action((id) =>
|
|
69
|
+
console.log(JSON.stringify(getPdfpProfileV2(id), null, 2)),
|
|
70
|
+
);
|
|
71
|
+
p.command("list-profiles-v2").action(() =>
|
|
72
|
+
console.log(JSON.stringify(listPdfpProfilesV2(), null, 2)),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
p.command("create-parse-v2")
|
|
76
|
+
.requiredOption("--id <id>")
|
|
77
|
+
.requiredOption("--profile-id <profileId>")
|
|
78
|
+
.option("--path <path>", "pdf path", "")
|
|
79
|
+
.action((o) => console.log(JSON.stringify(createPdfpParseV2(o), null, 2)));
|
|
80
|
+
p.command("parsing-parse-v2 <id>").action((id) =>
|
|
81
|
+
console.log(JSON.stringify(parsingPdfpParseV2(id), null, 2)),
|
|
82
|
+
);
|
|
83
|
+
p.command("parse-parse-v2 <id>").action((id) =>
|
|
84
|
+
console.log(JSON.stringify(parsePdfpParseV2(id), null, 2)),
|
|
85
|
+
);
|
|
86
|
+
p.command("fail-parse-v2 <id>")
|
|
87
|
+
.option("--reason <r>")
|
|
88
|
+
.action((id, o) =>
|
|
89
|
+
console.log(JSON.stringify(failPdfpParseV2(id, o.reason), null, 2)),
|
|
90
|
+
);
|
|
91
|
+
p.command("cancel-parse-v2 <id>")
|
|
92
|
+
.option("--reason <r>")
|
|
93
|
+
.action((id, o) =>
|
|
94
|
+
console.log(JSON.stringify(cancelPdfpParseV2(id, o.reason), null, 2)),
|
|
95
|
+
);
|
|
96
|
+
p.command("get-parse-v2 <id>").action((id) =>
|
|
97
|
+
console.log(JSON.stringify(getPdfpParseV2(id), null, 2)),
|
|
98
|
+
);
|
|
99
|
+
p.command("list-parses-v2").action(() =>
|
|
100
|
+
console.log(JSON.stringify(listPdfpParsesV2(), null, 2)),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
p.command("config-v2").action(() =>
|
|
104
|
+
console.log(
|
|
105
|
+
JSON.stringify(
|
|
106
|
+
{
|
|
107
|
+
maxActivePdfpProfilesPerOwner: getMaxActivePdfpProfilesPerOwnerV2(),
|
|
108
|
+
maxPendingPdfpParsesPerProfile: getMaxPendingPdfpParsesPerProfileV2(),
|
|
109
|
+
pdfpProfileIdleMs: getPdfpProfileIdleMsV2(),
|
|
110
|
+
pdfpParseStuckMs: getPdfpParseStuckMsV2(),
|
|
111
|
+
},
|
|
112
|
+
null,
|
|
113
|
+
2,
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
);
|
|
117
|
+
p.command("set-max-active-profiles-v2 <n>").action((n) => {
|
|
118
|
+
setMaxActivePdfpProfilesPerOwnerV2(Number(n));
|
|
119
|
+
console.log(
|
|
120
|
+
JSON.stringify(
|
|
121
|
+
{ maxActivePdfpProfilesPerOwner: getMaxActivePdfpProfilesPerOwnerV2() },
|
|
122
|
+
null,
|
|
123
|
+
2,
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
p.command("set-max-pending-parses-v2 <n>").action((n) => {
|
|
128
|
+
setMaxPendingPdfpParsesPerProfileV2(Number(n));
|
|
129
|
+
console.log(
|
|
130
|
+
JSON.stringify(
|
|
131
|
+
{
|
|
132
|
+
maxPendingPdfpParsesPerProfile: getMaxPendingPdfpParsesPerProfileV2(),
|
|
133
|
+
},
|
|
134
|
+
null,
|
|
135
|
+
2,
|
|
136
|
+
),
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
p.command("set-profile-idle-ms-v2 <ms>").action((ms) => {
|
|
140
|
+
setPdfpProfileIdleMsV2(Number(ms));
|
|
141
|
+
console.log(
|
|
142
|
+
JSON.stringify({ pdfpProfileIdleMs: getPdfpProfileIdleMsV2() }, null, 2),
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
p.command("set-parse-stuck-ms-v2 <ms>").action((ms) => {
|
|
146
|
+
setPdfpParseStuckMsV2(Number(ms));
|
|
147
|
+
console.log(
|
|
148
|
+
JSON.stringify({ pdfpParseStuckMs: getPdfpParseStuckMsV2() }, null, 2),
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
p.command("auto-stale-idle-v2").action(() =>
|
|
152
|
+
console.log(JSON.stringify(autoStaleIdlePdfpProfilesV2(), null, 2)),
|
|
153
|
+
);
|
|
154
|
+
p.command("auto-fail-stuck-v2").action(() =>
|
|
155
|
+
console.log(JSON.stringify(autoFailStuckPdfpParsesV2(), null, 2)),
|
|
156
|
+
);
|
|
157
|
+
p.command("gov-stats-v2").action(() =>
|
|
158
|
+
console.log(JSON.stringify(getPdfParserGovStatsV2(), null, 2)),
|
|
159
|
+
);
|
|
160
|
+
}
|
package/src/commands/perf.js
CHANGED
|
@@ -429,5 +429,181 @@ export function registerPerfCommand(program) {
|
|
|
429
429
|
console.log(`Recent history: ${r.recentHistory.length}`);
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
+
_registerPerfV2(perf);
|
|
432
433
|
program.addCommand(perf);
|
|
433
434
|
}
|
|
435
|
+
|
|
436
|
+
import {
|
|
437
|
+
PERF_TUNING_PROFILE_MATURITY_V2,
|
|
438
|
+
PERF_BENCH_LIFECYCLE_V2,
|
|
439
|
+
setMaxActivePerfTuningProfilesPerOwnerV2,
|
|
440
|
+
getMaxActivePerfTuningProfilesPerOwnerV2,
|
|
441
|
+
setMaxPendingPerfBenchesPerProfileV2,
|
|
442
|
+
getMaxPendingPerfBenchesPerProfileV2,
|
|
443
|
+
setPerfTuningProfileIdleMsV2,
|
|
444
|
+
getPerfTuningProfileIdleMsV2,
|
|
445
|
+
setPerfBenchStuckMsV2,
|
|
446
|
+
getPerfBenchStuckMsV2,
|
|
447
|
+
registerPerfTuningProfileV2,
|
|
448
|
+
activatePerfTuningProfileV2,
|
|
449
|
+
stalePerfTuningProfileV2,
|
|
450
|
+
decommissionPerfTuningProfileV2,
|
|
451
|
+
touchPerfTuningProfileV2,
|
|
452
|
+
getPerfTuningProfileV2,
|
|
453
|
+
listPerfTuningProfilesV2,
|
|
454
|
+
createPerfBenchV2,
|
|
455
|
+
startPerfBenchV2,
|
|
456
|
+
completePerfBenchV2,
|
|
457
|
+
failPerfBenchV2,
|
|
458
|
+
cancelPerfBenchV2,
|
|
459
|
+
getPerfBenchV2,
|
|
460
|
+
listPerfBenchesV2,
|
|
461
|
+
autoStaleIdlePerfTuningProfilesV2,
|
|
462
|
+
autoFailStuckPerfBenchesV2,
|
|
463
|
+
getPerfTuningGovStatsV2,
|
|
464
|
+
_resetStatePerfTuningV2,
|
|
465
|
+
} from "../lib/perf-tuning.js";
|
|
466
|
+
|
|
467
|
+
function _registerPerfV2(parent) {
|
|
468
|
+
parent.command("enums-v2").action(() =>
|
|
469
|
+
console.log(
|
|
470
|
+
JSON.stringify(
|
|
471
|
+
{
|
|
472
|
+
profileMaturity: PERF_TUNING_PROFILE_MATURITY_V2,
|
|
473
|
+
benchLifecycle: PERF_BENCH_LIFECYCLE_V2,
|
|
474
|
+
},
|
|
475
|
+
null,
|
|
476
|
+
2,
|
|
477
|
+
),
|
|
478
|
+
),
|
|
479
|
+
);
|
|
480
|
+
parent.command("config-v2").action(() =>
|
|
481
|
+
console.log(
|
|
482
|
+
JSON.stringify(
|
|
483
|
+
{
|
|
484
|
+
maxActivePerfTuningProfilesPerOwner:
|
|
485
|
+
getMaxActivePerfTuningProfilesPerOwnerV2(),
|
|
486
|
+
maxPendingPerfBenchesPerProfile:
|
|
487
|
+
getMaxPendingPerfBenchesPerProfileV2(),
|
|
488
|
+
perfTuningProfileIdleMs: getPerfTuningProfileIdleMsV2(),
|
|
489
|
+
perfBenchStuckMs: getPerfBenchStuckMsV2(),
|
|
490
|
+
},
|
|
491
|
+
null,
|
|
492
|
+
2,
|
|
493
|
+
),
|
|
494
|
+
),
|
|
495
|
+
);
|
|
496
|
+
parent.command("set-max-active-v2 <n>").action((n) => {
|
|
497
|
+
setMaxActivePerfTuningProfilesPerOwnerV2(Number(n));
|
|
498
|
+
console.log("ok");
|
|
499
|
+
});
|
|
500
|
+
parent.command("set-max-pending-v2 <n>").action((n) => {
|
|
501
|
+
setMaxPendingPerfBenchesPerProfileV2(Number(n));
|
|
502
|
+
console.log("ok");
|
|
503
|
+
});
|
|
504
|
+
parent.command("set-idle-ms-v2 <n>").action((n) => {
|
|
505
|
+
setPerfTuningProfileIdleMsV2(Number(n));
|
|
506
|
+
console.log("ok");
|
|
507
|
+
});
|
|
508
|
+
parent.command("set-stuck-ms-v2 <n>").action((n) => {
|
|
509
|
+
setPerfBenchStuckMsV2(Number(n));
|
|
510
|
+
console.log("ok");
|
|
511
|
+
});
|
|
512
|
+
parent
|
|
513
|
+
.command("register-profile-v2 <id> <owner>")
|
|
514
|
+
.option("--target <t>", "target")
|
|
515
|
+
.action((id, owner, o) =>
|
|
516
|
+
console.log(
|
|
517
|
+
JSON.stringify(
|
|
518
|
+
registerPerfTuningProfileV2({ id, owner, target: o.target }),
|
|
519
|
+
null,
|
|
520
|
+
2,
|
|
521
|
+
),
|
|
522
|
+
),
|
|
523
|
+
);
|
|
524
|
+
parent
|
|
525
|
+
.command("activate-profile-v2 <id>")
|
|
526
|
+
.action((id) =>
|
|
527
|
+
console.log(JSON.stringify(activatePerfTuningProfileV2(id), null, 2)),
|
|
528
|
+
);
|
|
529
|
+
parent
|
|
530
|
+
.command("stale-profile-v2 <id>")
|
|
531
|
+
.action((id) =>
|
|
532
|
+
console.log(JSON.stringify(stalePerfTuningProfileV2(id), null, 2)),
|
|
533
|
+
);
|
|
534
|
+
parent
|
|
535
|
+
.command("decommission-profile-v2 <id>")
|
|
536
|
+
.action((id) =>
|
|
537
|
+
console.log(JSON.stringify(decommissionPerfTuningProfileV2(id), null, 2)),
|
|
538
|
+
);
|
|
539
|
+
parent
|
|
540
|
+
.command("touch-profile-v2 <id>")
|
|
541
|
+
.action((id) =>
|
|
542
|
+
console.log(JSON.stringify(touchPerfTuningProfileV2(id), null, 2)),
|
|
543
|
+
);
|
|
544
|
+
parent
|
|
545
|
+
.command("get-profile-v2 <id>")
|
|
546
|
+
.action((id) =>
|
|
547
|
+
console.log(JSON.stringify(getPerfTuningProfileV2(id), null, 2)),
|
|
548
|
+
);
|
|
549
|
+
parent
|
|
550
|
+
.command("list-profiles-v2")
|
|
551
|
+
.action(() =>
|
|
552
|
+
console.log(JSON.stringify(listPerfTuningProfilesV2(), null, 2)),
|
|
553
|
+
);
|
|
554
|
+
parent
|
|
555
|
+
.command("create-bench-v2 <id> <profileId>")
|
|
556
|
+
.option("--scenario <s>", "scenario")
|
|
557
|
+
.action((id, profileId, o) =>
|
|
558
|
+
console.log(
|
|
559
|
+
JSON.stringify(
|
|
560
|
+
createPerfBenchV2({ id, profileId, scenario: o.scenario }),
|
|
561
|
+
null,
|
|
562
|
+
2,
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
);
|
|
566
|
+
parent
|
|
567
|
+
.command("start-bench-v2 <id>")
|
|
568
|
+
.action((id) => console.log(JSON.stringify(startPerfBenchV2(id), null, 2)));
|
|
569
|
+
parent
|
|
570
|
+
.command("complete-bench-v2 <id>")
|
|
571
|
+
.action((id) =>
|
|
572
|
+
console.log(JSON.stringify(completePerfBenchV2(id), null, 2)),
|
|
573
|
+
);
|
|
574
|
+
parent
|
|
575
|
+
.command("fail-bench-v2 <id> [reason]")
|
|
576
|
+
.action((id, reason) =>
|
|
577
|
+
console.log(JSON.stringify(failPerfBenchV2(id, reason), null, 2)),
|
|
578
|
+
);
|
|
579
|
+
parent
|
|
580
|
+
.command("cancel-bench-v2 <id> [reason]")
|
|
581
|
+
.action((id, reason) =>
|
|
582
|
+
console.log(JSON.stringify(cancelPerfBenchV2(id, reason), null, 2)),
|
|
583
|
+
);
|
|
584
|
+
parent
|
|
585
|
+
.command("get-bench-v2 <id>")
|
|
586
|
+
.action((id) => console.log(JSON.stringify(getPerfBenchV2(id), null, 2)));
|
|
587
|
+
parent
|
|
588
|
+
.command("list-benches-v2")
|
|
589
|
+
.action(() => console.log(JSON.stringify(listPerfBenchesV2(), null, 2)));
|
|
590
|
+
parent
|
|
591
|
+
.command("auto-stale-idle-v2")
|
|
592
|
+
.action(() =>
|
|
593
|
+
console.log(JSON.stringify(autoStaleIdlePerfTuningProfilesV2(), null, 2)),
|
|
594
|
+
);
|
|
595
|
+
parent
|
|
596
|
+
.command("auto-fail-stuck-v2")
|
|
597
|
+
.action(() =>
|
|
598
|
+
console.log(JSON.stringify(autoFailStuckPerfBenchesV2(), null, 2)),
|
|
599
|
+
);
|
|
600
|
+
parent
|
|
601
|
+
.command("gov-stats-v2")
|
|
602
|
+
.action(() =>
|
|
603
|
+
console.log(JSON.stringify(getPerfTuningGovStatsV2(), null, 2)),
|
|
604
|
+
);
|
|
605
|
+
parent.command("reset-state-v2").action(() => {
|
|
606
|
+
_resetStatePerfTuningV2();
|
|
607
|
+
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
608
|
+
});
|
|
609
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc perm` — Permission Engine V2 governance overlay.
|
|
3
|
+
*
|
|
4
|
+
* In-memory governance for permission rules + check lifecycle, layered atop
|
|
5
|
+
* `lib/permission-engine.js`. Independent of legacy permission helpers.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
PERM_RULE_MATURITY_V2,
|
|
10
|
+
PERM_CHECK_LIFECYCLE_V2,
|
|
11
|
+
setMaxActivePermRulesPerOwnerV2,
|
|
12
|
+
getMaxActivePermRulesPerOwnerV2,
|
|
13
|
+
setMaxPendingPermChecksPerRuleV2,
|
|
14
|
+
getMaxPendingPermChecksPerRuleV2,
|
|
15
|
+
setPermRuleIdleMsV2,
|
|
16
|
+
getPermRuleIdleMsV2,
|
|
17
|
+
setPermCheckStuckMsV2,
|
|
18
|
+
getPermCheckStuckMsV2,
|
|
19
|
+
registerPermRuleV2,
|
|
20
|
+
activatePermRuleV2,
|
|
21
|
+
disablePermRuleV2,
|
|
22
|
+
retirePermRuleV2,
|
|
23
|
+
touchPermRuleV2,
|
|
24
|
+
getPermRuleV2,
|
|
25
|
+
listPermRulesV2,
|
|
26
|
+
createPermCheckV2,
|
|
27
|
+
evaluatePermCheckV2,
|
|
28
|
+
allowPermCheckV2,
|
|
29
|
+
denyPermCheckV2,
|
|
30
|
+
cancelPermCheckV2,
|
|
31
|
+
getPermCheckV2,
|
|
32
|
+
listPermChecksV2,
|
|
33
|
+
autoDisableIdlePermRulesV2,
|
|
34
|
+
autoDenyStuckPermChecksV2,
|
|
35
|
+
getPermissionEngineGovStatsV2,
|
|
36
|
+
_resetStatePermissionEngineV2,
|
|
37
|
+
} from "../lib/permission-engine.js";
|
|
38
|
+
|
|
39
|
+
export function registerPermCommand(program) {
|
|
40
|
+
const pe = program
|
|
41
|
+
.command("perm")
|
|
42
|
+
.description("Permission Engine V2 governance");
|
|
43
|
+
pe.command("enums-v2").action(() =>
|
|
44
|
+
console.log(
|
|
45
|
+
JSON.stringify(
|
|
46
|
+
{
|
|
47
|
+
ruleMaturity: PERM_RULE_MATURITY_V2,
|
|
48
|
+
checkLifecycle: PERM_CHECK_LIFECYCLE_V2,
|
|
49
|
+
},
|
|
50
|
+
null,
|
|
51
|
+
2,
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
pe.command("config-v2").action(() =>
|
|
56
|
+
console.log(
|
|
57
|
+
JSON.stringify(
|
|
58
|
+
{
|
|
59
|
+
maxActivePermRulesPerOwner: getMaxActivePermRulesPerOwnerV2(),
|
|
60
|
+
maxPendingPermChecksPerRule: getMaxPendingPermChecksPerRuleV2(),
|
|
61
|
+
permRuleIdleMs: getPermRuleIdleMsV2(),
|
|
62
|
+
permCheckStuckMs: getPermCheckStuckMsV2(),
|
|
63
|
+
},
|
|
64
|
+
null,
|
|
65
|
+
2,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
pe.command("set-max-active-v2 <n>").action((n) => {
|
|
70
|
+
setMaxActivePermRulesPerOwnerV2(Number(n));
|
|
71
|
+
console.log("ok");
|
|
72
|
+
});
|
|
73
|
+
pe.command("set-max-pending-v2 <n>").action((n) => {
|
|
74
|
+
setMaxPendingPermChecksPerRuleV2(Number(n));
|
|
75
|
+
console.log("ok");
|
|
76
|
+
});
|
|
77
|
+
pe.command("set-idle-ms-v2 <n>").action((n) => {
|
|
78
|
+
setPermRuleIdleMsV2(Number(n));
|
|
79
|
+
console.log("ok");
|
|
80
|
+
});
|
|
81
|
+
pe.command("set-stuck-ms-v2 <n>").action((n) => {
|
|
82
|
+
setPermCheckStuckMsV2(Number(n));
|
|
83
|
+
console.log("ok");
|
|
84
|
+
});
|
|
85
|
+
pe.command("register-rule-v2 <id> <owner>")
|
|
86
|
+
.option("--scope <s>", "scope")
|
|
87
|
+
.action((id, owner, o) =>
|
|
88
|
+
console.log(
|
|
89
|
+
JSON.stringify(
|
|
90
|
+
registerPermRuleV2({ id, owner, scope: o.scope }),
|
|
91
|
+
null,
|
|
92
|
+
2,
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
pe.command("activate-rule-v2 <id>").action((id) =>
|
|
97
|
+
console.log(JSON.stringify(activatePermRuleV2(id), null, 2)),
|
|
98
|
+
);
|
|
99
|
+
pe.command("disable-rule-v2 <id>").action((id) =>
|
|
100
|
+
console.log(JSON.stringify(disablePermRuleV2(id), null, 2)),
|
|
101
|
+
);
|
|
102
|
+
pe.command("retire-rule-v2 <id>").action((id) =>
|
|
103
|
+
console.log(JSON.stringify(retirePermRuleV2(id), null, 2)),
|
|
104
|
+
);
|
|
105
|
+
pe.command("touch-rule-v2 <id>").action((id) =>
|
|
106
|
+
console.log(JSON.stringify(touchPermRuleV2(id), null, 2)),
|
|
107
|
+
);
|
|
108
|
+
pe.command("get-rule-v2 <id>").action((id) =>
|
|
109
|
+
console.log(JSON.stringify(getPermRuleV2(id), null, 2)),
|
|
110
|
+
);
|
|
111
|
+
pe.command("list-rules-v2").action(() =>
|
|
112
|
+
console.log(JSON.stringify(listPermRulesV2(), null, 2)),
|
|
113
|
+
);
|
|
114
|
+
pe.command("create-check-v2 <id> <ruleId>")
|
|
115
|
+
.option("--subject <s>", "subject")
|
|
116
|
+
.action((id, ruleId, o) =>
|
|
117
|
+
console.log(
|
|
118
|
+
JSON.stringify(
|
|
119
|
+
createPermCheckV2({ id, ruleId, subject: o.subject }),
|
|
120
|
+
null,
|
|
121
|
+
2,
|
|
122
|
+
),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
pe.command("evaluate-check-v2 <id>").action((id) =>
|
|
126
|
+
console.log(JSON.stringify(evaluatePermCheckV2(id), null, 2)),
|
|
127
|
+
);
|
|
128
|
+
pe.command("allow-check-v2 <id>").action((id) =>
|
|
129
|
+
console.log(JSON.stringify(allowPermCheckV2(id), null, 2)),
|
|
130
|
+
);
|
|
131
|
+
pe.command("deny-check-v2 <id> [reason]").action((id, reason) =>
|
|
132
|
+
console.log(JSON.stringify(denyPermCheckV2(id, reason), null, 2)),
|
|
133
|
+
);
|
|
134
|
+
pe.command("cancel-check-v2 <id> [reason]").action((id, reason) =>
|
|
135
|
+
console.log(JSON.stringify(cancelPermCheckV2(id, reason), null, 2)),
|
|
136
|
+
);
|
|
137
|
+
pe.command("get-check-v2 <id>").action((id) =>
|
|
138
|
+
console.log(JSON.stringify(getPermCheckV2(id), null, 2)),
|
|
139
|
+
);
|
|
140
|
+
pe.command("list-checks-v2").action(() =>
|
|
141
|
+
console.log(JSON.stringify(listPermChecksV2(), null, 2)),
|
|
142
|
+
);
|
|
143
|
+
pe.command("auto-disable-idle-v2").action(() =>
|
|
144
|
+
console.log(JSON.stringify(autoDisableIdlePermRulesV2(), null, 2)),
|
|
145
|
+
);
|
|
146
|
+
pe.command("auto-deny-stuck-v2").action(() =>
|
|
147
|
+
console.log(JSON.stringify(autoDenyStuckPermChecksV2(), null, 2)),
|
|
148
|
+
);
|
|
149
|
+
pe.command("gov-stats-v2").action(() =>
|
|
150
|
+
console.log(JSON.stringify(getPermissionEngineGovStatsV2(), null, 2)),
|
|
151
|
+
);
|
|
152
|
+
pe.command("reset-state-v2").action(() => {
|
|
153
|
+
_resetStatePermissionEngineV2();
|
|
154
|
+
console.log(JSON.stringify({ ok: true }, null, 2));
|
|
155
|
+
});
|
|
156
|
+
}
|