scene-capability-engine 3.6.65 → 3.6.67

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 (121) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +17 -6
  3. package/README.zh.md +18 -6
  4. package/bin/scene-capability-engine.js +4 -0
  5. package/docs/README.md +2 -2
  6. package/docs/command-reference.md +382 -6
  7. package/docs/document-governance.md +3 -2
  8. package/docs/integration-modes.md +62 -478
  9. package/docs/integration-philosophy.md +56 -263
  10. package/docs/magicball-project-portfolio-contract.md +114 -2
  11. package/docs/project-management/README.md +14 -0
  12. package/docs/project-management/assurance/backup.md +3 -0
  13. package/docs/project-management/assurance/config.md +3 -0
  14. package/docs/project-management/assurance/evidence/README.md +3 -0
  15. package/docs/project-management/assurance/incidents/README.md +3 -0
  16. package/docs/project-management/assurance/logs.md +3 -0
  17. package/docs/project-management/assurance/overview.md +3 -0
  18. package/docs/project-management/assurance/recovery/README.md +3 -0
  19. package/docs/project-management/assurance/resource.md +3 -0
  20. package/docs/project-management/assurance/runbooks/README.md +3 -0
  21. package/docs/project-management/delivery/acceptance/README.md +3 -0
  22. package/docs/project-management/delivery/acceptance/evidence/README.md +3 -0
  23. package/docs/project-management/delivery/acceptance/exceptions/README.md +3 -0
  24. package/docs/project-management/delivery/acceptance/reports/README.md +3 -0
  25. package/docs/project-management/delivery/documents/changes.md +3 -0
  26. package/docs/project-management/delivery/documents/issues.md +3 -0
  27. package/docs/project-management/delivery/documents/overview.md +3 -0
  28. package/docs/project-management/delivery/documents/planning.md +3 -0
  29. package/docs/project-management/delivery/documents/requirements.md +3 -0
  30. package/docs/project-management/delivery/documents/tracking.md +3 -0
  31. package/docs/project-management/delivery/handoffs/README.md +3 -0
  32. package/docs/project-management/delivery/handoffs/evidence/README.md +3 -0
  33. package/docs/project-management/delivery/handoffs/records/README.md +3 -0
  34. package/docs/project-management/delivery/overview.md +10 -0
  35. package/docs/project-management/delivery/releases/README.md +3 -0
  36. package/docs/project-management/delivery/releases/baselines/README.md +3 -0
  37. package/docs/project-management/delivery/releases/evidence/README.md +3 -0
  38. package/docs/project-management/delivery/tables/changes.md +3 -0
  39. package/docs/project-management/delivery/tables/issues.md +3 -0
  40. package/docs/project-management/delivery/tables/planning.md +3 -0
  41. package/docs/project-management/delivery/tables/requirements.md +3 -0
  42. package/docs/project-management/delivery/tables/tracking.md +3 -0
  43. package/docs/project-management/environment/agent-discovery.md +3 -0
  44. package/docs/project-management/environment/development.md +3 -0
  45. package/docs/project-management/environment/overview.md +10 -0
  46. package/docs/project-management/environment/testing.md +3 -0
  47. package/docs/project-management/environment/version-alignment.md +3 -0
  48. package/docs/quick-start-with-ai-tools.md +68 -308
  49. package/docs/releases/README.md +2 -0
  50. package/docs/releases/v3.6.66.md +23 -0
  51. package/docs/releases/v3.6.67.md +23 -0
  52. package/docs/steering-governance.md +64 -2
  53. package/docs/zh/README.md +2 -2
  54. package/docs/zh/releases/README.md +2 -0
  55. package/docs/zh/releases/v3.6.66.md +23 -0
  56. package/docs/zh/releases/v3.6.67.md +23 -0
  57. package/lib/commands/adopt.js +24 -0
  58. package/lib/commands/native.js +158 -0
  59. package/lib/commands/project.js +95 -0
  60. package/lib/commands/semantic.js +1459 -0
  61. package/lib/commands/session.js +74 -3
  62. package/lib/commands/spec-bootstrap.js +10 -1
  63. package/lib/commands/spec-gate.js +10 -1
  64. package/lib/commands/spec-pipeline.js +10 -1
  65. package/lib/commands/studio.js +405 -30
  66. package/lib/commands/task.js +141 -7
  67. package/lib/governance/supreme-principles.js +530 -0
  68. package/lib/problem/problem-evaluator.js +4 -0
  69. package/lib/project/candidate-inspection-service.js +24 -1
  70. package/lib/project/portfolio-projection-service.js +315 -5
  71. package/lib/project/project-channel-output.js +94 -0
  72. package/lib/project/project-channel-projection.js +181 -0
  73. package/lib/project/root-onboarding-service.js +60 -8
  74. package/lib/project/semantic-shared-source-projection.js +150 -0
  75. package/lib/project/supervision-action-model.js +277 -0
  76. package/lib/project/supervision-projection-service.js +305 -5
  77. package/lib/project/target-resolution-service.js +70 -5
  78. package/lib/project/visibility-policy.js +93 -0
  79. package/lib/runtime/multi-spec-scene-session.js +8 -1
  80. package/lib/runtime/project-channel-context-store.js +387 -0
  81. package/lib/runtime/project-channel-context.js +406 -0
  82. package/lib/runtime/scene-session-binding.js +46 -0
  83. package/lib/runtime/session-store.js +186 -0
  84. package/lib/runtime/steering-contract.js +7 -1
  85. package/lib/semantic/archive-report.js +283 -0
  86. package/lib/semantic/archive-routing.js +67 -0
  87. package/lib/semantic/backflow-report.js +245 -0
  88. package/lib/semantic/capability-contract.js +30 -0
  89. package/lib/semantic/delta-export.js +145 -0
  90. package/lib/semantic/interaction-observer.js +254 -0
  91. package/lib/semantic/kernel-loader.js +881 -0
  92. package/lib/semantic/native-runtime.js +359 -0
  93. package/lib/semantic/progress-ledger.js +433 -0
  94. package/lib/semantic/replay-evaluator.js +382 -0
  95. package/lib/semantic/shared-publication.js +592 -0
  96. package/lib/semantic/shared-source-config.js +183 -0
  97. package/lib/semantic/shared-source-connect.js +139 -0
  98. package/lib/semantic/shared-source-discovery.js +98 -0
  99. package/lib/semantic/shared-sync-export.js +413 -0
  100. package/lib/semantic/shared-sync-intake.js +592 -0
  101. package/lib/semantic/shared-sync-merge.js +547 -0
  102. package/lib/semantic/shared-sync-release.js +463 -0
  103. package/lib/semantic/supreme-intent-report.js +300 -0
  104. package/lib/state/sce-state-store.js +1360 -0
  105. package/lib/steering/context-sync-manager.js +276 -25
  106. package/lib/studio/spec-intake-governor.js +39 -3
  107. package/lib/studio/task-envelope.js +35 -2
  108. package/lib/workspace/takeover-baseline.js +342 -83
  109. package/package.json +7 -2
  110. package/scripts/agent-governance-baseline-audit.js +395 -0
  111. package/scripts/clarification-first-audit.js +9 -9
  112. package/scripts/deprecated-entry-audit.js +240 -0
  113. package/scripts/release-posture-report.js +262 -0
  114. package/template/.sce/README.md +62 -228
  115. package/template/.sce/config/semantic-shared-sources.json +5 -0
  116. package/template/.sce/config/supreme-principles-policy.json +105 -0
  117. package/template/.sce/config/takeover-baseline.json +7 -0
  118. package/template/.sce/steering/CORE_PRINCIPLES.md +23 -63
  119. package/template/.sce/steering/CURRENT_CONTEXT.md +4 -0
  120. package/template/.sce/steering/RULES_GUIDE.md +17 -9
  121. package/template/README.md +32 -96
@@ -42,6 +42,105 @@ function resolveStudioStageFromTaskKey(taskKey) {
42
42
  return normalizeString(normalized.slice('studio:'.length));
43
43
  }
44
44
 
45
+ function readProjectChannelBinding(binding) {
46
+ if (!binding || typeof binding !== 'object') {
47
+ return null;
48
+ }
49
+
50
+ const projectChannel = {
51
+ project_id: normalizeString(binding.project_id) || null,
52
+ channel_id: normalizeString(binding.channel_id) || null,
53
+ focused_channel_id: normalizeString(binding.focused_channel_id) || null,
54
+ active_session_path: normalizeString(binding.active_session_path) || null,
55
+ active_scene: normalizeString(binding.active_scene) || null,
56
+ active_spec_id: normalizeString(binding.active_spec_id) || null,
57
+ active_doc: normalizeString(binding.active_doc) || null
58
+ };
59
+
60
+ if (!projectChannel.project_id && !projectChannel.channel_id) {
61
+ return null;
62
+ }
63
+
64
+ return projectChannel;
65
+ }
66
+
67
+ function resolveStudioProjectChannel(options = {}, lookup = {}, job = {}) {
68
+ const lookupMetadata = lookup && typeof lookup.metadata === 'object' && lookup.metadata
69
+ ? lookup.metadata
70
+ : {};
71
+ const lookupBinding = readProjectChannelBinding(lookupMetadata.project_channel);
72
+ const jobBinding = readProjectChannelBinding(job && job.session ? job.session.project_channel : null);
73
+
74
+ const projectChannel = {
75
+ project_id: normalizeString(options.projectId)
76
+ || normalizeString(options.project_id)
77
+ || (jobBinding ? jobBinding.project_id : '')
78
+ || (lookupBinding ? lookupBinding.project_id : '')
79
+ || normalizeString(lookupMetadata.project_id)
80
+ || null,
81
+ channel_id: normalizeString(options.collabChannel)
82
+ || normalizeString(options.collab_channel)
83
+ || normalizeString(options.channelId)
84
+ || normalizeString(options.channel_id)
85
+ || (jobBinding ? jobBinding.channel_id : '')
86
+ || (lookupBinding ? lookupBinding.channel_id : '')
87
+ || normalizeString(lookupMetadata.channel_id)
88
+ || null,
89
+ focused_channel_id: (jobBinding ? jobBinding.focused_channel_id : '')
90
+ || (lookupBinding ? lookupBinding.focused_channel_id : '')
91
+ || null,
92
+ active_session_path: (jobBinding ? jobBinding.active_session_path : '')
93
+ || (lookupBinding ? lookupBinding.active_session_path : '')
94
+ || null,
95
+ active_scene: (jobBinding ? jobBinding.active_scene : '')
96
+ || (lookupBinding ? lookupBinding.active_scene : '')
97
+ || null,
98
+ active_spec_id: (jobBinding ? jobBinding.active_spec_id : '')
99
+ || (lookupBinding ? lookupBinding.active_spec_id : '')
100
+ || null,
101
+ active_doc: (jobBinding ? jobBinding.active_doc : '')
102
+ || (lookupBinding ? lookupBinding.active_doc : '')
103
+ || null
104
+ };
105
+
106
+ if (!projectChannel.project_id && !projectChannel.channel_id) {
107
+ return null;
108
+ }
109
+
110
+ return projectChannel;
111
+ }
112
+
113
+ function studioJobMatchesProjectChannel(job = {}, projectChannel = null) {
114
+ if (!projectChannel) {
115
+ return true;
116
+ }
117
+
118
+ const jobProjectChannel = readProjectChannelBinding(job && job.session ? job.session.project_channel : null);
119
+ if (!jobProjectChannel) {
120
+ return false;
121
+ }
122
+
123
+ if (projectChannel.project_id && jobProjectChannel.project_id !== projectChannel.project_id) {
124
+ return false;
125
+ }
126
+ if (projectChannel.channel_id && jobProjectChannel.channel_id !== projectChannel.channel_id) {
127
+ return false;
128
+ }
129
+
130
+ return true;
131
+ }
132
+
133
+ function hasExplicitStudioProjectChannelOverride(options = {}) {
134
+ return Boolean(
135
+ normalizeString(options.projectId)
136
+ || normalizeString(options.project_id)
137
+ || normalizeString(options.collabChannel)
138
+ || normalizeString(options.collab_channel)
139
+ || normalizeString(options.channelId)
140
+ || normalizeString(options.channel_id)
141
+ );
142
+ }
143
+
45
144
  async function runTaskDraftCommand(options = {}) {
46
145
  const projectPath = process.cwd();
47
146
  const sceneId = normalizeString(options.scene);
@@ -325,14 +424,19 @@ async function readLatestStudioJobId(projectPath, fileSystem = fs) {
325
424
  }
326
425
  }
327
426
 
328
- async function findLatestStudioJob(projectPath, sceneId, specId, fileSystem = fs) {
427
+ async function findLatestStudioJob(projectPath, sceneId, specId, filters = {}, fileSystem = fs) {
428
+ const projectChannel = readProjectChannelBinding(filters);
329
429
  const latestJobId = await readLatestStudioJobId(projectPath, fileSystem);
330
430
  if (latestJobId) {
331
431
  const latestJob = await loadStudioJob(projectPath, latestJobId, fileSystem);
332
432
  if (latestJob) {
333
433
  const latestScene = normalizeString(latestJob?.scene?.id);
334
434
  const latestSpec = normalizeString(latestJob?.scene?.spec_id) || normalizeString(latestJob?.source?.spec_id);
335
- if (latestScene === normalizeString(sceneId) && latestSpec === normalizeString(specId)) {
435
+ if (
436
+ latestScene === normalizeString(sceneId)
437
+ && latestSpec === normalizeString(specId)
438
+ && studioJobMatchesProjectChannel(latestJob, projectChannel)
439
+ ) {
336
440
  return latestJob;
337
441
  }
338
442
  }
@@ -355,7 +459,11 @@ async function findLatestStudioJob(projectPath, sceneId, specId, fileSystem = fs
355
459
  const payload = await fileSystem.readJson(absolutePath);
356
460
  const payloadScene = normalizeString(payload?.scene?.id);
357
461
  const payloadSpec = normalizeString(payload?.scene?.spec_id) || normalizeString(payload?.source?.spec_id);
358
- if (payloadScene !== normalizeString(sceneId) || payloadSpec !== normalizeString(specId)) {
462
+ if (
463
+ payloadScene !== normalizeString(sceneId)
464
+ || payloadSpec !== normalizeString(specId)
465
+ || !studioJobMatchesProjectChannel(payload, projectChannel)
466
+ ) {
359
467
  continue;
360
468
  }
361
469
 
@@ -387,15 +495,22 @@ async function resolveStudioJobForRef(projectPath, lookup, options = {}, fileSys
387
495
  return explicitJob;
388
496
  }
389
497
 
498
+ const projectChannel = resolveStudioProjectChannel(options, lookup);
390
499
  const metaJobId = normalizeString(lookup?.metadata?.job_id);
391
500
  if (metaJobId) {
392
501
  const metaJob = await loadStudioJob(projectPath, metaJobId, fileSystem);
393
- if (metaJob) {
502
+ if (metaJob && studioJobMatchesProjectChannel(metaJob, projectChannel)) {
394
503
  return metaJob;
395
504
  }
396
505
  }
397
506
 
398
- const fallback = await findLatestStudioJob(projectPath, lookup.scene_id, lookup.spec_id, fileSystem);
507
+ const fallback = await findLatestStudioJob(
508
+ projectPath,
509
+ lookup.scene_id,
510
+ lookup.spec_id,
511
+ projectChannel || {},
512
+ fileSystem
513
+ );
399
514
  return fallback;
400
515
  }
401
516
 
@@ -403,6 +518,7 @@ function buildStudioRerunArgs(stage, lookup, job, options = {}) {
403
518
  const normalizedStage = normalizeString(stage);
404
519
  const sceneId = normalizeString(lookup.scene_id);
405
520
  const specId = normalizeString(lookup.spec_id);
521
+ const projectChannel = resolveStudioProjectChannel(options, lookup, job);
406
522
 
407
523
  if (normalizedStage === 'plan') {
408
524
  const fromChat = normalizeString(options.fromChat)
@@ -421,6 +537,12 @@ function buildStudioRerunArgs(stage, lookup, job, options = {}) {
421
537
  if (specId) {
422
538
  args.push('--spec', specId);
423
539
  }
540
+ if (projectChannel && projectChannel.project_id) {
541
+ args.push('--project-id', projectChannel.project_id);
542
+ }
543
+ if (projectChannel && projectChannel.channel_id) {
544
+ args.push('--collab-channel', projectChannel.channel_id);
545
+ }
424
546
  const goal = normalizeString(options.goal) || normalizeString(job?.source?.goal);
425
547
  if (goal) {
426
548
  args.push('--goal', goal);
@@ -440,7 +562,7 @@ function buildStudioRerunArgs(stage, lookup, job, options = {}) {
440
562
  const jobId = normalizeString(options.job)
441
563
  || normalizeString(options.jobId)
442
564
  || normalizeString(job?.job_id)
443
- || normalizeString(lookup?.metadata?.job_id);
565
+ || (hasExplicitStudioProjectChannelOverride(options) ? '' : normalizeString(lookup?.metadata?.job_id));
444
566
 
445
567
  if (!jobId) {
446
568
  return {
@@ -587,11 +709,17 @@ async function runTaskShowCommand(options = {}, dependencies = {}) {
587
709
  const stage = resolveStudioStageFromTaskKey(lookup.task_key);
588
710
  const job = await resolveStudioJobForRef(projectPath, lookup, options, fileSystem);
589
711
  const rerunPlan = buildStudioRerunArgs(stage, lookup, job, options);
712
+ const projectChannel = resolveStudioProjectChannel(options, lookup, job);
713
+ const fallbackJobId = hasExplicitStudioProjectChannelOverride(options)
714
+ ? null
715
+ : normalizeString(lookup?.metadata?.job_id) || null;
590
716
  payload.task = {
591
717
  kind: 'studio-stage',
592
718
  stage,
593
- job_id: normalizeString(job?.job_id) || normalizeString(lookup?.metadata?.job_id) || null
719
+ job_id: normalizeString(job?.job_id) || fallbackJobId,
720
+ project_channel: projectChannel
594
721
  };
722
+ payload.project_channel = projectChannel;
595
723
  if (rerunPlan.ok) {
596
724
  payload.rerun_command = stringifySceArgs(rerunPlan.args);
597
725
  }
@@ -655,6 +783,7 @@ async function runTaskRerunCommand(options = {}, dependencies = {}) {
655
783
  if (!rerunPlan.ok) {
656
784
  throw new Error(rerunPlan.error || 'Failed to build studio rerun command');
657
785
  }
786
+ const projectChannel = resolveStudioProjectChannel(options, lookup, job);
658
787
 
659
788
  const payload = {
660
789
  mode: 'task-rerun',
@@ -663,6 +792,7 @@ async function runTaskRerunCommand(options = {}, dependencies = {}) {
663
792
  rerun_type: 'studio-stage',
664
793
  stage,
665
794
  job_id: normalizeString(job?.job_id) || null,
795
+ project_channel: projectChannel,
666
796
  dry_run: dryRun,
667
797
  command: stringifySceArgs(rerunPlan.args),
668
798
  authorization: {
@@ -940,6 +1070,8 @@ function registerTaskCommands(program) {
940
1070
  .requiredOption('--ref <task-ref>', 'Task reference (SS.PP.TT)')
941
1071
  .option('--from-chat <session>', 'Override session for studio plan rerun hints')
942
1072
  .option('--job <job-id>', 'Override studio job id for rerun hints')
1073
+ .option('--project-id <project-id>', 'Override project scope for studio task resolution')
1074
+ .option('--collab-channel <channel-id>', 'Override collaboration channel for studio task resolution')
943
1075
  .option('--json', 'Print machine-readable JSON output')
944
1076
  .action(async (options) => {
945
1077
  try {
@@ -958,6 +1090,8 @@ function registerTaskCommands(program) {
958
1090
  .option('--auth-lease <lease-id>', 'Write authorization lease id (sce auth grant)')
959
1091
  .option('--from-chat <session>', 'Override session for studio plan rerun')
960
1092
  .option('--job <job-id>', 'Override studio job id')
1093
+ .option('--project-id <project-id>', 'Override project scope for studio task rerun')
1094
+ .option('--collab-channel <channel-id>', 'Override collaboration channel for studio task rerun')
961
1095
  .option('--profile <profile>', 'Override profile for studio verify/release rerun')
962
1096
  .option('--channel <channel>', 'Override channel for studio release rerun')
963
1097
  .option('--goal <goal>', 'Override goal for studio plan rerun')