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
package/src/commands/import.js
CHANGED
|
@@ -13,6 +13,37 @@ import {
|
|
|
13
13
|
importMarkdownDir,
|
|
14
14
|
importEnexFile,
|
|
15
15
|
importNotionDir,
|
|
16
|
+
SOURCE_MATURITY_V2,
|
|
17
|
+
IMPORT_JOB_LIFECYCLE_V2,
|
|
18
|
+
getMaxActiveSourcesPerOwnerV2,
|
|
19
|
+
setMaxActiveSourcesPerOwnerV2,
|
|
20
|
+
getMaxPendingJobsPerSourceV2,
|
|
21
|
+
setMaxPendingJobsPerSourceV2,
|
|
22
|
+
getSourceIdleMsV2,
|
|
23
|
+
setSourceIdleMsV2,
|
|
24
|
+
getJobStuckMsV2,
|
|
25
|
+
setJobStuckMsV2,
|
|
26
|
+
registerSourceV2,
|
|
27
|
+
getSourceV2,
|
|
28
|
+
listSourcesV2,
|
|
29
|
+
setSourceStatusV2,
|
|
30
|
+
activateSourceV2,
|
|
31
|
+
pauseSourceV2,
|
|
32
|
+
archiveSourceV2,
|
|
33
|
+
touchSourceV2,
|
|
34
|
+
getActiveSourceCountV2,
|
|
35
|
+
createImportJobV2,
|
|
36
|
+
getImportJobV2,
|
|
37
|
+
listImportJobsV2,
|
|
38
|
+
setImportJobStatusV2,
|
|
39
|
+
startImportJobV2,
|
|
40
|
+
completeImportJobV2,
|
|
41
|
+
failImportJobV2,
|
|
42
|
+
cancelImportJobV2,
|
|
43
|
+
getPendingJobCountV2,
|
|
44
|
+
autoPauseIdleSourcesV2,
|
|
45
|
+
autoFailStuckImportJobsV2,
|
|
46
|
+
getKnowledgeImporterStatsV2,
|
|
16
47
|
} from "../lib/knowledge-importer.js";
|
|
17
48
|
|
|
18
49
|
export function registerImportCommand(program) {
|
|
@@ -256,4 +287,225 @@ export function registerImportCommand(program) {
|
|
|
256
287
|
process.exit(1);
|
|
257
288
|
}
|
|
258
289
|
});
|
|
290
|
+
|
|
291
|
+
// ─── V2 Governance Layer ──────────────────────────────────────────
|
|
292
|
+
const out = (obj) => console.log(JSON.stringify(obj, null, 2));
|
|
293
|
+
const tryRun = (fn) => {
|
|
294
|
+
try {
|
|
295
|
+
fn();
|
|
296
|
+
} catch (err) {
|
|
297
|
+
logger.error(err.message);
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
imp
|
|
303
|
+
.command("source-maturities-v2")
|
|
304
|
+
.description("List V2 source maturity states")
|
|
305
|
+
.action(() => out(Object.values(SOURCE_MATURITY_V2)));
|
|
306
|
+
|
|
307
|
+
imp
|
|
308
|
+
.command("import-job-lifecycles-v2")
|
|
309
|
+
.description("List V2 import-job lifecycle states")
|
|
310
|
+
.action(() => out(Object.values(IMPORT_JOB_LIFECYCLE_V2)));
|
|
311
|
+
|
|
312
|
+
imp
|
|
313
|
+
.command("stats-v2")
|
|
314
|
+
.description("V2 knowledge-importer stats")
|
|
315
|
+
.action(() => out(getKnowledgeImporterStatsV2()));
|
|
316
|
+
|
|
317
|
+
imp
|
|
318
|
+
.command("get-max-active-sources-v2")
|
|
319
|
+
.description("Get max active sources per owner (V2)")
|
|
320
|
+
.action(() =>
|
|
321
|
+
out({ maxActiveSourcesPerOwner: getMaxActiveSourcesPerOwnerV2() }),
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
imp
|
|
325
|
+
.command("set-max-active-sources-v2 <n>")
|
|
326
|
+
.description("Set max active sources per owner (V2)")
|
|
327
|
+
.action((n) =>
|
|
328
|
+
tryRun(() => {
|
|
329
|
+
setMaxActiveSourcesPerOwnerV2(Number(n));
|
|
330
|
+
out({ maxActiveSourcesPerOwner: getMaxActiveSourcesPerOwnerV2() });
|
|
331
|
+
}),
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
imp
|
|
335
|
+
.command("get-max-pending-jobs-v2")
|
|
336
|
+
.description("Get max pending jobs per source (V2)")
|
|
337
|
+
.action(() =>
|
|
338
|
+
out({ maxPendingJobsPerSource: getMaxPendingJobsPerSourceV2() }),
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
imp
|
|
342
|
+
.command("set-max-pending-jobs-v2 <n>")
|
|
343
|
+
.description("Set max pending jobs per source (V2)")
|
|
344
|
+
.action((n) =>
|
|
345
|
+
tryRun(() => {
|
|
346
|
+
setMaxPendingJobsPerSourceV2(Number(n));
|
|
347
|
+
out({ maxPendingJobsPerSource: getMaxPendingJobsPerSourceV2() });
|
|
348
|
+
}),
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
imp
|
|
352
|
+
.command("get-source-idle-ms-v2")
|
|
353
|
+
.description("Get source idle threshold (V2)")
|
|
354
|
+
.action(() => out({ sourceIdleMs: getSourceIdleMsV2() }));
|
|
355
|
+
|
|
356
|
+
imp
|
|
357
|
+
.command("set-source-idle-ms-v2 <ms>")
|
|
358
|
+
.description("Set source idle threshold (V2)")
|
|
359
|
+
.action((ms) =>
|
|
360
|
+
tryRun(() => {
|
|
361
|
+
setSourceIdleMsV2(Number(ms));
|
|
362
|
+
out({ sourceIdleMs: getSourceIdleMsV2() });
|
|
363
|
+
}),
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
imp
|
|
367
|
+
.command("get-job-stuck-ms-v2")
|
|
368
|
+
.description("Get import-job stuck threshold (V2)")
|
|
369
|
+
.action(() => out({ jobStuckMs: getJobStuckMsV2() }));
|
|
370
|
+
|
|
371
|
+
imp
|
|
372
|
+
.command("set-job-stuck-ms-v2 <ms>")
|
|
373
|
+
.description("Set import-job stuck threshold (V2)")
|
|
374
|
+
.action((ms) =>
|
|
375
|
+
tryRun(() => {
|
|
376
|
+
setJobStuckMsV2(Number(ms));
|
|
377
|
+
out({ jobStuckMs: getJobStuckMsV2() });
|
|
378
|
+
}),
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
imp
|
|
382
|
+
.command("active-source-count-v2 <ownerId>")
|
|
383
|
+
.description("Active source count for owner (V2)")
|
|
384
|
+
.action((ownerId) =>
|
|
385
|
+
out({ ownerId, count: getActiveSourceCountV2(ownerId) }),
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
imp
|
|
389
|
+
.command("pending-job-count-v2 <sourceId>")
|
|
390
|
+
.description("Pending import-job count for source (V2)")
|
|
391
|
+
.action((sourceId) =>
|
|
392
|
+
out({ sourceId, count: getPendingJobCountV2(sourceId) }),
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
imp
|
|
396
|
+
.command("register-source-v2 <id>")
|
|
397
|
+
.description("Register a V2 source manifest")
|
|
398
|
+
.requiredOption("-o, --owner <id>", "owner id")
|
|
399
|
+
.requiredOption("-l, --label <label>", "source label")
|
|
400
|
+
.option("-k, --kind <kind>", "source kind", "markdown")
|
|
401
|
+
.action((id, opts) =>
|
|
402
|
+
tryRun(() =>
|
|
403
|
+
out(
|
|
404
|
+
registerSourceV2(id, {
|
|
405
|
+
ownerId: opts.owner,
|
|
406
|
+
label: opts.label,
|
|
407
|
+
kind: opts.kind,
|
|
408
|
+
}),
|
|
409
|
+
),
|
|
410
|
+
),
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
imp
|
|
414
|
+
.command("get-source-v2 <id>")
|
|
415
|
+
.description("Get a V2 source")
|
|
416
|
+
.action((id) => out(getSourceV2(id)));
|
|
417
|
+
|
|
418
|
+
imp
|
|
419
|
+
.command("list-sources-v2")
|
|
420
|
+
.description("List V2 sources")
|
|
421
|
+
.option("-o, --owner <id>", "filter by owner")
|
|
422
|
+
.option("-s, --status <status>", "filter by status")
|
|
423
|
+
.action((opts) =>
|
|
424
|
+
out(listSourcesV2({ ownerId: opts.owner, status: opts.status })),
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
imp
|
|
428
|
+
.command("set-source-status-v2 <id> <next>")
|
|
429
|
+
.description("Set V2 source status")
|
|
430
|
+
.action((id, next) => tryRun(() => out(setSourceStatusV2(id, next))));
|
|
431
|
+
|
|
432
|
+
imp
|
|
433
|
+
.command("activate-source-v2 <id>")
|
|
434
|
+
.description("Activate a V2 source")
|
|
435
|
+
.action((id) => tryRun(() => out(activateSourceV2(id))));
|
|
436
|
+
|
|
437
|
+
imp
|
|
438
|
+
.command("pause-source-v2 <id>")
|
|
439
|
+
.description("Pause a V2 source")
|
|
440
|
+
.action((id) => tryRun(() => out(pauseSourceV2(id))));
|
|
441
|
+
|
|
442
|
+
imp
|
|
443
|
+
.command("archive-source-v2 <id>")
|
|
444
|
+
.description("Archive a V2 source")
|
|
445
|
+
.action((id) => tryRun(() => out(archiveSourceV2(id))));
|
|
446
|
+
|
|
447
|
+
imp
|
|
448
|
+
.command("touch-source-v2 <id>")
|
|
449
|
+
.description("Touch a V2 source")
|
|
450
|
+
.action((id) => tryRun(() => out(touchSourceV2(id))));
|
|
451
|
+
|
|
452
|
+
imp
|
|
453
|
+
.command("create-import-job-v2 <id>")
|
|
454
|
+
.description("Create a V2 import job")
|
|
455
|
+
.requiredOption("-s, --source <id>", "source id")
|
|
456
|
+
.option("-k, --kind <kind>", "job kind", "scan")
|
|
457
|
+
.action((id, opts) =>
|
|
458
|
+
tryRun(() =>
|
|
459
|
+
out(createImportJobV2(id, { sourceId: opts.source, kind: opts.kind })),
|
|
460
|
+
),
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
imp
|
|
464
|
+
.command("get-import-job-v2 <id>")
|
|
465
|
+
.description("Get a V2 import job")
|
|
466
|
+
.action((id) => out(getImportJobV2(id)));
|
|
467
|
+
|
|
468
|
+
imp
|
|
469
|
+
.command("list-import-jobs-v2")
|
|
470
|
+
.description("List V2 import jobs")
|
|
471
|
+
.option("-s, --source <id>", "filter by source")
|
|
472
|
+
.option("-t, --status <status>", "filter by status")
|
|
473
|
+
.action((opts) =>
|
|
474
|
+
out(listImportJobsV2({ sourceId: opts.source, status: opts.status })),
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
imp
|
|
478
|
+
.command("set-import-job-status-v2 <id> <next>")
|
|
479
|
+
.description("Set V2 import-job status")
|
|
480
|
+
.action((id, next) => tryRun(() => out(setImportJobStatusV2(id, next))));
|
|
481
|
+
|
|
482
|
+
imp
|
|
483
|
+
.command("start-import-job-v2 <id>")
|
|
484
|
+
.description("Start a V2 import job")
|
|
485
|
+
.action((id) => tryRun(() => out(startImportJobV2(id))));
|
|
486
|
+
|
|
487
|
+
imp
|
|
488
|
+
.command("complete-import-job-v2 <id>")
|
|
489
|
+
.description("Complete a V2 import job")
|
|
490
|
+
.action((id) => tryRun(() => out(completeImportJobV2(id))));
|
|
491
|
+
|
|
492
|
+
imp
|
|
493
|
+
.command("fail-import-job-v2 <id>")
|
|
494
|
+
.description("Fail a V2 import job")
|
|
495
|
+
.action((id) => tryRun(() => out(failImportJobV2(id))));
|
|
496
|
+
|
|
497
|
+
imp
|
|
498
|
+
.command("cancel-import-job-v2 <id>")
|
|
499
|
+
.description("Cancel a V2 import job")
|
|
500
|
+
.action((id) => tryRun(() => out(cancelImportJobV2(id))));
|
|
501
|
+
|
|
502
|
+
imp
|
|
503
|
+
.command("auto-pause-idle-sources-v2")
|
|
504
|
+
.description("Auto-pause idle V2 sources")
|
|
505
|
+
.action(() => out(autoPauseIdleSourcesV2()));
|
|
506
|
+
|
|
507
|
+
imp
|
|
508
|
+
.command("auto-fail-stuck-import-jobs-v2")
|
|
509
|
+
.description("Auto-fail stuck V2 import jobs")
|
|
510
|
+
.action(() => out(autoFailStuckImportJobsV2()));
|
|
259
511
|
}
|
|
@@ -20,6 +20,33 @@ import {
|
|
|
20
20
|
rewardContribution,
|
|
21
21
|
getContributions,
|
|
22
22
|
getLeaderboard,
|
|
23
|
+
// V2
|
|
24
|
+
ACCOUNT_STATUS_V2,
|
|
25
|
+
CLAIM_STATUS_V2,
|
|
26
|
+
TOKEN_DEFAULT_MAX_PENDING_CLAIMS_PER_USER,
|
|
27
|
+
TOKEN_DEFAULT_CLAIM_EXPIRY_MS,
|
|
28
|
+
TOKEN_DEFAULT_MAX_CLAIM_AMOUNT,
|
|
29
|
+
setMaxPendingClaimsPerUser,
|
|
30
|
+
setClaimExpiryMs,
|
|
31
|
+
setMaxClaimAmount,
|
|
32
|
+
getMaxPendingClaimsPerUser,
|
|
33
|
+
getClaimExpiryMs,
|
|
34
|
+
getMaxClaimAmount,
|
|
35
|
+
getPendingClaimCount,
|
|
36
|
+
registerAccountV2,
|
|
37
|
+
getAccountStatusV2,
|
|
38
|
+
setAccountStatusV2,
|
|
39
|
+
freezeAccount,
|
|
40
|
+
unfreezeAccount,
|
|
41
|
+
closeAccount,
|
|
42
|
+
submitClaimV2,
|
|
43
|
+
getClaimStatusV2,
|
|
44
|
+
setClaimStatusV2,
|
|
45
|
+
approveClaim,
|
|
46
|
+
rejectClaim,
|
|
47
|
+
payClaim,
|
|
48
|
+
autoExpireUnclaimedClaims,
|
|
49
|
+
getTokenStatsV2,
|
|
23
50
|
} from "../lib/token-incentive.js";
|
|
24
51
|
|
|
25
52
|
function _dbFromCtx(ctx) {
|
|
@@ -370,4 +397,299 @@ export function registerIncentiveCommand(program) {
|
|
|
370
397
|
process.exit(1);
|
|
371
398
|
}
|
|
372
399
|
});
|
|
400
|
+
|
|
401
|
+
// ─────────────────────────────────────────────────────────────
|
|
402
|
+
// Phase 66 V2 — Account + Claim lifecycle
|
|
403
|
+
// ─────────────────────────────────────────────────────────────
|
|
404
|
+
|
|
405
|
+
inc
|
|
406
|
+
.command("account-statuses-v2")
|
|
407
|
+
.description("List V2 account states")
|
|
408
|
+
.action(() => {
|
|
409
|
+
for (const v of Object.values(ACCOUNT_STATUS_V2)) logger.log(v);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
inc
|
|
413
|
+
.command("claim-statuses-v2")
|
|
414
|
+
.description("List V2 claim states")
|
|
415
|
+
.action(() => {
|
|
416
|
+
for (const v of Object.values(CLAIM_STATUS_V2)) logger.log(v);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
inc
|
|
420
|
+
.command("default-max-pending-claims-per-user")
|
|
421
|
+
.description("Show default per-user pending claim cap")
|
|
422
|
+
.action(() =>
|
|
423
|
+
logger.log(String(TOKEN_DEFAULT_MAX_PENDING_CLAIMS_PER_USER)),
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
inc
|
|
427
|
+
.command("max-pending-claims-per-user")
|
|
428
|
+
.description("Show current per-user pending claim cap")
|
|
429
|
+
.action(() => logger.log(String(getMaxPendingClaimsPerUser())));
|
|
430
|
+
|
|
431
|
+
inc
|
|
432
|
+
.command("set-max-pending-claims-per-user <n>")
|
|
433
|
+
.description("Update per-user pending claim cap")
|
|
434
|
+
.action((n) => {
|
|
435
|
+
logger.log(String(setMaxPendingClaimsPerUser(n)));
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
inc
|
|
439
|
+
.command("default-claim-expiry-ms")
|
|
440
|
+
.description("Show default claim expiry (ms)")
|
|
441
|
+
.action(() => logger.log(String(TOKEN_DEFAULT_CLAIM_EXPIRY_MS)));
|
|
442
|
+
|
|
443
|
+
inc
|
|
444
|
+
.command("claim-expiry-ms")
|
|
445
|
+
.description("Show current claim expiry (ms)")
|
|
446
|
+
.action(() => logger.log(String(getClaimExpiryMs())));
|
|
447
|
+
|
|
448
|
+
inc
|
|
449
|
+
.command("set-claim-expiry-ms <ms>")
|
|
450
|
+
.description("Update claim expiry (ms)")
|
|
451
|
+
.action((ms) => {
|
|
452
|
+
logger.log(String(setClaimExpiryMs(ms)));
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
inc
|
|
456
|
+
.command("default-max-claim-amount")
|
|
457
|
+
.description("Show default max claim amount")
|
|
458
|
+
.action(() => logger.log(String(TOKEN_DEFAULT_MAX_CLAIM_AMOUNT)));
|
|
459
|
+
|
|
460
|
+
inc
|
|
461
|
+
.command("max-claim-amount")
|
|
462
|
+
.description("Show current max claim amount")
|
|
463
|
+
.action(() => logger.log(String(getMaxClaimAmount())));
|
|
464
|
+
|
|
465
|
+
inc
|
|
466
|
+
.command("set-max-claim-amount <n>")
|
|
467
|
+
.description("Update max claim amount")
|
|
468
|
+
.action((n) => {
|
|
469
|
+
logger.log(String(setMaxClaimAmount(n)));
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
inc
|
|
473
|
+
.command("pending-claim-count")
|
|
474
|
+
.description("Count PENDING claims (optionally scoped to user)")
|
|
475
|
+
.option("-u, --user <user>", "Scope to user")
|
|
476
|
+
.action((opts) => {
|
|
477
|
+
logger.log(String(getPendingClaimCount(opts.user)));
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
inc
|
|
481
|
+
.command("register-account-v2 <account-id>")
|
|
482
|
+
.description("V2: register a tracked account (tags ACTIVE)")
|
|
483
|
+
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
484
|
+
.action((accountId, opts) => {
|
|
485
|
+
const ctx = bootstrap();
|
|
486
|
+
try {
|
|
487
|
+
const db = _dbFromCtx(ctx);
|
|
488
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : undefined;
|
|
489
|
+
const entry = registerAccountV2(db, { accountId, metadata });
|
|
490
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
491
|
+
} finally {
|
|
492
|
+
shutdown();
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
inc
|
|
497
|
+
.command("account-status-v2 <account-id>")
|
|
498
|
+
.description("V2: show account status")
|
|
499
|
+
.action((accountId) => {
|
|
500
|
+
const entry = getAccountStatusV2(accountId);
|
|
501
|
+
if (!entry) {
|
|
502
|
+
logger.log(chalk.yellow("(not found)"));
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
inc
|
|
509
|
+
.command("set-account-status-v2 <account-id> <status>")
|
|
510
|
+
.description("V2: transition account status (active|frozen|closed)")
|
|
511
|
+
.option("-r, --reason <reason>", "Reason")
|
|
512
|
+
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
513
|
+
.action((accountId, status, opts) => {
|
|
514
|
+
const ctx = bootstrap();
|
|
515
|
+
try {
|
|
516
|
+
const db = _dbFromCtx(ctx);
|
|
517
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : undefined;
|
|
518
|
+
const entry = setAccountStatusV2(db, accountId, status, {
|
|
519
|
+
reason: opts.reason,
|
|
520
|
+
metadata,
|
|
521
|
+
});
|
|
522
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
523
|
+
} finally {
|
|
524
|
+
shutdown();
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
inc
|
|
529
|
+
.command("freeze-account <account-id>")
|
|
530
|
+
.description("V2: shortcut → frozen")
|
|
531
|
+
.option("-r, --reason <reason>", "Reason")
|
|
532
|
+
.action((accountId, opts) => {
|
|
533
|
+
const ctx = bootstrap();
|
|
534
|
+
try {
|
|
535
|
+
const db = _dbFromCtx(ctx);
|
|
536
|
+
const entry = freezeAccount(db, accountId, opts.reason);
|
|
537
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
538
|
+
} finally {
|
|
539
|
+
shutdown();
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
inc
|
|
544
|
+
.command("unfreeze-account <account-id>")
|
|
545
|
+
.description("V2: shortcut → active (from frozen)")
|
|
546
|
+
.option("-r, --reason <reason>", "Reason")
|
|
547
|
+
.action((accountId, opts) => {
|
|
548
|
+
const ctx = bootstrap();
|
|
549
|
+
try {
|
|
550
|
+
const db = _dbFromCtx(ctx);
|
|
551
|
+
const entry = unfreezeAccount(db, accountId, opts.reason);
|
|
552
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
553
|
+
} finally {
|
|
554
|
+
shutdown();
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
inc
|
|
559
|
+
.command("close-account <account-id>")
|
|
560
|
+
.description("V2: shortcut → closed")
|
|
561
|
+
.option("-r, --reason <reason>", "Reason")
|
|
562
|
+
.action((accountId, opts) => {
|
|
563
|
+
const ctx = bootstrap();
|
|
564
|
+
try {
|
|
565
|
+
const db = _dbFromCtx(ctx);
|
|
566
|
+
const entry = closeAccount(db, accountId, opts.reason);
|
|
567
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
568
|
+
} finally {
|
|
569
|
+
shutdown();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
inc
|
|
574
|
+
.command("submit-claim-v2 <claim-id>")
|
|
575
|
+
.description("V2: submit a claim (tags PENDING)")
|
|
576
|
+
.requiredOption("-u, --user <user>", "User ID")
|
|
577
|
+
.requiredOption("-a, --amount <amount>", "Amount")
|
|
578
|
+
.option("-c, --contribution <id>", "Contribution ID")
|
|
579
|
+
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
580
|
+
.action((claimId, opts) => {
|
|
581
|
+
const ctx = bootstrap();
|
|
582
|
+
try {
|
|
583
|
+
const db = _dbFromCtx(ctx);
|
|
584
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : undefined;
|
|
585
|
+
const entry = submitClaimV2(db, {
|
|
586
|
+
claimId,
|
|
587
|
+
userId: opts.user,
|
|
588
|
+
amount: Number(opts.amount),
|
|
589
|
+
contributionId: opts.contribution,
|
|
590
|
+
metadata,
|
|
591
|
+
});
|
|
592
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
593
|
+
} finally {
|
|
594
|
+
shutdown();
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
inc
|
|
599
|
+
.command("claim-status-v2 <claim-id>")
|
|
600
|
+
.description("V2: show claim status")
|
|
601
|
+
.action((claimId) => {
|
|
602
|
+
const entry = getClaimStatusV2(claimId);
|
|
603
|
+
if (!entry) {
|
|
604
|
+
logger.log(chalk.yellow("(not found)"));
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
inc
|
|
611
|
+
.command("set-claim-status-v2 <claim-id> <status>")
|
|
612
|
+
.description("V2: transition claim (pending|approved|paid|rejected)")
|
|
613
|
+
.option("-r, --reason <reason>", "Reason")
|
|
614
|
+
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
615
|
+
.action((claimId, status, opts) => {
|
|
616
|
+
const ctx = bootstrap();
|
|
617
|
+
try {
|
|
618
|
+
const db = _dbFromCtx(ctx);
|
|
619
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : undefined;
|
|
620
|
+
const entry = setClaimStatusV2(db, claimId, status, {
|
|
621
|
+
reason: opts.reason,
|
|
622
|
+
metadata,
|
|
623
|
+
});
|
|
624
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
625
|
+
} finally {
|
|
626
|
+
shutdown();
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
inc
|
|
631
|
+
.command("approve-claim <claim-id>")
|
|
632
|
+
.description("V2: shortcut → approved")
|
|
633
|
+
.option("-r, --reason <reason>", "Reason")
|
|
634
|
+
.action((claimId, opts) => {
|
|
635
|
+
const ctx = bootstrap();
|
|
636
|
+
try {
|
|
637
|
+
const db = _dbFromCtx(ctx);
|
|
638
|
+
const entry = approveClaim(db, claimId, opts.reason);
|
|
639
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
640
|
+
} finally {
|
|
641
|
+
shutdown();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
inc
|
|
646
|
+
.command("reject-claim <claim-id>")
|
|
647
|
+
.description("V2: shortcut → rejected")
|
|
648
|
+
.option("-r, --reason <reason>", "Reason")
|
|
649
|
+
.action((claimId, opts) => {
|
|
650
|
+
const ctx = bootstrap();
|
|
651
|
+
try {
|
|
652
|
+
const db = _dbFromCtx(ctx);
|
|
653
|
+
const entry = rejectClaim(db, claimId, opts.reason);
|
|
654
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
655
|
+
} finally {
|
|
656
|
+
shutdown();
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
inc
|
|
661
|
+
.command("pay-claim <claim-id>")
|
|
662
|
+
.description("V2: shortcut → paid (stamps paidAt)")
|
|
663
|
+
.option("-r, --reason <reason>", "Reason")
|
|
664
|
+
.action((claimId, opts) => {
|
|
665
|
+
const ctx = bootstrap();
|
|
666
|
+
try {
|
|
667
|
+
const db = _dbFromCtx(ctx);
|
|
668
|
+
const entry = payClaim(db, claimId, opts.reason);
|
|
669
|
+
logger.log(JSON.stringify(entry, null, 2));
|
|
670
|
+
} finally {
|
|
671
|
+
shutdown();
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
inc
|
|
676
|
+
.command("auto-expire-unclaimed-claims")
|
|
677
|
+
.description("V2: bulk-reject stale PENDING claims")
|
|
678
|
+
.action(() => {
|
|
679
|
+
const ctx = bootstrap();
|
|
680
|
+
try {
|
|
681
|
+
const db = _dbFromCtx(ctx);
|
|
682
|
+
const expired = autoExpireUnclaimedClaims(db);
|
|
683
|
+
logger.log(`Expired ${expired.length} claim(s)`);
|
|
684
|
+
} finally {
|
|
685
|
+
shutdown();
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
inc
|
|
690
|
+
.command("stats-v2")
|
|
691
|
+
.description("V2: all-enum-key stats snapshot")
|
|
692
|
+
.action(() => {
|
|
693
|
+
logger.log(JSON.stringify(getTokenStatsV2(), null, 2));
|
|
694
|
+
});
|
|
373
695
|
}
|
|
@@ -619,4 +619,46 @@ export function registerInferenceCommand(program) {
|
|
|
619
619
|
});
|
|
620
620
|
|
|
621
621
|
program.addCommand(inf);
|
|
622
|
+
|
|
623
|
+
_registerInferenceGovV2(inf);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
import {
|
|
628
|
+
INFERENCE_NODE_MATURITY_V2, INFERENCE_JOB_LIFECYCLE_V2,
|
|
629
|
+
setMaxActiveInferenceNodesPerOperatorV2, setMaxPendingInferenceJobsPerNodeV2, setInferenceNodeIdleMsV2, setInferenceJobStuckMsV2,
|
|
630
|
+
registerInferenceNodeV2, activateInferenceNodeV2, degradeInferenceNodeV2, decommissionInferenceNodeV2, touchInferenceNodeV2, getInferenceNodeV2, listInferenceNodesV2,
|
|
631
|
+
createInferenceJobV2, startInferenceJobV2, completeInferenceJobV2, failInferenceJobV2, cancelInferenceJobV2, getInferenceJobV2, listInferenceJobsV2,
|
|
632
|
+
autoDegradeIdleInferenceNodesV2, autoFailStuckInferenceJobsV2, getInferenceNetworkGovStatsV2,
|
|
633
|
+
} from "../lib/inference-network.js";
|
|
634
|
+
|
|
635
|
+
function _registerInferenceGovV2(parent) {
|
|
636
|
+
parent.command("enums-v2").description("List Inference Network V2 enums").option("--json", "JSON").action((opts) => {
|
|
637
|
+
const out = { nodeMaturity: INFERENCE_NODE_MATURITY_V2, jobLifecycle: INFERENCE_JOB_LIFECYCLE_V2 };
|
|
638
|
+
if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
|
|
639
|
+
});
|
|
640
|
+
parent.command("config-set-v2").description("Set Inference V2 caps/thresholds").option("--max-active <n>", "max active nodes per operator").option("--max-pending <n>", "max pending jobs per node").option("--idle-ms <n>", "node idle ms").option("--stuck-ms <n>", "job stuck ms").action((opts) => {
|
|
641
|
+
if (opts.maxActive) setMaxActiveInferenceNodesPerOperatorV2(parseInt(opts.maxActive, 10));
|
|
642
|
+
if (opts.maxPending) setMaxPendingInferenceJobsPerNodeV2(parseInt(opts.maxPending, 10));
|
|
643
|
+
if (opts.idleMs) setInferenceNodeIdleMsV2(parseInt(opts.idleMs, 10));
|
|
644
|
+
if (opts.stuckMs) setInferenceJobStuckMsV2(parseInt(opts.stuckMs, 10));
|
|
645
|
+
console.log("ok");
|
|
646
|
+
});
|
|
647
|
+
parent.command("register-node-v2 <id>").description("Register Inference V2 node").requiredOption("--operator <op>", "operator").option("--model <m>", "model").action((id, opts) => { console.log(registerInferenceNodeV2({ id, operator: opts.operator, model: opts.model })); });
|
|
648
|
+
parent.command("activate-node-v2 <id>").description("Activate Inference V2 node").action((id) => { console.log(activateInferenceNodeV2(id)); });
|
|
649
|
+
parent.command("degrade-node-v2 <id>").description("Degrade Inference V2 node").action((id) => { console.log(degradeInferenceNodeV2(id)); });
|
|
650
|
+
parent.command("decommission-node-v2 <id>").description("Decommission Inference V2 node").action((id) => { console.log(decommissionInferenceNodeV2(id)); });
|
|
651
|
+
parent.command("touch-node-v2 <id>").description("Touch Inference V2 node").action((id) => { console.log(touchInferenceNodeV2(id)); });
|
|
652
|
+
parent.command("get-node-v2 <id>").description("Get Inference V2 node").action((id) => { console.log(getInferenceNodeV2(id)); });
|
|
653
|
+
parent.command("list-nodes-v2").description("List Inference V2 nodes").action(() => { console.log(listInferenceNodesV2()); });
|
|
654
|
+
parent.command("create-job-v2 <id>").description("Create Inference V2 job").requiredOption("--node-id <nid>", "node id").option("--prompt <p>", "prompt").action((id, opts) => { console.log(createInferenceJobV2({ id, nodeId: opts.nodeId, prompt: opts.prompt })); });
|
|
655
|
+
parent.command("start-job-v2 <id>").description("Start Inference V2 job").action((id) => { console.log(startInferenceJobV2(id)); });
|
|
656
|
+
parent.command("complete-job-v2 <id>").description("Complete Inference V2 job").action((id) => { console.log(completeInferenceJobV2(id)); });
|
|
657
|
+
parent.command("fail-job-v2 <id>").description("Fail Inference V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(failInferenceJobV2(id, opts.reason)); });
|
|
658
|
+
parent.command("cancel-job-v2 <id>").description("Cancel Inference V2 job").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelInferenceJobV2(id, opts.reason)); });
|
|
659
|
+
parent.command("get-job-v2 <id>").description("Get Inference V2 job").action((id) => { console.log(getInferenceJobV2(id)); });
|
|
660
|
+
parent.command("list-jobs-v2").description("List Inference V2 jobs").action(() => { console.log(listInferenceJobsV2()); });
|
|
661
|
+
parent.command("auto-degrade-nodes-v2").description("Auto-degrade idle Inference V2 nodes").action(() => { console.log(autoDegradeIdleInferenceNodesV2()); });
|
|
662
|
+
parent.command("auto-fail-jobs-v2").description("Auto-fail stuck Inference V2 jobs").action(() => { console.log(autoFailStuckInferenceJobsV2()); });
|
|
663
|
+
parent.command("gov-stats-v2").description("Inference V2 governance stats").option("--json", "JSON").action((opts) => { const s = getInferenceNetworkGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
|
|
622
664
|
}
|