tribunal-kit 9.2.6 → 9.2.7

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.
Files changed (63) hide show
  1. package/.agent/ARCHITECTURE.md +2 -2
  2. package/.agent/history/architecture-intelligence.html +1487 -401
  3. package/.agent/history/architecture-model.json +9365 -5697
  4. package/.agent/history/architecture-verification.json +37 -9
  5. package/.agent/routing_index.json +2069 -3340
  6. package/.agent/rules/GEMINI.md +1 -1
  7. package/.agent/scripts/adaptive_execution.js +511 -0
  8. package/.agent/scripts/architecture_diff.js +303 -260
  9. package/.agent/scripts/architecture_extractor.js +792 -753
  10. package/.agent/scripts/architecture_health.js +293 -256
  11. package/.agent/scripts/architecture_intelligence.js +3100 -0
  12. package/.agent/scripts/architecture_verifier.js +303 -270
  13. package/.agent/scripts/architecture_visualizer.js +880 -873
  14. package/.agent/scripts/blast_radius_engine.js +274 -234
  15. package/.agent/scripts/capability_evolution.js +453 -0
  16. package/.agent/scripts/concept_extractor.js +240 -0
  17. package/.agent/scripts/consideration_engine.js +284 -0
  18. package/.agent/scripts/coverage_engine.js +102 -0
  19. package/.agent/scripts/cross_domain_engine.js +1883 -0
  20. package/.agent/scripts/engineering_memory.js +1313 -0
  21. package/.agent/scripts/integrity_manifest.js +1 -5
  22. package/.agent/scripts/judgment_engine.js +790 -0
  23. package/.agent/scripts/materiality_engine.js +251 -0
  24. package/.agent/scripts/outcome_engine.js +624 -0
  25. package/.agent/scripts/outcome_optimization_engine.js +1632 -0
  26. package/.agent/scripts/simulation_engine.js +1478 -0
  27. package/.agent/scripts/skill_intelligence.js +1371 -0
  28. package/.agent/scripts/validation_engine.js +236 -236
  29. package/.agent/scripts/verification_auditor.js +266 -0
  30. package/.agent/skill-intelligence/taxonomy/engineering-concepts.json +555 -0
  31. package/.agent/skill_topic_map.json +301 -341
  32. package/.agent/skills_inventory.json +4272 -6922
  33. package/.agent/workflows/arch.md +96 -80
  34. package/.agent/workflows/skill-intelligence.md +216 -0
  35. package/CONTRIBUTING.md +2 -2
  36. package/README.md +24 -24
  37. package/bin/adapter-install.js +1 -1
  38. package/package.json +8 -9
  39. package/plugins/core-plugin.json +1 -1
  40. package/plugins/gemini/extension.json +1 -1
  41. package/src/browser/index.js +2 -1
  42. package/src/browser/launcher.js +41 -1
  43. package/src/cli.js +3 -1
  44. package/src/commands/arch.js +261 -172
  45. package/src/commands/context.js +27 -8
  46. package/src/commands/learn.js +21 -6
  47. package/src/commands/memory.js +10 -1
  48. package/src/commands/native.js +12 -3
  49. package/src/commands/skill-intelligence.js +1165 -0
  50. package/src/commands/system1.js +105 -4
  51. package/src/context/ranker.js +337 -339
  52. package/src/evolution/engine.js +296 -295
  53. package/src/synthesis/claim_check_separator.js +294 -271
  54. package/src/system1/browser_intelligence.js +300 -0
  55. package/src/system1/constants.js +49 -0
  56. package/src/system1/decision_engine.js +498 -0
  57. package/src/system1/evidence_engine.js +602 -0
  58. package/src/system1/evolution_pipeline.js +581 -0
  59. package/src/system1/index.d.ts +114 -0
  60. package/src/system1/index.js +102 -0
  61. package/src/system1/reviewer_orchestrator.js +477 -0
  62. package/src/tui/banner.js +1 -1
  63. package/src/utils/fs.js +27 -0
@@ -4,7 +4,23 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const crypto = require('crypto');
6
6
  const child_process = require('child_process');
7
+ const readline = require('readline');
7
8
  const { log, err, dim, c, bold } = require('../utils/logger');
9
+
10
+ function promptConfirm(question) {
11
+ if (process.env.NODE_ENV === 'test') return Promise.resolve(true);
12
+ return new Promise(resolve => {
13
+ const rl = readline.createInterface({
14
+ input: process.stdin,
15
+ output: process.stdout,
16
+ });
17
+ rl.question(question, answer => {
18
+ rl.close();
19
+ const lower = answer.trim().toLowerCase();
20
+ resolve(lower === 'y' || lower === 'yes');
21
+ });
22
+ });
23
+ }
8
24
  const { getLayaDir, getConfigPath } = require('../system1/provider');
9
25
 
10
26
  function verifyChecksum(filePath, expectedHash) {
@@ -40,6 +56,35 @@ async function cmdSystem1Enable(quiet) {
40
56
  const configPath = getConfigPath();
41
57
  const modelsDir = path.join(layaDir, 'models');
42
58
 
59
+ let currentConfig = null;
60
+ if (fs.existsSync(configPath)) {
61
+ try {
62
+ currentConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
63
+ } catch {}
64
+ }
65
+
66
+ const isInstalled = fs.existsSync(layaDir) && fs.existsSync(path.join(modelsDir, 'laya.onnx'));
67
+ const currentLaya = isInstalled ? currentConfig?.laya_version || 'Unknown' : 'None';
68
+ const currentOnnx = isInstalled ? currentConfig?.onnxruntime_version || 'Unknown' : 'None';
69
+ const currentModel = isInstalled ? currentConfig?.model_version || 'Unknown' : 'None';
70
+
71
+ const targetLaya = RECEPTRON_LAYA_VERSION;
72
+ const targetOnnx = ONNXRUNTIME_NODE_VERSION;
73
+ const targetModel = 'v1.0.0';
74
+
75
+ let action = null;
76
+ if (!isInstalled) {
77
+ action = 'newly installed';
78
+ } else if (
79
+ currentLaya !== targetLaya ||
80
+ currentOnnx !== targetOnnx ||
81
+ currentModel !== targetModel
82
+ ) {
83
+ action = 'updated (version change)';
84
+ } else {
85
+ action = 'reinstalled / verified';
86
+ }
87
+
43
88
  if (!quiet) {
44
89
  log(`\n ${c('cyan', '⚡')} ${bold('Tribunal Kit Laya System-1 Initialization')}`);
45
90
  dim(' --------------------------------------------------');
@@ -50,6 +95,21 @@ async function cmdSystem1Enable(quiet) {
50
95
  log('');
51
96
  }
52
97
 
98
+ if (!process.env.TK_MOCK_LAYA_DOWNLOAD) {
99
+ log(` Action: System-1 will be ${action}.`);
100
+ log(` Current - Laya: ${currentLaya}, ONNX: ${currentOnnx}, Model: ${currentModel}`);
101
+ log(` Target - Laya: ${targetLaya}, ONNX: ${targetOnnx}, Model: ${targetModel}`);
102
+
103
+ const confirmed = await promptConfirm(
104
+ `\n Do you want to proceed with this modification? [y/N] `,
105
+ );
106
+ if (!confirmed) {
107
+ log(`\n ${c('yellow', '⚠')} Operation cancelled by user. Existing installation unchanged.`);
108
+ return;
109
+ }
110
+ log('');
111
+ }
112
+
53
113
  if (process.env.TK_MOCK_LAYA_DOWNLOAD) {
54
114
  if (!fs.existsSync(layaDir)) fs.mkdirSync(layaDir, { recursive: true });
55
115
  if (!fs.existsSync(modelsDir)) fs.mkdirSync(modelsDir, { recursive: true });
@@ -197,13 +257,41 @@ async function cmdSystem1Enable(quiet) {
197
257
  });
198
258
  await laya.close();
199
259
 
200
- // 4. Save config
260
+ // Verify installed dependency version
261
+ if (!quiet) log(` ${c('yellow', '5.')} Verifying installed versions...`);
262
+ const pkgLockPath = path.join(layaDir, 'package-lock.json');
263
+ let installedLayaVer = 'Unknown';
264
+ let installedOnnxVer = 'Unknown';
265
+ if (fs.existsSync(pkgLockPath)) {
266
+ const pkgLock = JSON.parse(fs.readFileSync(pkgLockPath, 'utf8'));
267
+ installedLayaVer =
268
+ pkgLock.dependencies?.['@receptron/laya']?.version ||
269
+ pkgLock.packages?.['node_modules/@receptron/laya']?.version ||
270
+ 'Unknown';
271
+ installedOnnxVer =
272
+ pkgLock.dependencies?.['onnxruntime-node']?.version ||
273
+ pkgLock.packages?.['node_modules/onnxruntime-node']?.version ||
274
+ 'Unknown';
275
+ }
276
+
277
+ if (
278
+ process.env.NODE_ENV !== 'test' &&
279
+ (installedLayaVer !== targetLaya || installedOnnxVer !== targetOnnx)
280
+ ) {
281
+ throw new Error(
282
+ `Version verification failed. Expected Laya: ${targetLaya}, ONNX: ${targetOnnx}. Got Laya: ${installedLayaVer}, ONNX: ${installedOnnxVer}.`,
283
+ );
284
+ }
285
+
286
+ // 6. Save config
201
287
  fs.writeFileSync(
202
288
  configPath,
203
289
  JSON.stringify(
204
290
  {
205
291
  enabled: true,
206
- model_version: 'v1.0.0',
292
+ model_version: targetModel,
293
+ laya_version: targetLaya,
294
+ onnxruntime_version: targetOnnx,
207
295
  checksum_verified: true,
208
296
  installed_at: new Date().toISOString(),
209
297
  },
@@ -270,9 +358,22 @@ function cmdSystem1Status(quiet) {
270
358
  }
271
359
  }
272
360
 
273
- function cmdSystem1Clean(quiet) {
361
+ async function cmdSystem1Clean(quiet) {
274
362
  const layaDir = getLayaDir();
275
363
  if (fs.existsSync(layaDir)) {
364
+ if (!process.env.TK_MOCK_LAYA_DOWNLOAD) {
365
+ log(` Action: System-1 will be completely removed.`);
366
+ const confirmed = await promptConfirm(
367
+ `\n Do you want to proceed with this modification? [y/N] `,
368
+ );
369
+ if (!confirmed) {
370
+ log(
371
+ `\n ${c('yellow', '⚠')} Operation cancelled by user. Existing installation unchanged.`,
372
+ );
373
+ return;
374
+ }
375
+ log('');
376
+ }
276
377
  fs.rmSync(layaDir, { recursive: true, force: true });
277
378
  if (!quiet) log(` ${c('green', '✓')} System-1 installation completely removed.`);
278
379
  } else {
@@ -295,7 +396,7 @@ async function cmdSystem1(flags, args, quiet) {
295
396
  cmdSystem1Status(quiet);
296
397
  break;
297
398
  case 'clean':
298
- cmdSystem1Clean(quiet);
399
+ await cmdSystem1Clean(quiet);
299
400
  break;
300
401
  default:
301
402
  err(`Unknown system1 command: "${subCommand || ''}"`);