scene-capability-engine 3.6.64 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +17 -6
- package/README.zh.md +18 -6
- package/bin/scene-capability-engine.js +4 -0
- package/docs/README.md +2 -2
- package/docs/command-reference.md +385 -8
- package/docs/document-governance.md +3 -2
- package/docs/integration-modes.md +62 -478
- package/docs/integration-philosophy.md +56 -263
- package/docs/magicball-cli-invocation-examples.md +1 -0
- package/docs/magicball-project-portfolio-contract.md +125 -4
- package/docs/project-management/README.md +14 -0
- package/docs/project-management/assurance/backup.md +3 -0
- package/docs/project-management/assurance/config.md +3 -0
- package/docs/project-management/assurance/evidence/README.md +3 -0
- package/docs/project-management/assurance/incidents/README.md +3 -0
- package/docs/project-management/assurance/logs.md +3 -0
- package/docs/project-management/assurance/overview.md +3 -0
- package/docs/project-management/assurance/recovery/README.md +3 -0
- package/docs/project-management/assurance/resource.md +3 -0
- package/docs/project-management/assurance/runbooks/README.md +3 -0
- package/docs/project-management/delivery/acceptance/README.md +3 -0
- package/docs/project-management/delivery/acceptance/evidence/README.md +3 -0
- package/docs/project-management/delivery/acceptance/exceptions/README.md +3 -0
- package/docs/project-management/delivery/acceptance/reports/README.md +3 -0
- package/docs/project-management/delivery/documents/changes.md +3 -0
- package/docs/project-management/delivery/documents/issues.md +3 -0
- package/docs/project-management/delivery/documents/overview.md +3 -0
- package/docs/project-management/delivery/documents/planning.md +3 -0
- package/docs/project-management/delivery/documents/requirements.md +3 -0
- package/docs/project-management/delivery/documents/tracking.md +3 -0
- package/docs/project-management/delivery/handoffs/README.md +3 -0
- package/docs/project-management/delivery/handoffs/evidence/README.md +3 -0
- package/docs/project-management/delivery/handoffs/records/README.md +3 -0
- package/docs/project-management/delivery/overview.md +10 -0
- package/docs/project-management/delivery/releases/README.md +3 -0
- package/docs/project-management/delivery/releases/baselines/README.md +3 -0
- package/docs/project-management/delivery/releases/evidence/README.md +3 -0
- package/docs/project-management/delivery/tables/changes.md +3 -0
- package/docs/project-management/delivery/tables/issues.md +3 -0
- package/docs/project-management/delivery/tables/planning.md +3 -0
- package/docs/project-management/delivery/tables/requirements.md +3 -0
- package/docs/project-management/delivery/tables/tracking.md +3 -0
- package/docs/project-management/environment/agent-discovery.md +3 -0
- package/docs/project-management/environment/development.md +3 -0
- package/docs/project-management/environment/overview.md +10 -0
- package/docs/project-management/environment/testing.md +3 -0
- package/docs/project-management/environment/version-alignment.md +3 -0
- package/docs/quick-start-with-ai-tools.md +68 -308
- package/docs/releases/README.md +3 -0
- package/docs/releases/v3.6.65.md +25 -0
- package/docs/releases/v3.6.66.md +23 -0
- package/docs/releases/v3.6.67.md +23 -0
- package/docs/steering-governance.md +64 -2
- package/docs/zh/README.md +2 -2
- package/docs/zh/releases/README.md +3 -0
- package/docs/zh/releases/v3.6.65.md +25 -0
- package/docs/zh/releases/v3.6.66.md +23 -0
- package/docs/zh/releases/v3.6.67.md +23 -0
- package/lib/commands/adopt.js +24 -0
- package/lib/commands/native.js +158 -0
- package/lib/commands/project.js +96 -0
- package/lib/commands/semantic.js +1459 -0
- package/lib/commands/session.js +74 -3
- package/lib/commands/spec-bootstrap.js +10 -1
- package/lib/commands/spec-gate.js +10 -1
- package/lib/commands/spec-pipeline.js +10 -1
- package/lib/commands/studio.js +405 -30
- package/lib/commands/task.js +141 -7
- package/lib/governance/supreme-principles.js +530 -0
- package/lib/problem/problem-evaluator.js +4 -0
- package/lib/project/candidate-inspection-service.js +24 -1
- package/lib/project/portfolio-projection-service.js +315 -5
- package/lib/project/project-channel-output.js +94 -0
- package/lib/project/project-channel-projection.js +181 -0
- package/lib/project/root-onboarding-service.js +107 -7
- package/lib/project/semantic-shared-source-projection.js +150 -0
- package/lib/project/supervision-action-model.js +277 -0
- package/lib/project/supervision-projection-service.js +305 -5
- package/lib/project/target-resolution-service.js +70 -5
- package/lib/project/visibility-policy.js +93 -0
- package/lib/runtime/multi-spec-scene-session.js +8 -1
- package/lib/runtime/project-channel-context-store.js +387 -0
- package/lib/runtime/project-channel-context.js +406 -0
- package/lib/runtime/scene-session-binding.js +46 -0
- package/lib/runtime/session-store.js +186 -0
- package/lib/runtime/steering-contract.js +7 -1
- package/lib/semantic/archive-report.js +283 -0
- package/lib/semantic/archive-routing.js +67 -0
- package/lib/semantic/backflow-report.js +245 -0
- package/lib/semantic/capability-contract.js +30 -0
- package/lib/semantic/delta-export.js +145 -0
- package/lib/semantic/interaction-observer.js +254 -0
- package/lib/semantic/kernel-loader.js +881 -0
- package/lib/semantic/native-runtime.js +359 -0
- package/lib/semantic/progress-ledger.js +433 -0
- package/lib/semantic/replay-evaluator.js +382 -0
- package/lib/semantic/shared-publication.js +592 -0
- package/lib/semantic/shared-source-config.js +183 -0
- package/lib/semantic/shared-source-connect.js +139 -0
- package/lib/semantic/shared-source-discovery.js +98 -0
- package/lib/semantic/shared-sync-export.js +413 -0
- package/lib/semantic/shared-sync-intake.js +592 -0
- package/lib/semantic/shared-sync-merge.js +547 -0
- package/lib/semantic/shared-sync-release.js +463 -0
- package/lib/semantic/supreme-intent-report.js +300 -0
- package/lib/state/sce-state-store.js +1360 -0
- package/lib/steering/context-sync-manager.js +276 -25
- package/lib/studio/spec-intake-governor.js +39 -3
- package/lib/studio/task-envelope.js +35 -2
- package/lib/workspace/takeover-baseline.js +342 -83
- package/package.json +7 -2
- package/scripts/agent-governance-baseline-audit.js +395 -0
- package/scripts/clarification-first-audit.js +9 -9
- package/scripts/deprecated-entry-audit.js +240 -0
- package/scripts/release-doc-version-audit.js +24 -0
- package/scripts/release-posture-report.js +262 -0
- package/template/.sce/README.md +62 -228
- package/template/.sce/config/semantic-shared-sources.json +5 -0
- package/template/.sce/config/supreme-principles-policy.json +105 -0
- package/template/.sce/config/takeover-baseline.json +7 -0
- package/template/.sce/steering/CORE_PRINCIPLES.md +23 -63
- package/template/.sce/steering/CURRENT_CONTEXT.md +4 -0
- package/template/.sce/steering/RULES_GUIDE.md +17 -9
- package/template/README.md +32 -96
package/lib/commands/studio.js
CHANGED
|
@@ -4,6 +4,7 @@ const { spawnSync } = require('child_process');
|
|
|
4
4
|
const fs = require('fs-extra');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
const { SessionStore } = require('../runtime/session-store');
|
|
7
|
+
const { buildProjectChannelOutput } = require('../project/project-channel-output');
|
|
7
8
|
const {
|
|
8
9
|
DOMAIN_CHAIN_RELATIVE_PATH,
|
|
9
10
|
ensureSpecDomainArtifacts
|
|
@@ -27,6 +28,12 @@ const {
|
|
|
27
28
|
resolveTaskReference: resolveSharedTaskReference,
|
|
28
29
|
buildCommandPayload: buildSharedCommandPayload
|
|
29
30
|
} = require('../studio/task-envelope');
|
|
31
|
+
const {
|
|
32
|
+
assessSupremeIntent,
|
|
33
|
+
buildSupremeRefusalError,
|
|
34
|
+
writeSupremeIntentEvidence,
|
|
35
|
+
recordSupremeIntentAssessment
|
|
36
|
+
} = require('../governance/supreme-principles');
|
|
30
37
|
|
|
31
38
|
const STUDIO_JOB_API_VERSION = 'sce.studio.job/v0.1';
|
|
32
39
|
const STAGE_ORDER = ['plan', 'generate', 'apply', 'verify', 'release'];
|
|
@@ -1579,6 +1586,185 @@ function printStudioPayload(payload, options = {}) {
|
|
|
1579
1586
|
console.log(` Status: ${payload.status}`);
|
|
1580
1587
|
console.log(` Progress: ${payload.progress.completed}/${payload.progress.total} (${payload.progress.percent}%)`);
|
|
1581
1588
|
console.log(` Next: ${payload.next_action}`);
|
|
1589
|
+
if (payload.project_channel && payload.project_channel.project_id) {
|
|
1590
|
+
console.log(` Project Channel: ${payload.project_channel.project_id} / ${payload.project_channel.channel_id}`);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
function deriveStudioProjectId(projectPath, options = {}, job = {}) {
|
|
1595
|
+
const explicit = normalizeString(options.projectId);
|
|
1596
|
+
if (explicit) {
|
|
1597
|
+
return explicit;
|
|
1598
|
+
}
|
|
1599
|
+
const persisted = normalizeString(job?.session?.project_channel?.project_id);
|
|
1600
|
+
if (persisted) {
|
|
1601
|
+
return persisted;
|
|
1602
|
+
}
|
|
1603
|
+
const folderName = normalizeString(path.basename(projectPath));
|
|
1604
|
+
return folderName || 'project';
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
function deriveStudioCollabChannelId(options = {}, job = {}) {
|
|
1608
|
+
const explicit = normalizeString(options.collabChannel);
|
|
1609
|
+
if (explicit) {
|
|
1610
|
+
return explicit;
|
|
1611
|
+
}
|
|
1612
|
+
const persisted = normalizeString(job?.session?.project_channel?.channel_id);
|
|
1613
|
+
if (persisted) {
|
|
1614
|
+
return persisted;
|
|
1615
|
+
}
|
|
1616
|
+
const fromChat = normalizeString(options.fromChat) || normalizeString(job?.source?.from_chat);
|
|
1617
|
+
return fromChat || '';
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function buildStudioProjectChannelBinding(projectPath, options = {}, job = {}) {
|
|
1621
|
+
const projectId = deriveStudioProjectId(projectPath, options, job);
|
|
1622
|
+
const channelId = deriveStudioCollabChannelId(options, job);
|
|
1623
|
+
if (!projectId || !channelId) {
|
|
1624
|
+
return null;
|
|
1625
|
+
}
|
|
1626
|
+
return {
|
|
1627
|
+
project_id: projectId,
|
|
1628
|
+
channel_id: channelId,
|
|
1629
|
+
source: normalizeString(options.collabChannel) ? 'explicit-collab-channel' : 'chat-session'
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
function createStudioSessionStore(projectPath, dependencies = {}) {
|
|
1634
|
+
const fileSystem = dependencies.fileSystem || fs;
|
|
1635
|
+
return dependencies.sessionStore || new SessionStore(projectPath, null, {
|
|
1636
|
+
fileSystem,
|
|
1637
|
+
env: dependencies.env,
|
|
1638
|
+
sqliteModule: dependencies.sqliteModule
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
async function resolveStudioProjectChannelFocus(projectPath, options = {}, dependencies = {}) {
|
|
1643
|
+
const binding = buildStudioProjectChannelBinding(projectPath, options);
|
|
1644
|
+
if (!binding) {
|
|
1645
|
+
return null;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
const sessionStore = createStudioSessionStore(projectPath, dependencies);
|
|
1649
|
+
try {
|
|
1650
|
+
const resolved = await sessionStore.getProjectChannelSession(binding.project_id, binding.channel_id);
|
|
1651
|
+
return {
|
|
1652
|
+
...binding,
|
|
1653
|
+
...buildProjectChannelOutput({
|
|
1654
|
+
projectId: binding.project_id,
|
|
1655
|
+
canonicalProjectId: binding.project_id,
|
|
1656
|
+
requestedChannelId: binding.channel_id,
|
|
1657
|
+
storageMode: resolved.storageMode,
|
|
1658
|
+
contextAvailable: resolved.contextAvailable,
|
|
1659
|
+
context: resolved.context,
|
|
1660
|
+
channel: resolved.channel,
|
|
1661
|
+
session: resolved.session,
|
|
1662
|
+
resolvedChannelId: resolved.resolvedChannelId
|
|
1663
|
+
})
|
|
1664
|
+
};
|
|
1665
|
+
} catch (_error) {
|
|
1666
|
+
return {
|
|
1667
|
+
...binding,
|
|
1668
|
+
context_available: false,
|
|
1669
|
+
storage_mode: 'none',
|
|
1670
|
+
requested_channel_id: normalizeString(binding.channel_id) || null,
|
|
1671
|
+
focused_channel_id: null,
|
|
1672
|
+
channel_id: normalizeString(binding.channel_id) || null,
|
|
1673
|
+
active_scene: null,
|
|
1674
|
+
active_spec_id: null,
|
|
1675
|
+
active_doc: null,
|
|
1676
|
+
active_session_path: null,
|
|
1677
|
+
run_state: null,
|
|
1678
|
+
updated_at: null,
|
|
1679
|
+
resolved_session_id: null
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
async function syncStudioProjectChannel(job, stageDoc, options = {}, dependencies = {}) {
|
|
1685
|
+
const projectPath = dependencies.projectPath || process.cwd();
|
|
1686
|
+
const sessionStore = createStudioSessionStore(projectPath, dependencies);
|
|
1687
|
+
const binding = buildStudioProjectChannelBinding(projectPath, options, job);
|
|
1688
|
+
const sceneSessionId = normalizeString(job?.session?.scene_session_id);
|
|
1689
|
+
if (!binding || !sceneSessionId) {
|
|
1690
|
+
return null;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
const bound = await sessionStore.bindSessionToProjectChannel(sceneSessionId, {
|
|
1694
|
+
projectId: binding.project_id,
|
|
1695
|
+
channelId: binding.channel_id,
|
|
1696
|
+
activeScene: normalizeString(job?.scene?.id),
|
|
1697
|
+
activeSpecId: normalizeString(job?.scene?.spec_id) || normalizeString(job?.source?.spec_id),
|
|
1698
|
+
activeDoc: normalizeString(stageDoc),
|
|
1699
|
+
focus: true,
|
|
1700
|
+
syncCurrentContext: true
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
job.session = job.session || {};
|
|
1704
|
+
job.session.project_channel = {
|
|
1705
|
+
project_id: binding.project_id,
|
|
1706
|
+
channel_id: binding.channel_id,
|
|
1707
|
+
focused_channel_id: bound.context.focusedChannelId,
|
|
1708
|
+
active_session_path: bound.channel.activeSessionPath,
|
|
1709
|
+
active_scene: bound.channel.activeScene,
|
|
1710
|
+
active_spec_id: bound.channel.activeSpecId,
|
|
1711
|
+
active_doc: bound.channel.activeDoc,
|
|
1712
|
+
source: binding.source,
|
|
1713
|
+
synced_at: nowIso()
|
|
1714
|
+
};
|
|
1715
|
+
return job.session.project_channel;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
async function attachStudioProjectChannelPayload(payload, job, dependencies = {}) {
|
|
1719
|
+
const projectPath = dependencies.projectPath || process.cwd();
|
|
1720
|
+
const binding = job?.session?.project_channel;
|
|
1721
|
+
const projectId = normalizeString(binding && binding.project_id);
|
|
1722
|
+
const channelId = normalizeString(binding && binding.channel_id);
|
|
1723
|
+
if (!projectId || !channelId) {
|
|
1724
|
+
return payload;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
const sessionStore = createStudioSessionStore(projectPath, dependencies);
|
|
1728
|
+
const resolved = await sessionStore.getProjectChannelSession(projectId, channelId);
|
|
1729
|
+
payload.project_channel = buildProjectChannelOutput({
|
|
1730
|
+
projectId,
|
|
1731
|
+
canonicalProjectId: projectId,
|
|
1732
|
+
requestedChannelId: channelId,
|
|
1733
|
+
storageMode: resolved.storageMode,
|
|
1734
|
+
contextAvailable: resolved.contextAvailable,
|
|
1735
|
+
context: resolved.context,
|
|
1736
|
+
channel: resolved.channel,
|
|
1737
|
+
session: resolved.session,
|
|
1738
|
+
resolvedChannelId: resolved.resolvedChannelId,
|
|
1739
|
+
fallback: binding
|
|
1740
|
+
});
|
|
1741
|
+
return payload;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
async function persistStudioSupremeIntentAssessment(projectPath, options = {}, assessment = {}, extra = {}, dependencies = {}) {
|
|
1745
|
+
const binding = buildStudioProjectChannelBinding(projectPath, options, extra.job || {});
|
|
1746
|
+
return recordSupremeIntentAssessment({
|
|
1747
|
+
...assessment,
|
|
1748
|
+
project_id: extra.project_id || (binding ? binding.project_id : null),
|
|
1749
|
+
channel_id: extra.channel_id || (binding ? binding.channel_id : null),
|
|
1750
|
+
session_id: extra.session_id || null,
|
|
1751
|
+
scene_id: extra.scene_id || assessment.scene_id || null,
|
|
1752
|
+
spec_id: extra.spec_id || assessment.spec_id || null,
|
|
1753
|
+
job_id: extra.job_id || null,
|
|
1754
|
+
source_kind: extra.source_kind || assessment.source_kind || 'studio',
|
|
1755
|
+
evidence_path: extra.evidence_path || null,
|
|
1756
|
+
metadata: {
|
|
1757
|
+
channel_binding: binding || null,
|
|
1758
|
+
...(extra.metadata && typeof extra.metadata === 'object' ? extra.metadata : {})
|
|
1759
|
+
}
|
|
1760
|
+
}, {
|
|
1761
|
+
projectPath,
|
|
1762
|
+
fileSystem: dependencies.fileSystem,
|
|
1763
|
+
env: dependencies.env,
|
|
1764
|
+
sqliteModule: dependencies.sqliteModule,
|
|
1765
|
+
stateStore: dependencies.stateStore,
|
|
1766
|
+
noCache: dependencies.noCache === true
|
|
1767
|
+
});
|
|
1582
1768
|
}
|
|
1583
1769
|
|
|
1584
1770
|
|
|
@@ -1586,18 +1772,47 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1586
1772
|
const projectPath = dependencies.projectPath || process.cwd();
|
|
1587
1773
|
const fileSystem = dependencies.fileSystem || fs;
|
|
1588
1774
|
const fromChat = normalizeString(options.fromChat);
|
|
1589
|
-
const
|
|
1590
|
-
const
|
|
1775
|
+
const explicitSceneId = normalizeString(options.scene);
|
|
1776
|
+
const explicitSpecId = normalizeString(options.spec);
|
|
1591
1777
|
const goal = normalizeString(options.goal);
|
|
1592
1778
|
const manualSpecMode = options.manualSpec === true;
|
|
1593
1779
|
const skipSpecGovernance = options.specGovernance === false;
|
|
1780
|
+
const channelFocus = await resolveStudioProjectChannelFocus(projectPath, options, dependencies);
|
|
1781
|
+
const sceneId = explicitSceneId || normalizeString(channelFocus && channelFocus.active_scene);
|
|
1782
|
+
const channelFocusedSpecId = normalizeString(channelFocus && channelFocus.active_spec_id);
|
|
1783
|
+
const boundSpecId = explicitSpecId
|
|
1784
|
+
|| (channelFocusedSpecId && await fileSystem.pathExists(path.join(projectPath, '.sce', 'specs', channelFocusedSpecId))
|
|
1785
|
+
? channelFocusedSpecId
|
|
1786
|
+
: '');
|
|
1594
1787
|
|
|
1595
1788
|
if (!fromChat) {
|
|
1596
1789
|
throw new Error('--from-chat is required');
|
|
1597
1790
|
}
|
|
1598
1791
|
if (!sceneId) {
|
|
1599
|
-
throw new Error('--scene is required');
|
|
1792
|
+
throw new Error('--scene is required unless project/channel context can resolve an active scene');
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
const supremeAssessment = await assessSupremeIntent({
|
|
1796
|
+
text: goal,
|
|
1797
|
+
source_kind: 'studio-plan',
|
|
1798
|
+
scene_id: sceneId,
|
|
1799
|
+
spec_id: boundSpecId || null
|
|
1800
|
+
}, {
|
|
1801
|
+
projectPath,
|
|
1802
|
+
fileSystem
|
|
1803
|
+
});
|
|
1804
|
+
if (!supremeAssessment.planning_allowed) {
|
|
1805
|
+
await persistStudioSupremeIntentAssessment(projectPath, options, supremeAssessment, {
|
|
1806
|
+
scene_id: sceneId,
|
|
1807
|
+
spec_id: boundSpecId || null,
|
|
1808
|
+
source_kind: 'studio-plan',
|
|
1809
|
+
metadata: {
|
|
1810
|
+
refusal_stage: 'pre-plan'
|
|
1811
|
+
}
|
|
1812
|
+
}, dependencies);
|
|
1813
|
+
throw buildSupremeRefusalError(supremeAssessment);
|
|
1600
1814
|
}
|
|
1815
|
+
const governedGoal = normalizeString(supremeAssessment.effective_text) || goal;
|
|
1601
1816
|
|
|
1602
1817
|
const intakePolicyBundle = await loadStudioIntakePolicy(projectPath, fileSystem);
|
|
1603
1818
|
const intakePolicy = intakePolicyBundle.policy || {};
|
|
@@ -1615,18 +1830,18 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1615
1830
|
|
|
1616
1831
|
let domainChainBinding = await resolveDomainChainBinding({
|
|
1617
1832
|
sceneId,
|
|
1618
|
-
specId,
|
|
1619
|
-
goal
|
|
1833
|
+
specId: boundSpecId,
|
|
1834
|
+
goal: governedGoal
|
|
1620
1835
|
}, {
|
|
1621
1836
|
projectPath,
|
|
1622
1837
|
fileSystem
|
|
1623
1838
|
});
|
|
1624
1839
|
|
|
1625
1840
|
let relatedSpecLookup = await findRelatedSpecs({
|
|
1626
|
-
query:
|
|
1841
|
+
query: governedGoal,
|
|
1627
1842
|
sceneId,
|
|
1628
1843
|
limit: 8,
|
|
1629
|
-
excludeSpecId: domainChainBinding.spec_id ||
|
|
1844
|
+
excludeSpecId: domainChainBinding.spec_id || boundSpecId || null
|
|
1630
1845
|
}, {
|
|
1631
1846
|
projectPath,
|
|
1632
1847
|
fileSystem
|
|
@@ -1635,25 +1850,29 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1635
1850
|
const intake = await runStudioAutoIntake({
|
|
1636
1851
|
scene_id: sceneId,
|
|
1637
1852
|
from_chat: fromChat,
|
|
1638
|
-
goal,
|
|
1639
|
-
explicit_spec_id:
|
|
1853
|
+
goal: governedGoal,
|
|
1854
|
+
explicit_spec_id: explicitSpecId,
|
|
1640
1855
|
domain_chain_binding: domainChainBinding,
|
|
1641
1856
|
related_specs: relatedSpecLookup,
|
|
1857
|
+
supreme_principles: supremeAssessment,
|
|
1642
1858
|
apply: !manualSpecMode,
|
|
1643
1859
|
skip: manualSpecMode
|
|
1644
1860
|
}, {
|
|
1645
1861
|
projectPath,
|
|
1646
1862
|
fileSystem
|
|
1647
1863
|
});
|
|
1864
|
+
if (intake && intake.decision && intake.decision.action === 'refuse') {
|
|
1865
|
+
throw buildSupremeRefusalError(supremeAssessment);
|
|
1866
|
+
}
|
|
1648
1867
|
|
|
1649
1868
|
const intakeSpecId = normalizeString(intake && intake.selected_spec_id);
|
|
1650
|
-
const effectiveSpecId = intakeSpecId || normalizeString(domainChainBinding.spec_id) ||
|
|
1869
|
+
const effectiveSpecId = intakeSpecId || normalizeString(domainChainBinding.spec_id) || boundSpecId || null;
|
|
1651
1870
|
|
|
1652
1871
|
if (effectiveSpecId && effectiveSpecId !== normalizeString(domainChainBinding.spec_id)) {
|
|
1653
1872
|
domainChainBinding = await resolveDomainChainBinding({
|
|
1654
1873
|
sceneId,
|
|
1655
1874
|
specId: effectiveSpecId,
|
|
1656
|
-
goal
|
|
1875
|
+
goal: governedGoal
|
|
1657
1876
|
}, {
|
|
1658
1877
|
projectPath,
|
|
1659
1878
|
fileSystem
|
|
@@ -1661,7 +1880,7 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1661
1880
|
}
|
|
1662
1881
|
|
|
1663
1882
|
relatedSpecLookup = await findRelatedSpecs({
|
|
1664
|
-
query:
|
|
1883
|
+
query: governedGoal,
|
|
1665
1884
|
sceneId,
|
|
1666
1885
|
limit: 8,
|
|
1667
1886
|
excludeSpecId: effectiveSpecId || null
|
|
@@ -1686,11 +1905,20 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1686
1905
|
|
|
1687
1906
|
const jobId = normalizeString(options.job) || createJobId();
|
|
1688
1907
|
const now = nowIso();
|
|
1908
|
+
const supremeEvidence = effectiveSpecId
|
|
1909
|
+
? await writeSupremeIntentEvidence(projectPath, effectiveSpecId, {
|
|
1910
|
+
...supremeAssessment,
|
|
1911
|
+
source_kind: 'studio-plan',
|
|
1912
|
+
spec_id: effectiveSpecId
|
|
1913
|
+
}, {
|
|
1914
|
+
fileSystem
|
|
1915
|
+
})
|
|
1916
|
+
: null;
|
|
1689
1917
|
const problemContract = normalizeProblemContract(
|
|
1690
1918
|
domainChainBinding.problem_contract || {},
|
|
1691
1919
|
{
|
|
1692
1920
|
scene_id: sceneId,
|
|
1693
|
-
goal,
|
|
1921
|
+
goal: governedGoal,
|
|
1694
1922
|
problem_statement: normalizeString(domainChainBinding?.summary?.problem_statement),
|
|
1695
1923
|
verification_plan: normalizeString(domainChainBinding?.summary?.verification_plan)
|
|
1696
1924
|
}
|
|
@@ -1702,8 +1930,18 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1702
1930
|
spec_id: effectiveSpecId
|
|
1703
1931
|
},
|
|
1704
1932
|
source: {
|
|
1705
|
-
goal:
|
|
1933
|
+
goal: governedGoal || null,
|
|
1934
|
+
goal_original: goal || null,
|
|
1935
|
+
supreme_principles: supremeAssessment,
|
|
1936
|
+
supreme_intent_evidence: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
1706
1937
|
spec_id: effectiveSpecId,
|
|
1938
|
+
scene_source: explicitSceneId ? 'explicit-scene' : 'project-channel-focus',
|
|
1939
|
+
bound_channel_focus: channelFocus ? {
|
|
1940
|
+
project_id: channelFocus.project_id,
|
|
1941
|
+
channel_id: channelFocus.channel_id,
|
|
1942
|
+
active_scene: channelFocus.active_scene || null,
|
|
1943
|
+
active_spec_id: channelFocus.active_spec_id || null
|
|
1944
|
+
} : null,
|
|
1707
1945
|
problem_contract: problemContract,
|
|
1708
1946
|
problem_contract_path: domainChainBinding.problem_contract_path || null,
|
|
1709
1947
|
domain_chain: {
|
|
@@ -1719,7 +1957,7 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1719
1957
|
const planProblemEvaluation = await enforceProblemEvaluationForStage(planShadowJob, 'plan', {
|
|
1720
1958
|
scene_id: sceneId,
|
|
1721
1959
|
spec_id: effectiveSpecId,
|
|
1722
|
-
goal:
|
|
1960
|
+
goal: governedGoal || null,
|
|
1723
1961
|
problem_contract: problemContract,
|
|
1724
1962
|
domain_chain: {
|
|
1725
1963
|
resolved: domainChainBinding.resolved === true,
|
|
@@ -1747,9 +1985,24 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1747
1985
|
const sessionStore = dependencies.sessionStore || new SessionStore(projectPath);
|
|
1748
1986
|
const sceneSessionBinding = await sessionStore.beginSceneSession({
|
|
1749
1987
|
sceneId,
|
|
1750
|
-
objective:
|
|
1988
|
+
objective: governedGoal || `Studio scene cycle for ${sceneId}`,
|
|
1751
1989
|
tool: normalizeString(options.tool) || 'generic'
|
|
1752
1990
|
});
|
|
1991
|
+
const supremeLedgerEntry = await persistStudioSupremeIntentAssessment(projectPath, options, supremeAssessment, {
|
|
1992
|
+
session_id: sceneSessionBinding.session.session_id,
|
|
1993
|
+
scene_id: sceneId,
|
|
1994
|
+
spec_id: effectiveSpecId,
|
|
1995
|
+
job_id: jobId,
|
|
1996
|
+
source_kind: 'studio-plan',
|
|
1997
|
+
evidence_path: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
1998
|
+
metadata: {
|
|
1999
|
+
original_goal: goal || null,
|
|
2000
|
+
effective_goal: governedGoal || null,
|
|
2001
|
+
scene_cycle: sceneSessionBinding.scene_cycle,
|
|
2002
|
+
intake_action: intake && intake.decision ? intake.decision.action : null,
|
|
2003
|
+
related_specs_total: Number(relatedSpecLookup.total_candidates || 0)
|
|
2004
|
+
}
|
|
2005
|
+
}, dependencies);
|
|
1753
2006
|
|
|
1754
2007
|
let governanceSnapshot = null;
|
|
1755
2008
|
let governanceWarning = '';
|
|
@@ -1776,6 +2029,7 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1776
2029
|
from_chat: fromChat,
|
|
1777
2030
|
scene_id: sceneId,
|
|
1778
2031
|
spec_id: effectiveSpecId,
|
|
2032
|
+
scene_source: explicitSceneId ? 'explicit-scene' : 'project-channel-focus',
|
|
1779
2033
|
scene_session_id: sceneSessionBinding.session.session_id,
|
|
1780
2034
|
scene_cycle: sceneSessionBinding.scene_cycle,
|
|
1781
2035
|
domain_chain_resolved: domainChainBinding.resolved === true,
|
|
@@ -1792,8 +2046,12 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1792
2046
|
decision_reason: intake.decision ? intake.decision.reason : null,
|
|
1793
2047
|
selected_spec_id: intake.selected_spec_id || effectiveSpecId || null,
|
|
1794
2048
|
created_spec_id: intake.created_spec && intake.created_spec.created ? intake.created_spec.spec_id : null,
|
|
1795
|
-
policy_path: intake.policy_path || null
|
|
2049
|
+
policy_path: intake.policy_path || null,
|
|
2050
|
+
supreme_action: supremeAssessment.action,
|
|
2051
|
+
effective_goal: governedGoal || null
|
|
1796
2052
|
} : null,
|
|
2053
|
+
supreme_principles: supremeAssessment,
|
|
2054
|
+
supreme_intent_evidence: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
1797
2055
|
problem_evaluation: summarizeProblemEvaluation(planProblemEvaluation),
|
|
1798
2056
|
spec_governance: governanceSnapshot ? governanceSnapshot.summary : null,
|
|
1799
2057
|
spec_governance_warning: governanceWarning || null,
|
|
@@ -1810,7 +2068,11 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1810
2068
|
status: 'planned',
|
|
1811
2069
|
source: {
|
|
1812
2070
|
from_chat: fromChat,
|
|
1813
|
-
goal:
|
|
2071
|
+
goal: governedGoal || null,
|
|
2072
|
+
goal_original: goal || null,
|
|
2073
|
+
goal_effective: governedGoal || null,
|
|
2074
|
+
supreme_principles: supremeAssessment,
|
|
2075
|
+
supreme_intent_evidence: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
1814
2076
|
spec_id: effectiveSpecId,
|
|
1815
2077
|
problem_contract: problemContract,
|
|
1816
2078
|
problem_contract_path: domainChainBinding.problem_contract_path || null,
|
|
@@ -1821,7 +2083,9 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1821
2083
|
intent: intake.intent || null,
|
|
1822
2084
|
decision: intake.decision || null,
|
|
1823
2085
|
selected_spec_id: intake.selected_spec_id || effectiveSpecId || null,
|
|
1824
|
-
created_spec: intake.created_spec || null
|
|
2086
|
+
created_spec: intake.created_spec || null,
|
|
2087
|
+
supreme_action: supremeAssessment.action,
|
|
2088
|
+
effective_goal: governedGoal || null
|
|
1825
2089
|
} : null,
|
|
1826
2090
|
domain_chain: {
|
|
1827
2091
|
resolved: domainChainBinding.resolved === true,
|
|
@@ -1883,11 +2147,19 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1883
2147
|
}
|
|
1884
2148
|
};
|
|
1885
2149
|
|
|
2150
|
+
await syncStudioProjectChannel(job, 'requirements', options, {
|
|
2151
|
+
projectPath,
|
|
2152
|
+
fileSystem,
|
|
2153
|
+
sessionStore
|
|
2154
|
+
});
|
|
2155
|
+
|
|
1886
2156
|
await saveJob(paths, job, fileSystem);
|
|
1887
2157
|
const planEvent = await appendStudioEvent(paths, job, 'stage.plan.completed', {
|
|
1888
2158
|
from_chat: fromChat,
|
|
1889
2159
|
scene_id: sceneId,
|
|
1890
2160
|
spec_id: effectiveSpecId,
|
|
2161
|
+
original_goal: goal || null,
|
|
2162
|
+
effective_goal: governedGoal || null,
|
|
1891
2163
|
scene_session_id: sceneSessionBinding.session.session_id,
|
|
1892
2164
|
scene_cycle: sceneSessionBinding.scene_cycle,
|
|
1893
2165
|
target: job.target,
|
|
@@ -1902,6 +2174,8 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1902
2174
|
intake_created_spec_id: intake && intake.created_spec && intake.created_spec.created
|
|
1903
2175
|
? intake.created_spec.spec_id
|
|
1904
2176
|
: null,
|
|
2177
|
+
supreme_principles: supremeAssessment,
|
|
2178
|
+
supreme_intent_evidence: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
1905
2179
|
problem_evaluation: summarizeProblemEvaluation(planProblemEvaluation),
|
|
1906
2180
|
spec_governance: governanceSnapshot ? governanceSnapshot.summary : null,
|
|
1907
2181
|
spec_governance_warning: governanceWarning || null,
|
|
@@ -1916,11 +2190,18 @@ async function runStudioPlanCommand(options = {}, dependencies = {}) {
|
|
|
1916
2190
|
projectPath,
|
|
1917
2191
|
fileSystem
|
|
1918
2192
|
});
|
|
2193
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2194
|
+
projectPath,
|
|
2195
|
+
fileSystem,
|
|
2196
|
+
sessionStore
|
|
2197
|
+
});
|
|
1919
2198
|
payload.scene = {
|
|
1920
2199
|
id: sceneId,
|
|
1921
2200
|
spec_id: effectiveSpecId
|
|
1922
2201
|
};
|
|
1923
2202
|
payload.intake = job.source && job.source.intake ? job.source.intake : null;
|
|
2203
|
+
payload.supreme_principles = supremeAssessment;
|
|
2204
|
+
payload.supreme_intent_record = supremeLedgerEntry || null;
|
|
1924
2205
|
payload.spec_governance = governanceSnapshot ? governanceSnapshot.summary : null;
|
|
1925
2206
|
printStudioPayload(payload, options);
|
|
1926
2207
|
return payload;
|
|
@@ -2029,6 +2310,12 @@ async function runStudioGenerateCommand(options = {}, dependencies = {}) {
|
|
|
2029
2310
|
report: generateReportPath
|
|
2030
2311
|
});
|
|
2031
2312
|
|
|
2313
|
+
await syncStudioProjectChannel(job, 'design', options, {
|
|
2314
|
+
projectPath,
|
|
2315
|
+
fileSystem,
|
|
2316
|
+
sessionStore: dependencies.sessionStore
|
|
2317
|
+
});
|
|
2318
|
+
|
|
2032
2319
|
await saveJob(paths, job, fileSystem);
|
|
2033
2320
|
const generateEvent = await appendStudioEvent(paths, job, 'stage.generate.completed', {
|
|
2034
2321
|
scene_id: sceneId,
|
|
@@ -2046,6 +2333,10 @@ async function runStudioGenerateCommand(options = {}, dependencies = {}) {
|
|
|
2046
2333
|
projectPath,
|
|
2047
2334
|
fileSystem
|
|
2048
2335
|
});
|
|
2336
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2337
|
+
projectPath,
|
|
2338
|
+
fileSystem
|
|
2339
|
+
});
|
|
2049
2340
|
printStudioPayload(payload, options);
|
|
2050
2341
|
return payload;
|
|
2051
2342
|
}
|
|
@@ -2114,6 +2405,12 @@ async function runStudioApplyCommand(options = {}, dependencies = {}) {
|
|
|
2114
2405
|
problem_evaluation: summarizeProblemEvaluation(applyProblemEvaluation)
|
|
2115
2406
|
});
|
|
2116
2407
|
|
|
2408
|
+
await syncStudioProjectChannel(job, 'tasks', options, {
|
|
2409
|
+
projectPath,
|
|
2410
|
+
fileSystem,
|
|
2411
|
+
sessionStore: dependencies.sessionStore
|
|
2412
|
+
});
|
|
2413
|
+
|
|
2117
2414
|
await saveJob(paths, job, fileSystem);
|
|
2118
2415
|
const applyEvent = await appendStudioEvent(paths, job, 'stage.apply.completed', {
|
|
2119
2416
|
patch_bundle_id: patchBundleId,
|
|
@@ -2132,6 +2429,10 @@ async function runStudioApplyCommand(options = {}, dependencies = {}) {
|
|
|
2132
2429
|
projectPath,
|
|
2133
2430
|
fileSystem
|
|
2134
2431
|
});
|
|
2432
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2433
|
+
projectPath,
|
|
2434
|
+
fileSystem
|
|
2435
|
+
});
|
|
2135
2436
|
printStudioPayload(payload, options);
|
|
2136
2437
|
return payload;
|
|
2137
2438
|
}
|
|
@@ -2267,6 +2568,12 @@ async function runStudioVerifyCommand(options = {}, dependencies = {}) {
|
|
|
2267
2568
|
auto_errorbook_records: autoErrorbookRecords
|
|
2268
2569
|
});
|
|
2269
2570
|
|
|
2571
|
+
await syncStudioProjectChannel(job, 'verify', options, {
|
|
2572
|
+
projectPath,
|
|
2573
|
+
fileSystem,
|
|
2574
|
+
sessionStore: dependencies.sessionStore
|
|
2575
|
+
});
|
|
2576
|
+
|
|
2270
2577
|
await saveJob(paths, job, fileSystem);
|
|
2271
2578
|
const verifyEvent = await appendStudioEvent(paths, job, 'stage.verify.completed', {
|
|
2272
2579
|
profile,
|
|
@@ -2284,6 +2591,10 @@ async function runStudioVerifyCommand(options = {}, dependencies = {}) {
|
|
|
2284
2591
|
projectPath,
|
|
2285
2592
|
fileSystem
|
|
2286
2593
|
});
|
|
2594
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2595
|
+
projectPath,
|
|
2596
|
+
fileSystem
|
|
2597
|
+
});
|
|
2287
2598
|
printStudioPayload(payload, options);
|
|
2288
2599
|
return payload;
|
|
2289
2600
|
}
|
|
@@ -2493,6 +2804,11 @@ async function runStudioReleaseCommand(options = {}, dependencies = {}) {
|
|
|
2493
2804
|
scene_cycle: rollover.next_scene_cycle || null,
|
|
2494
2805
|
rolled_over_at: nowIso()
|
|
2495
2806
|
};
|
|
2807
|
+
await syncStudioProjectChannel(job, 'requirements', options, {
|
|
2808
|
+
projectPath,
|
|
2809
|
+
fileSystem,
|
|
2810
|
+
sessionStore
|
|
2811
|
+
});
|
|
2496
2812
|
}
|
|
2497
2813
|
|
|
2498
2814
|
await saveJob(paths, job, fileSystem);
|
|
@@ -2517,6 +2833,10 @@ async function runStudioReleaseCommand(options = {}, dependencies = {}) {
|
|
|
2517
2833
|
projectPath,
|
|
2518
2834
|
fileSystem
|
|
2519
2835
|
});
|
|
2836
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2837
|
+
projectPath,
|
|
2838
|
+
fileSystem
|
|
2839
|
+
});
|
|
2520
2840
|
printStudioPayload(payload, options);
|
|
2521
2841
|
return payload;
|
|
2522
2842
|
}
|
|
@@ -2540,6 +2860,10 @@ async function runStudioResumeCommand(options = {}, dependencies = {}) {
|
|
|
2540
2860
|
projectPath,
|
|
2541
2861
|
fileSystem
|
|
2542
2862
|
});
|
|
2863
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2864
|
+
projectPath,
|
|
2865
|
+
fileSystem
|
|
2866
|
+
});
|
|
2543
2867
|
payload.success = true;
|
|
2544
2868
|
printStudioPayload(payload, options);
|
|
2545
2869
|
return payload;
|
|
@@ -2612,6 +2936,10 @@ async function runStudioRollbackCommand(options = {}, dependencies = {}) {
|
|
|
2612
2936
|
projectPath,
|
|
2613
2937
|
fileSystem
|
|
2614
2938
|
});
|
|
2939
|
+
await attachStudioProjectChannelPayload(payload, job, {
|
|
2940
|
+
projectPath,
|
|
2941
|
+
fileSystem
|
|
2942
|
+
});
|
|
2615
2943
|
payload.rollback = { ...job.rollback };
|
|
2616
2944
|
printStudioPayload(payload, options);
|
|
2617
2945
|
return payload;
|
|
@@ -2684,32 +3012,50 @@ function printStudioIntakePayload(payload, options = {}) {
|
|
|
2684
3012
|
async function runStudioIntakeCommand(options = {}, dependencies = {}) {
|
|
2685
3013
|
const projectPath = dependencies.projectPath || process.cwd();
|
|
2686
3014
|
const fileSystem = dependencies.fileSystem || fs;
|
|
2687
|
-
const
|
|
3015
|
+
const explicitSceneId = normalizeString(options.scene);
|
|
2688
3016
|
const fromChat = normalizeString(options.fromChat);
|
|
2689
3017
|
const goal = normalizeString(options.goal);
|
|
2690
|
-
const
|
|
3018
|
+
const explicitSpecId = normalizeString(options.spec);
|
|
3019
|
+
const channelFocus = await resolveStudioProjectChannelFocus(projectPath, options, dependencies);
|
|
3020
|
+
const sceneId = explicitSceneId || normalizeString(channelFocus && channelFocus.active_scene);
|
|
3021
|
+
const channelFocusedSpecId = normalizeString(channelFocus && channelFocus.active_spec_id);
|
|
3022
|
+
const boundSpecId = explicitSpecId
|
|
3023
|
+
|| (channelFocusedSpecId && await fileSystem.pathExists(path.join(projectPath, '.sce', 'specs', channelFocusedSpecId))
|
|
3024
|
+
? channelFocusedSpecId
|
|
3025
|
+
: '');
|
|
2691
3026
|
|
|
2692
3027
|
if (!sceneId) {
|
|
2693
|
-
throw new Error('--scene is required');
|
|
3028
|
+
throw new Error('--scene is required unless project/channel context can resolve an active scene');
|
|
2694
3029
|
}
|
|
2695
3030
|
if (!fromChat) {
|
|
2696
3031
|
throw new Error('--from-chat is required');
|
|
2697
3032
|
}
|
|
2698
3033
|
|
|
3034
|
+
const supremeAssessment = await assessSupremeIntent({
|
|
3035
|
+
text: goal,
|
|
3036
|
+
source_kind: 'studio-intake',
|
|
3037
|
+
scene_id: sceneId,
|
|
3038
|
+
spec_id: boundSpecId || null
|
|
3039
|
+
}, {
|
|
3040
|
+
projectPath,
|
|
3041
|
+
fileSystem
|
|
3042
|
+
});
|
|
3043
|
+
const governedGoal = normalizeString(supremeAssessment.effective_text) || goal;
|
|
3044
|
+
|
|
2699
3045
|
const domainChainBinding = await resolveDomainChainBinding({
|
|
2700
3046
|
sceneId,
|
|
2701
|
-
specId,
|
|
2702
|
-
goal
|
|
3047
|
+
specId: boundSpecId,
|
|
3048
|
+
goal: governedGoal
|
|
2703
3049
|
}, {
|
|
2704
3050
|
projectPath,
|
|
2705
3051
|
fileSystem
|
|
2706
3052
|
});
|
|
2707
3053
|
|
|
2708
3054
|
const relatedSpecLookup = await findRelatedSpecs({
|
|
2709
|
-
query:
|
|
3055
|
+
query: governedGoal,
|
|
2710
3056
|
sceneId,
|
|
2711
3057
|
limit: 8,
|
|
2712
|
-
excludeSpecId: domainChainBinding.spec_id ||
|
|
3058
|
+
excludeSpecId: domainChainBinding.spec_id || boundSpecId || null
|
|
2713
3059
|
}, {
|
|
2714
3060
|
projectPath,
|
|
2715
3061
|
fileSystem
|
|
@@ -2718,19 +3064,46 @@ async function runStudioIntakeCommand(options = {}, dependencies = {}) {
|
|
|
2718
3064
|
const intake = await runStudioAutoIntake({
|
|
2719
3065
|
scene_id: sceneId,
|
|
2720
3066
|
from_chat: fromChat,
|
|
2721
|
-
goal,
|
|
2722
|
-
explicit_spec_id:
|
|
3067
|
+
goal: governedGoal,
|
|
3068
|
+
explicit_spec_id: explicitSpecId,
|
|
2723
3069
|
domain_chain_binding: domainChainBinding,
|
|
2724
3070
|
related_specs: relatedSpecLookup,
|
|
3071
|
+
supreme_principles: supremeAssessment,
|
|
2725
3072
|
apply: options.apply === true,
|
|
2726
3073
|
skip: options.manualSpec === true
|
|
2727
3074
|
}, {
|
|
2728
3075
|
projectPath,
|
|
2729
3076
|
fileSystem
|
|
2730
3077
|
});
|
|
3078
|
+
const supremeEvidence = intake && intake.selected_spec_id
|
|
3079
|
+
? await writeSupremeIntentEvidence(projectPath, intake.selected_spec_id, {
|
|
3080
|
+
...supremeAssessment,
|
|
3081
|
+
source_kind: 'studio-intake',
|
|
3082
|
+
spec_id: intake.selected_spec_id
|
|
3083
|
+
}, {
|
|
3084
|
+
fileSystem
|
|
3085
|
+
})
|
|
3086
|
+
: null;
|
|
3087
|
+
const supremeLedgerEntry = await persistStudioSupremeIntentAssessment(projectPath, options, supremeAssessment, {
|
|
3088
|
+
scene_id: sceneId,
|
|
3089
|
+
spec_id: intake && intake.selected_spec_id ? intake.selected_spec_id : (boundSpecId || null),
|
|
3090
|
+
source_kind: 'studio-intake',
|
|
3091
|
+
evidence_path: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
3092
|
+
metadata: {
|
|
3093
|
+
original_goal: goal || null,
|
|
3094
|
+
effective_goal: governedGoal || null,
|
|
3095
|
+
intake_action: intake && intake.decision ? intake.decision.action : null,
|
|
3096
|
+
intake_reason: intake && intake.decision ? intake.decision.reason : null,
|
|
3097
|
+
related_specs_total: Number(relatedSpecLookup.total_candidates || 0)
|
|
3098
|
+
}
|
|
3099
|
+
}, dependencies);
|
|
2731
3100
|
|
|
2732
3101
|
const payload = {
|
|
2733
3102
|
...intake,
|
|
3103
|
+
original_goal: goal || null,
|
|
3104
|
+
supreme_principles: supremeAssessment,
|
|
3105
|
+
supreme_intent_record: supremeLedgerEntry || null,
|
|
3106
|
+
supreme_intent_evidence: supremeEvidence ? supremeEvidence.relative_path : null,
|
|
2734
3107
|
domain_chain_source: domainChainBinding.source || 'none',
|
|
2735
3108
|
domain_chain_spec_id: domainChainBinding.spec_id || null,
|
|
2736
3109
|
related_specs_total: Number(relatedSpecLookup.total_candidates || 0)
|
|
@@ -2852,8 +3225,10 @@ function registerStudioCommands(program) {
|
|
|
2852
3225
|
studio
|
|
2853
3226
|
.command('plan')
|
|
2854
3227
|
.description('Create/refresh a studio plan job from chat context')
|
|
2855
|
-
.
|
|
3228
|
+
.option('--scene <scene-id>', 'Scene identifier (defaults to current project/channel focus when resolvable)')
|
|
2856
3229
|
.requiredOption('--from-chat <session>', 'Chat session identifier or transcript reference')
|
|
3230
|
+
.option('--project-id <project-id>', 'Explicit project id for project + channel/session binding')
|
|
3231
|
+
.option('--collab-channel <channel-id>', 'Explicit collaboration channel id (defaults to --from-chat)')
|
|
2857
3232
|
.option('--spec <spec-id>', 'Optional spec binding for domain-chain context ingestion')
|
|
2858
3233
|
.option('--goal <goal>', 'Optional goal summary')
|
|
2859
3234
|
.option('--manual-spec', 'Legacy bypass flag (disabled by default policy)')
|
|
@@ -2866,7 +3241,7 @@ function registerStudioCommands(program) {
|
|
|
2866
3241
|
studio
|
|
2867
3242
|
.command('intake')
|
|
2868
3243
|
.description('Analyze chat goal and auto-resolve spec binding/create decision')
|
|
2869
|
-
.
|
|
3244
|
+
.option('--scene <scene-id>', 'Scene identifier (defaults to current project/channel focus when resolvable)')
|
|
2870
3245
|
.requiredOption('--from-chat <session>', 'Chat session identifier or transcript reference')
|
|
2871
3246
|
.option('--spec <spec-id>', 'Optional explicit spec id')
|
|
2872
3247
|
.option('--goal <goal>', 'Goal text used for intent classification')
|