@tiinex/core 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/src/schemas/creation.contracts.js +1 -1
- package/src/schemas/party/role/tiinex.party.role.v1.schema.js +5 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.json +2 -2
- package/src/schemas/party/role/tiinex.party.role.v1.schema.md +313 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.runtime.json +18 -6
- package/src/schemas/party/role/tiinex.party.role.v1.validate.js +36 -0
- package/src/schemas/schema.reference.js +29 -0
- package/src/tooling/portable/adapters/cli/cli.common-author.js +117 -6
- package/src/tooling/portable/adapters/cli/cli.common-output.js +19 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.js +26 -4
- package/src/tooling/portable/adapters/node/handoff.manufacture.packageParent.js +123 -0
- package/src/tooling/portable/audit/audit.capability.js +10 -4
- package/src/tooling/portable/grounding/grounding.capsule.js +26 -2
- package/src/tooling/portable/grounding/grounding.delegationArtifactAuthority.js +220 -0
- package/src/tooling/portable/grounding/grounding.delegationReadiness.js +241 -0
- package/src/tooling/portable/grounding/grounding.holderAssignmentModes.js +125 -0
- package/src/tooling/portable/grounding/grounding.holderBindingAuthorization.js +49 -50
- package/src/tooling/portable/grounding/grounding.readiness.js +19 -3
- package/src/tooling/portable/grounding/grounding.readiness.support.js +1 -1
- package/src/tooling/portable/handoff/carrierProjection.routeQualification.js +20 -4
- package/src/tooling/portable/handoff/coldStartQualification.grounding.js +55 -3
- package/src/tooling/portable/handoff/coldStartQualification.materials.js +84 -10
- package/src/tooling/portable/handoff/recipientV2.endpointRolePointers.js +1 -1
- package/src/tooling/portable/handoff/recipientV2.inspect.projection.js +5 -2
- package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +2 -2
- package/src/tooling/portable/handoff/recipientV2.topology.js +5 -3
- package/src/tooling/portable/handoff/recipientV2.topology.materials.js +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { sha256Hex } from '../../../export/package.bytes.js';
|
|
3
|
+
|
|
4
|
+
export function projectGroundingDelegationArtifactAuthority({ authority = null, records = [], topology = {}, sourceEvidence = null } = {}) {
|
|
5
|
+
const unresolved = [];
|
|
6
|
+
const handoff = authority?.handoff || null;
|
|
7
|
+
const recipientRole = authority?.role || null;
|
|
8
|
+
const senderRole = authority?.senderRole || null;
|
|
9
|
+
if (!handoff || String(handoff.schemaId || '') !== 'tiinex.handoff.v1') return empty('selected-qualified-handoff-not-established');
|
|
10
|
+
|
|
11
|
+
const transferSelection = selectControllingTransfer(handoff, records, topology);
|
|
12
|
+
if (!transferSelection) unresolved.push('forward-controlling-transfer-not-established');
|
|
13
|
+
const recipient = qualifiedRole(recipientRole, handoff.toReference || '');
|
|
14
|
+
if (!recipient) unresolved.push('exact-recipient-role-authority-not-established');
|
|
15
|
+
const sender = qualifiedRole(senderRole, handoff.fromReference || '');
|
|
16
|
+
if (!sender) unresolved.push('exact-sender-role-authority-not-established');
|
|
17
|
+
|
|
18
|
+
const taskRecord = transferSelection?.record || null;
|
|
19
|
+
const targetWorkspaceId = String(taskRecord?.path || '').split('/')[0] || '';
|
|
20
|
+
const workspaceSource = (sourceEvidence?.workspaces || []).find((item) => String(item.workspace || '') === targetWorkspaceId && ['qualified', 'explicit-profile'].includes(String(item.state || ''))) || null;
|
|
21
|
+
if (!workspaceSource?.repository) unresolved.push('exact-target-repository-authority-not-established');
|
|
22
|
+
|
|
23
|
+
const delegateCapabilityAuthority = recipient && transferSelection ? delegateProjection(recipient, handoff, transferSelection) : null;
|
|
24
|
+
if (!delegateCapabilityAuthority) unresolved.push('delegate-capability-artifact-projection-not-established');
|
|
25
|
+
|
|
26
|
+
const processApplicability = sender && transferSelection ? processProjection(sender, handoff, transferSelection) : null;
|
|
27
|
+
if (!processApplicability) unresolved.push('delegation-applicability-artifact-projection-not-established');
|
|
28
|
+
|
|
29
|
+
const delegationTargetAuthority = taskRecord && workspaceSource && transferSelection
|
|
30
|
+
? targetProjection(taskRecord, workspaceSource, handoff, transferSelection)
|
|
31
|
+
: null;
|
|
32
|
+
if (!delegationTargetAuthority) unresolved.push('delegation-target-artifact-projection-not-established');
|
|
33
|
+
|
|
34
|
+
const implementationSourceAuthority = taskRecord && recipient && transferSelection
|
|
35
|
+
? sourceProjection(taskRecord, recipient, handoff, transferSelection)
|
|
36
|
+
: null;
|
|
37
|
+
if (!implementationSourceAuthority) unresolved.push('implementation-source-artifact-projection-not-established');
|
|
38
|
+
|
|
39
|
+
const delegationReturnReconciliationExpectation = transferSelection
|
|
40
|
+
? returnProjection(handoff, transferSelection)
|
|
41
|
+
: null;
|
|
42
|
+
if (!delegationReturnReconciliationExpectation) unresolved.push('return-reconciliation-artifact-projection-not-established');
|
|
43
|
+
|
|
44
|
+
const ready = Boolean(delegateCapabilityAuthority && processApplicability && delegationTargetAuthority && implementationSourceAuthority && delegationReturnReconciliationExpectation);
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
state: ready ? 'qualified-forward-artifact-closure' : 'not-established',
|
|
47
|
+
delegateCapabilityAuthority,
|
|
48
|
+
processApplicability,
|
|
49
|
+
delegationTargetAuthority,
|
|
50
|
+
implementationSourceAuthority,
|
|
51
|
+
delegationReturnReconciliationExpectation,
|
|
52
|
+
unresolved: Object.freeze([...new Set(unresolved)].map((code) => Object.freeze({ code }))),
|
|
53
|
+
provenance: Object.freeze({
|
|
54
|
+
basis: 'exact-qualified-forward-selected-artifact-chain',
|
|
55
|
+
selectedHandoff: sourceArtifactFromHandoff(handoff),
|
|
56
|
+
controllingTask: taskRecord ? sourceArtifactFromRecord(taskRecord) : null,
|
|
57
|
+
senderRole: sender ? sender.sourceArtifact : null,
|
|
58
|
+
recipientRole: recipient ? recipient.sourceArtifact : null,
|
|
59
|
+
boundary: 'Projection only. Exact Handoff transfer, exact endpoint Role authority, exact controlling Task and exact Workspace source identity are composed mechanically; Role/cache inventory, filenames, adjacency and arbitrary prose are never searched for delegation meaning.'
|
|
60
|
+
}),
|
|
61
|
+
boundary: 'Artifact-derived delegation closure is available only from the exact selected forward chain. It does not select a delegate, invent a process, create source permission, or treat an endpoint alone as delegation authority.'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function selectControllingTransfer(handoff, records, topology) {
|
|
66
|
+
const handoffPath = qualifiedHandoffPath(handoff);
|
|
67
|
+
const frontierPaths = new Set((topology?.currentFrontier || []).flatMap((item) => [String(item.path || ''), String(item.resolvedPath || '')]).filter(Boolean));
|
|
68
|
+
const candidates = [];
|
|
69
|
+
for (const transfer of handoff.transfers || []) {
|
|
70
|
+
const target = String(transfer.controllingArtifactTarget || '').trim();
|
|
71
|
+
if (!target) continue;
|
|
72
|
+
const resolved = resolveReference(target, handoffPath);
|
|
73
|
+
if (!resolved) continue;
|
|
74
|
+
const matches = (records || []).filter((record) => String(record.path || '') === resolved && String(record.schemaId || '') === 'tiinex.task.v1' && record.hasContinuityContext && record.hasIntegrity);
|
|
75
|
+
if (matches.length !== 1) continue;
|
|
76
|
+
if (frontierPaths.size && !frontierPaths.has(resolved) && !frontierPaths.has(String(matches[0].id || ''))) continue;
|
|
77
|
+
candidates.push(Object.freeze({ transfer, record: matches[0], resolvedPath: resolved }));
|
|
78
|
+
}
|
|
79
|
+
return candidates.length === 1 ? candidates[0] : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function qualifiedRole(role, declaredReference = '') {
|
|
83
|
+
const artifact = role?.material?.artifact || null;
|
|
84
|
+
if (String(role?.state || '') !== 'qualified' || String(role?.material?.state || '') !== 'qualified' || !artifact) return null;
|
|
85
|
+
const sha256 = String(artifact.sha256 || '').trim().toLowerCase();
|
|
86
|
+
if (!/^[0-9a-f]{64}$/i.test(sha256)) return null;
|
|
87
|
+
const reference = String(artifact.reference || declaredReference || '').trim();
|
|
88
|
+
if (!reference) return null;
|
|
89
|
+
return Object.freeze({
|
|
90
|
+
label: String(role?.endpoint?.label || artifact.roleLabel || ''),
|
|
91
|
+
kind: String(role?.endpoint?.kind || 'role'),
|
|
92
|
+
roleKind: String(artifact.roleKind || ''),
|
|
93
|
+
boundary: Object.freeze({ ...(role.exactBoundaryLoaded || {}) }),
|
|
94
|
+
authority: Object.freeze({ ...(role.authorityBoundaryLoaded || {}) }),
|
|
95
|
+
sourceArtifact: sourceArtifactFromReference(reference, sha256, String(artifact.schemaId || 'tiinex.party.role.v1'))
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function delegateProjection(role, handoff, selected) {
|
|
100
|
+
const capabilities = [
|
|
101
|
+
role.roleKind ? Object.freeze({ kind: 'role-kind', value: role.roleKind }) : null,
|
|
102
|
+
role.boundary.inScope ? Object.freeze({ kind: 'role-in-scope', value: role.boundary.inScope }) : null,
|
|
103
|
+
role.authority.mayDo ? Object.freeze({ kind: 'role-may-do', value: role.authority.mayDo }) : null
|
|
104
|
+
].filter(Boolean);
|
|
105
|
+
if (!role.label || !capabilities.length) return null;
|
|
106
|
+
return Object.freeze({
|
|
107
|
+
explicit: true,
|
|
108
|
+
qualification: 'qualified',
|
|
109
|
+
delegate: Object.freeze({ label: role.label, kind: role.kind || 'role' }),
|
|
110
|
+
capabilities: Object.freeze(capabilities),
|
|
111
|
+
selection: Object.freeze({ state: 'explicit-forward-selected', forwardSelected: true }),
|
|
112
|
+
sourceArtifact: role.sourceArtifact,
|
|
113
|
+
facts: Object.freeze([
|
|
114
|
+
Object.freeze({ kind: 'selected-handoff-transfer', handoff: qualifiedHandoffPath(handoff), transferId: String(selected.transfer.id || ''), transferKind: String(selected.transfer.transferKind || ''), controllingArtifact: selected.resolvedPath }),
|
|
115
|
+
Object.freeze({ kind: 'exact-recipient-role-authority', role: role.label, roleKind: role.roleKind })
|
|
116
|
+
]),
|
|
117
|
+
provenance: Object.freeze({ source: role.sourceArtifact.path, basis: 'selected-handoff-transfer-to-exact-recipient-role-and-controlling-task', forwardSelector: Object.freeze({ handoff: qualifiedHandoffPath(handoff), transferId: String(selected.transfer.id || ''), controllingArtifact: selected.resolvedPath }) })
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function processProjection(role, handoff, selected) {
|
|
122
|
+
const facts = [
|
|
123
|
+
role.authority.delegation ? Object.freeze({ kind: 'sender-role-delegation', value: role.authority.delegation }) : null,
|
|
124
|
+
role.authority.requiredInstrument ? Object.freeze({ kind: 'sender-role-required-instrument', value: role.authority.requiredInstrument }) : null,
|
|
125
|
+
role.authority.mayDo ? Object.freeze({ kind: 'sender-role-may-do', value: role.authority.mayDo }) : null,
|
|
126
|
+
Object.freeze({ kind: 'selected-handoff-work-transfer', transferId: String(selected.transfer.id || ''), transferKind: String(selected.transfer.transferKind || ''), controllingArtifact: selected.resolvedPath })
|
|
127
|
+
].filter(Boolean);
|
|
128
|
+
if (facts.length < 2) return null;
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
explicit: true,
|
|
131
|
+
qualification: 'qualified',
|
|
132
|
+
facts: Object.freeze(facts),
|
|
133
|
+
source: role.sourceArtifact.path,
|
|
134
|
+
provenance: Object.freeze({ source: role.sourceArtifact.path, sourceArtifact: role.sourceArtifact, basis: 'exact-sender-role-authority-plus-selected-handoff-work-transfer', forwardSelector: Object.freeze({ handoff: qualifiedHandoffPath(handoff), transferId: String(selected.transfer.id || '') }) })
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function targetProjection(taskRecord, workspaceSource, handoff, selected) {
|
|
139
|
+
const workspaceId = String(taskRecord.path || '').split('/')[0];
|
|
140
|
+
const relativeTask = String(taskRecord.path || '').slice(workspaceId.length + 1);
|
|
141
|
+
const relativeHandoff = String(handoff.workspaceRelativePath || '').replace(/^\/+/, '');
|
|
142
|
+
return Object.freeze({
|
|
143
|
+
explicit: true,
|
|
144
|
+
qualification: 'qualified',
|
|
145
|
+
target: Object.freeze({
|
|
146
|
+
workspaceId,
|
|
147
|
+
repository: String(workspaceSource.repository || ''),
|
|
148
|
+
rootPath: String(workspaceSource.rootPath || ''),
|
|
149
|
+
taskDirectory: posix.dirname(relativeTask),
|
|
150
|
+
handoffDirectory: posix.dirname(relativeHandoff)
|
|
151
|
+
}),
|
|
152
|
+
sourceArtifact: sourceArtifactFromRecord(taskRecord),
|
|
153
|
+
facts: Object.freeze([
|
|
154
|
+
Object.freeze({ kind: 'controlling-task-placement', path: String(taskRecord.path || '') }),
|
|
155
|
+
Object.freeze({ kind: 'workspace-source-identity', workspaceId, repository: String(workspaceSource.repository || ''), rootPath: String(workspaceSource.rootPath || '') })
|
|
156
|
+
]),
|
|
157
|
+
provenance: Object.freeze({ source: String(taskRecord.path || ''), basis: 'exact-controlling-task-plus-qualified-workspace-source-identity', forwardSelector: Object.freeze({ handoff: qualifiedHandoffPath(handoff), transferId: String(selected.transfer.id || '') }) })
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function sourceProjection(taskRecord, role, handoff, selected) {
|
|
162
|
+
const scope = section(taskRecord.markdown || '', 'Scope');
|
|
163
|
+
const facts = [
|
|
164
|
+
scope ? Object.freeze({ kind: 'controlling-task-scope', value: scope }) : null,
|
|
165
|
+
role.authority.mayDo ? Object.freeze({ kind: 'recipient-role-may-do', value: role.authority.mayDo }) : null,
|
|
166
|
+
role.authority.requiredInstrument ? Object.freeze({ kind: 'recipient-role-required-instrument', value: role.authority.requiredInstrument }) : null,
|
|
167
|
+
Object.freeze({ kind: 'selected-handoff-work-transfer', transferId: String(selected.transfer.id || ''), transferKind: String(selected.transfer.transferKind || ''), controllingArtifact: selected.resolvedPath })
|
|
168
|
+
].filter(Boolean);
|
|
169
|
+
if (!scope || !role.authority.mayDo) return null;
|
|
170
|
+
return Object.freeze({
|
|
171
|
+
explicit: true,
|
|
172
|
+
qualification: 'qualified',
|
|
173
|
+
sourceArtifact: sourceArtifactFromRecord(taskRecord),
|
|
174
|
+
facts: Object.freeze(facts),
|
|
175
|
+
provenance: Object.freeze({ source: String(taskRecord.path || ''), basis: 'exact-controlling-task-scope-plus-recipient-role-authority-plus-selected-transfer', forwardSelector: Object.freeze({ handoff: qualifiedHandoffPath(handoff), transferId: String(selected.transfer.id || '') }), recipientRoleSourceArtifact: role.sourceArtifact })
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function returnProjection(handoff, selected) {
|
|
180
|
+
const completion = handoff.completionExpectation || {};
|
|
181
|
+
const returnTo = String(completion.returnTo || '').trim();
|
|
182
|
+
const retained = (handoff.retainedResponsibilities || []).filter((item) => normalize(item.retainedBy) === normalize(returnTo));
|
|
183
|
+
if (!completion.signalKind || !completion.signalMeaning || !returnTo || retained.length !== 1) return null;
|
|
184
|
+
return Object.freeze({
|
|
185
|
+
explicit: true,
|
|
186
|
+
qualification: 'qualified',
|
|
187
|
+
completionExpectation: Object.freeze({ signalKind: String(completion.signalKind), signalMeaning: String(completion.signalMeaning), returnTo }),
|
|
188
|
+
reconciliation: Object.freeze({ state: 'retained-by-return-target', expectation: String(retained[0].responsibility || '') }),
|
|
189
|
+
sourceArtifact: sourceArtifactFromHandoff(handoff),
|
|
190
|
+
facts: Object.freeze([
|
|
191
|
+
Object.freeze({ kind: 'selected-handoff-completion-expectation', signalKind: String(completion.signalKind), returnTo }),
|
|
192
|
+
Object.freeze({ kind: 'return-target-retained-responsibility', id: String(retained[0].id || ''), retainedBy: returnTo, responsibility: String(retained[0].responsibility || '') })
|
|
193
|
+
]),
|
|
194
|
+
provenance: Object.freeze({ source: qualifiedHandoffPath(handoff), basis: 'exact-selected-handoff-completion-plus-return-target-retained-responsibility', forwardSelector: Object.freeze({ transferId: String(selected.transfer.id || ''), controllingArtifact: selected.resolvedPath }) })
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function sourceArtifactFromRecord(record) {
|
|
199
|
+
return Object.freeze({ workspaceId: String(record.path || '').split('/')[0] || '', path: String(record.path || ''), sha256: sha256(record.markdown || ''), schemaId: String(record.schemaId || '') });
|
|
200
|
+
}
|
|
201
|
+
function sourceArtifactFromHandoff(handoff) {
|
|
202
|
+
return Object.freeze({ workspaceId: String(handoff.workspaceId || ''), path: qualifiedHandoffPath(handoff), sha256: String(handoff.sha256 || '').trim().toLowerCase(), schemaId: String(handoff.schemaId || 'tiinex.handoff.v1') });
|
|
203
|
+
}
|
|
204
|
+
function sourceArtifactFromReference(reference, sha, schemaId) {
|
|
205
|
+
const raw = String(reference || '').trim();
|
|
206
|
+
const cross = raw.match(/^([^:/\\]+)::(.+)$/);
|
|
207
|
+
return Object.freeze({ workspaceId: cross ? cross[1] : '', path: raw, sha256: String(sha || '').toLowerCase(), schemaId: String(schemaId || '') });
|
|
208
|
+
}
|
|
209
|
+
function qualifiedHandoffPath(handoff) { return [String(handoff.workspaceId || ''), String(handoff.workspaceRelativePath || '').replace(/^\/+/, '')].filter(Boolean).join('/'); }
|
|
210
|
+
function resolveReference(reference, ownerPath) {
|
|
211
|
+
const raw = String(reference || '').split('#')[0].trim().replace(/\\/g, '/');
|
|
212
|
+
const cross = raw.match(/^([^:/\\]+)::(.+)$/);
|
|
213
|
+
const candidate = cross ? `${cross[1]}/${cross[2].replace(/^\/+/, '')}` : raw.startsWith('/') ? raw.slice(1) : posix.join(posix.dirname(ownerPath), raw);
|
|
214
|
+
const normalized = posix.normalize(candidate).replace(/^\.\//, '');
|
|
215
|
+
return !normalized || normalized === '..' || normalized.startsWith('../') ? '' : normalized;
|
|
216
|
+
}
|
|
217
|
+
function section(markdown = '', heading = '') { const escaped = String(heading || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); return String(markdown || '').match(new RegExp(`(?:^|\\n)##\\s+${escaped}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+Continuity Integrity|$)`, 'i'))?.[1]?.trim() || ''; }
|
|
218
|
+
function sha256(markdown) { return sha256Hex(new TextEncoder().encode(String(markdown || ''))); }
|
|
219
|
+
function normalize(value) { return String(value || '').trim().toLowerCase(); }
|
|
220
|
+
function empty(code) { return Object.freeze({ state: 'not-established', delegateCapabilityAuthority: null, processApplicability: null, delegationTargetAuthority: null, implementationSourceAuthority: null, delegationReturnReconciliationExpectation: null, unresolved: Object.freeze([Object.freeze({ code })]), provenance: null, boundary: 'No exact selected qualified Handoff authority was available for artifact-derived delegation projection.' }); }
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const MAX_CAPABILITIES = 12;
|
|
2
|
+
const MAX_FACTS = 12;
|
|
3
|
+
|
|
4
|
+
export function projectGroundingDelegationReadiness({ authority = null, processApplicability = null, implementationSourceAuthority = null } = {}) {
|
|
5
|
+
const delegateCapabilityAuthority = projectDelegateCapabilityAuthority(authority?.delegateCapabilityAuthority || authority?.delegationContext?.delegateCapabilityAuthority || null);
|
|
6
|
+
const targetAuthority = projectDelegationTargetAuthority(authority?.delegationTargetAuthority || authority?.delegationContext?.targetAuthority || authority?.delegationContext?.delegationTargetAuthority || null);
|
|
7
|
+
const returnReconciliationExpectation = projectDelegationReturnReconciliationExpectation(authority?.delegationReturnReconciliationExpectation || authority?.delegationContext?.returnReconciliationExpectation || authority?.delegationContext?.delegationReturnReconciliationExpectation || null);
|
|
8
|
+
const process = processApplicability || Object.freeze({ state: 'not-established', unresolved: Object.freeze([]) });
|
|
9
|
+
const source = implementationSourceAuthority || Object.freeze({ state: 'unresolved', unresolved: Object.freeze([]) });
|
|
10
|
+
const blockers = [];
|
|
11
|
+
|
|
12
|
+
if (delegateCapabilityAuthority.state !== 'explicit-qualified-forward-selection') blockers.push(blocker(
|
|
13
|
+
'delegate-capability-authority-not-established',
|
|
14
|
+
delegateCapabilityAuthority.unresolved?.[0]?.detail || 'No explicit upstream-qualified forward-selected delegate/capability authority is established.',
|
|
15
|
+
'Provide an explicit upstream-qualified forward-selected delegate/capability projection with exact source-artifact identity. Cached Role presence, participant inventory, Handoff endpoint labels, filenames and chat position are not delegate selection authority.'
|
|
16
|
+
));
|
|
17
|
+
const processReady = String(process.state || '') === 'explicit-qualified-authority' && Array.isArray(process.facts) && process.facts.length > 0 && Boolean(String(process.provenance?.source || process.provenance?.upstreamProvenance?.source || '').trim());
|
|
18
|
+
if (!processReady) blockers.push(blocker(
|
|
19
|
+
'delegation-process-applicability-not-established',
|
|
20
|
+
process.unresolved?.[0]?.detail || 'Delegation/process applicability is not explicitly established by upstream semantic authority.',
|
|
21
|
+
'Provide the explicit upstream-qualified process/delegation applicability projection. Do not infer applicability from Role/cache inventory or repository adjacency.'
|
|
22
|
+
));
|
|
23
|
+
if (targetAuthority.state !== 'explicit-qualified-target-authority') blockers.push(blocker(
|
|
24
|
+
'delegation-target-authority-not-established',
|
|
25
|
+
targetAuthority.unresolved?.[0]?.detail || 'Target repository/workspace authority and repo-local Task/Handoff placement are not explicitly established.',
|
|
26
|
+
'Provide an explicit upstream-qualified delegation target projection naming repository, workspaceId, taskDirectory and handoffDirectory with exact source-artifact identity.'
|
|
27
|
+
));
|
|
28
|
+
const sourceReady = String(source.state || '') === 'explicit-qualified-upstream-projection' && Array.isArray(source.facts) && source.facts.length > 0;
|
|
29
|
+
if (!sourceReady) blockers.push(blocker(
|
|
30
|
+
'delegation-source-authority-not-established',
|
|
31
|
+
source.unresolved?.[0]?.detail || 'Implementation/source authority is not explicitly established by upstream semantic authority.',
|
|
32
|
+
'Provide the exact upstream-qualified implementation-source authority projection. Workspace carriage, writability text, repository identity and executable Task presence remain descriptive only.'
|
|
33
|
+
));
|
|
34
|
+
if (returnReconciliationExpectation.state !== 'explicit-qualified-return-reconciliation') blockers.push(blocker(
|
|
35
|
+
'delegation-return-reconciliation-expectation-not-established',
|
|
36
|
+
returnReconciliationExpectation.unresolved?.[0]?.detail || 'Return/reconciliation responsibility is not explicitly established.',
|
|
37
|
+
'Provide an explicit upstream-qualified return/reconciliation projection with Completion Expectation and an explicit reconciliation state/expectation.'
|
|
38
|
+
));
|
|
39
|
+
|
|
40
|
+
const ready = blockers.length === 0;
|
|
41
|
+
return Object.freeze({
|
|
42
|
+
state: ready ? 'qualified-for-delegation-authoring' : 'not-established',
|
|
43
|
+
delegateCapabilityAuthority,
|
|
44
|
+
processApplicability: process,
|
|
45
|
+
targetAuthority,
|
|
46
|
+
sourceAuthority: source,
|
|
47
|
+
returnReconciliationExpectation,
|
|
48
|
+
blockers: Object.freeze(blockers),
|
|
49
|
+
plainChatFallbackPermitted: false,
|
|
50
|
+
repositoryScanningFallbackPermitted: false,
|
|
51
|
+
nextOperations: ready ? projectNextOperations({ delegateCapabilityAuthority, targetAuthority, returnReconciliationExpectation }) : Object.freeze([]),
|
|
52
|
+
boundary: 'Mechanical delegation qualification only. Core consumes already-explicit, already-qualified semantic projections and exposes the normal Task -> Handoff -> carrier Tooling path; it never selects a delegate, invents process applicability, generates a work plan, grants source authority, or treats cached Role presence as delegation authority.'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function projectDelegateCapabilityAuthority(value = null) {
|
|
57
|
+
const base = qualifyExplicitProjection(value);
|
|
58
|
+
if (!base.qualified) return unresolvedProjection('delegate-capability-authority-not-established', 'No exact upstream-qualified explicit delegate/capability projection is present.');
|
|
59
|
+
const delegate = value?.delegate || value?.selectedDelegate || {};
|
|
60
|
+
const label = String(delegate.label || delegate.roleLabel || value?.delegateLabel || '').trim();
|
|
61
|
+
const kind = String(delegate.kind || value?.delegateKind || 'role').trim();
|
|
62
|
+
const capabilities = Array.isArray(value?.capabilities) ? value.capabilities : Array.isArray(delegate.capabilities) ? delegate.capabilities : [];
|
|
63
|
+
const selectionState = String(value?.selection?.state || value?.selectionState || '').trim().toLowerCase();
|
|
64
|
+
const forwardSelected = value?.selection?.forwardSelected === true || value?.forwardSelected === true || ['forward-selected', 'explicit-forward-selected'].includes(selectionState);
|
|
65
|
+
if (!label || !capabilities.length || !forwardSelected) return unresolvedProjection(
|
|
66
|
+
'delegate-capability-authority-incomplete',
|
|
67
|
+
'The upstream delegate/capability projection is marked qualified but does not expose one explicit forward-selected delegate label plus at least one capability.'
|
|
68
|
+
);
|
|
69
|
+
return Object.freeze({
|
|
70
|
+
state: 'explicit-qualified-forward-selection',
|
|
71
|
+
delegate: Object.freeze({ label, kind }),
|
|
72
|
+
capabilities: Object.freeze(capabilities.slice(0, MAX_CAPABILITIES).map((item) => freezeValue(item))),
|
|
73
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
74
|
+
facts: Object.freeze(projectFacts(value)),
|
|
75
|
+
provenance: Object.freeze({
|
|
76
|
+
basis: 'exact-upstream-qualified-forward-selected-delegate-capability-projection',
|
|
77
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
78
|
+
upstreamProvenance: value?.provenance ? Object.freeze({ ...(value.provenance || {}) }) : null,
|
|
79
|
+
boundary: 'Delegate relevance/capability is passed through from explicit upstream authority. Core does not select a Role from cache or participant inventory.'
|
|
80
|
+
}),
|
|
81
|
+
unresolved: Object.freeze([]),
|
|
82
|
+
boundary: 'Forward selection is semantic input, not a Role-discovery result.'
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function projectDelegationTargetAuthority(value = null) {
|
|
87
|
+
const base = qualifyExplicitProjection(value);
|
|
88
|
+
if (!base.qualified) return unresolvedProjection('delegation-target-authority-not-established', 'No exact upstream-qualified delegation target projection is present.');
|
|
89
|
+
const target = value?.target || value?.placement || {};
|
|
90
|
+
const workspaceId = String(target.workspaceId || value?.workspaceId || '').trim();
|
|
91
|
+
const repository = String(target.repository || value?.repository || '').trim();
|
|
92
|
+
const taskDirectory = normalizeDirectory(target.taskDirectory || value?.taskDirectory || '');
|
|
93
|
+
const handoffDirectory = normalizeDirectory(target.handoffDirectory || value?.handoffDirectory || '');
|
|
94
|
+
if (!workspaceId || !repository || !taskDirectory || !handoffDirectory) return unresolvedProjection(
|
|
95
|
+
'delegation-target-authority-incomplete',
|
|
96
|
+
'The upstream delegation target projection is marked qualified but does not expose repository, workspaceId, taskDirectory and handoffDirectory.'
|
|
97
|
+
);
|
|
98
|
+
return Object.freeze({
|
|
99
|
+
state: 'explicit-qualified-target-authority',
|
|
100
|
+
target: Object.freeze({ workspaceId, repository, taskDirectory, handoffDirectory, rootPath: String(target.rootPath || value?.rootPath || '').trim() }),
|
|
101
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
102
|
+
facts: Object.freeze(projectFacts(value)),
|
|
103
|
+
provenance: Object.freeze({
|
|
104
|
+
basis: 'exact-upstream-qualified-delegation-target-projection',
|
|
105
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
106
|
+
upstreamProvenance: value?.provenance ? Object.freeze({ ...(value.provenance || {}) }) : null,
|
|
107
|
+
boundary: 'Repository/Workspace identity and repo-local Task/Handoff placement are passed through from upstream authority; Core does not discover or choose a repository.'
|
|
108
|
+
}),
|
|
109
|
+
unresolved: Object.freeze([]),
|
|
110
|
+
boundary: 'Target placement is explicit authority input only; source mutation permission is separate.'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function projectDelegationReturnReconciliationExpectation(value = null) {
|
|
115
|
+
const base = qualifyExplicitProjection(value);
|
|
116
|
+
if (!base.qualified) return unresolvedProjection('delegation-return-reconciliation-expectation-not-established', 'No exact upstream-qualified return/reconciliation projection is present.');
|
|
117
|
+
const completion = value?.completionExpectation || value?.returnExpectation || {};
|
|
118
|
+
const signalKind = String(completion.signalKind || '').trim();
|
|
119
|
+
const signalMeaning = String(completion.signalMeaning || '').trim();
|
|
120
|
+
const returnTo = String(completion.returnTo || '').trim();
|
|
121
|
+
const reconciliation = normalizeReconciliation(value?.reconciliation || value?.reconciliationExpectation || null);
|
|
122
|
+
if (!signalKind || !signalMeaning || !returnTo || !reconciliation.state) return unresolvedProjection(
|
|
123
|
+
'delegation-return-reconciliation-expectation-incomplete',
|
|
124
|
+
'The upstream return/reconciliation projection is marked qualified but does not expose a complete Completion Expectation and an explicit reconciliation state/expectation.'
|
|
125
|
+
);
|
|
126
|
+
return Object.freeze({
|
|
127
|
+
state: 'explicit-qualified-return-reconciliation',
|
|
128
|
+
completionExpectation: Object.freeze({ signalKind, signalMeaning, returnTo }),
|
|
129
|
+
reconciliation,
|
|
130
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
131
|
+
facts: Object.freeze(projectFacts(value)),
|
|
132
|
+
provenance: Object.freeze({
|
|
133
|
+
basis: 'exact-upstream-qualified-return-reconciliation-projection',
|
|
134
|
+
sourceArtifact: Object.freeze(base.sourceArtifact),
|
|
135
|
+
upstreamProvenance: value?.provenance ? Object.freeze({ ...(value.provenance || {}) }) : null,
|
|
136
|
+
boundary: 'Return and reconciliation responsibility are passed through exactly; Core does not invent acceptance, completion or merge semantics.'
|
|
137
|
+
}),
|
|
138
|
+
unresolved: Object.freeze([]),
|
|
139
|
+
boundary: 'Completion and reconciliation expectations are semantic-owner inputs; carrier manufacture remains a separate mechanical operation.'
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function projectNextOperations({ delegateCapabilityAuthority, targetAuthority, returnReconciliationExpectation }) {
|
|
144
|
+
const target = targetAuthority.target;
|
|
145
|
+
const delegate = delegateCapabilityAuthority.delegate;
|
|
146
|
+
return Object.freeze([
|
|
147
|
+
Object.freeze({
|
|
148
|
+
kind: 'author-delegation-task',
|
|
149
|
+
command: 'author',
|
|
150
|
+
schemaId: 'tiinex.task.v1',
|
|
151
|
+
workspaceId: target.workspaceId,
|
|
152
|
+
repository: target.repository,
|
|
153
|
+
directory: target.taskDirectory,
|
|
154
|
+
bodyAuthority: 'caller/upstream-authored-work-semantics-required',
|
|
155
|
+
boundary: 'Mechanical authoring coordinate only. Core does not generate the Task objective, Done Criteria, scope or work plan.'
|
|
156
|
+
}),
|
|
157
|
+
Object.freeze({
|
|
158
|
+
kind: 'author-delegation-handoff',
|
|
159
|
+
command: 'author',
|
|
160
|
+
schemaId: 'tiinex.handoff.v1',
|
|
161
|
+
workspaceId: target.workspaceId,
|
|
162
|
+
repository: target.repository,
|
|
163
|
+
directory: target.handoffDirectory,
|
|
164
|
+
parent: 'newly-authored-qualified-task',
|
|
165
|
+
recipient: Object.freeze({ ...delegate }),
|
|
166
|
+
completionExpectation: Object.freeze({ ...(returnReconciliationExpectation.completionExpectation || {}) }),
|
|
167
|
+
boundary: 'Author the Handoff through normal Tooling with the qualified Task as Parent and the upstream-selected delegate/return semantics; Core does not synthesize transfer semantics.'
|
|
168
|
+
}),
|
|
169
|
+
Object.freeze({
|
|
170
|
+
kind: 'manufacture-delegation-carrier',
|
|
171
|
+
command: 'handoff',
|
|
172
|
+
workspaceId: target.workspaceId,
|
|
173
|
+
recipient: Object.freeze({ ...delegate }),
|
|
174
|
+
carrierAllocation: 'machine-derived-from-qualified-parent-pointer-topology',
|
|
175
|
+
reconciliation: returnReconciliationExpectation.reconciliation,
|
|
176
|
+
boundary: 'Manufacture only after the Task and Handoff qualify. Carrier topology is transport-only and does not create semantic delegation authority.'
|
|
177
|
+
})
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function qualifyExplicitProjection(value = null) {
|
|
182
|
+
if (!value || typeof value !== 'object' || value.explicit !== true) return { qualified: false, sourceArtifact: emptySourceArtifact() };
|
|
183
|
+
if (String(value.qualification || value.state || '').trim().toLowerCase() !== 'qualified') return { qualified: false, sourceArtifact: emptySourceArtifact() };
|
|
184
|
+
const sourceArtifact = projectSourceArtifact(value);
|
|
185
|
+
if (!sourceArtifact.path || !/^[0-9a-f]{64}$/i.test(sourceArtifact.sha256)) return { qualified: false, sourceArtifact };
|
|
186
|
+
return { qualified: true, sourceArtifact };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function projectSourceArtifact(value = {}) {
|
|
190
|
+
const source = value.sourceArtifact || value.provenance?.sourceArtifact || {};
|
|
191
|
+
return Object.freeze({
|
|
192
|
+
workspaceId: String(source.workspaceId || source.workspace || '').trim(),
|
|
193
|
+
path: String(source.path || source.workspaceRelativePath || value.provenance?.sourceArtifactPath || '').trim(),
|
|
194
|
+
sha256: String(source.sha256 || value.provenance?.sourceArtifactSha256 || '').trim().toLowerCase(),
|
|
195
|
+
schemaId: String(source.schemaId || '').trim()
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function unresolvedProjection(code, detail) {
|
|
200
|
+
return Object.freeze({
|
|
201
|
+
state: 'not-established',
|
|
202
|
+
facts: Object.freeze([]),
|
|
203
|
+
sourceArtifact: Object.freeze(emptySourceArtifact()),
|
|
204
|
+
unresolved: Object.freeze([Object.freeze({ code, detail })]),
|
|
205
|
+
boundary: 'No semantic meaning is inferred from Role/cache inventory, Handoff endpoints, filenames, repository adjacency or transport placement.'
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function blocker(code, detail, request) {
|
|
210
|
+
return Object.freeze({
|
|
211
|
+
code,
|
|
212
|
+
detail: String(detail || ''),
|
|
213
|
+
request: `${String(request || '')} Do not fall back to plain-chat delegation, repository scanning, network discovery, or selecting a Role merely because it is carried.`
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function projectFacts(value = {}) {
|
|
218
|
+
const facts = Array.isArray(value.facts) ? value.facts : Array.isArray(value.items) ? value.items : [];
|
|
219
|
+
return facts.slice(0, MAX_FACTS).map((item) => freezeValue(item));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function freezeValue(value) {
|
|
223
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) return Object.freeze({ ...value });
|
|
224
|
+
if (Array.isArray(value)) return Object.freeze([...value]);
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function normalizeDirectory(value = '') {
|
|
229
|
+
return String(value || '').replace(/\\/g, '/').replace(/^\/+/, '').replace(/\/+$/, '').trim();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function normalizeReconciliation(value = null) {
|
|
233
|
+
if (typeof value === 'string') return Object.freeze({ state: String(value || '').trim(), expectation: '' });
|
|
234
|
+
if (!value || typeof value !== 'object') return Object.freeze({ state: '', expectation: '' });
|
|
235
|
+
return Object.freeze({
|
|
236
|
+
state: String(value.state || value.disposition || '').trim(),
|
|
237
|
+
expectation: String(value.expectation || value.description || '').trim()
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function emptySourceArtifact() { return { workspaceId: '', path: '', sha256: '', schemaId: '' }; }
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { deepFreeze, normalizeToken } from '../handoff/coldStartQualification.shared.js';
|
|
2
|
+
|
|
3
|
+
export const HOLDER_ASSIGNMENT_MODE = deepFreeze({
|
|
4
|
+
EXPLICIT_SESSION: 'explicit-session',
|
|
5
|
+
EXPLICIT_USER_SESSION: 'explicit-user-session',
|
|
6
|
+
EXPLICIT_ROLE_INVOCATION: 'explicit-role-invocation',
|
|
7
|
+
HANDOFF: 'handoff',
|
|
8
|
+
EXPLICIT_PARTICIPATION: 'explicit-participation'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const KNOWN_MODES = new Set(Object.values(HOLDER_ASSIGNMENT_MODE));
|
|
12
|
+
|
|
13
|
+
export function projectHolderAssignmentModeAuthority(role = {}) {
|
|
14
|
+
const endpointKind = normalizeToken(role?.endpoint?.kind || '');
|
|
15
|
+
if (endpointKind !== 'role') return deepFreeze({
|
|
16
|
+
state: 'not-applicable',
|
|
17
|
+
modes: deepFreeze([]),
|
|
18
|
+
holderState: '',
|
|
19
|
+
source: 'none',
|
|
20
|
+
reasonCode: 'recipient-not-role',
|
|
21
|
+
unknownModes: deepFreeze([]),
|
|
22
|
+
provenance: baseProvenance(role, { basis: 'recipient-not-role', field: 'Assignment Modes' }),
|
|
23
|
+
boundary: 'Holder assignment-mode authority applies only to a selected Role recipient.'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const material = role?.material?.artifact || null;
|
|
27
|
+
const relationship = role?.holderRelationshipLoaded || {};
|
|
28
|
+
const holderState = String(relationship.holderState || '').trim();
|
|
29
|
+
const qualifiedMaterial = String(role?.state || '') === 'qualified'
|
|
30
|
+
&& String(role?.material?.state || '') === 'qualified'
|
|
31
|
+
&& Boolean(material?.path)
|
|
32
|
+
&& /^[0-9a-f]{64}$/i.test(String(material?.sha256 || ''));
|
|
33
|
+
if (!qualifiedMaterial) return unresolved(role, holderState, 'qualified-role-holder-authority-not-established', 'none', {
|
|
34
|
+
basis: 'exact-qualified-role-assignment-mode-authority-not-established', field: 'Assignment Modes'
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const structured = parseStructuredModes(relationship.assignmentModes);
|
|
38
|
+
if (!structured.present) return unresolved(role, holderState, 'holder-assignment-mode-authority-missing', 'qualified-recipient-role-material', {
|
|
39
|
+
basis: 'canonical-assignment-modes-missing', field: 'Assignment Modes'
|
|
40
|
+
});
|
|
41
|
+
if (structured.unknown.length) return unresolved(role, holderState, 'holder-assignment-mode-authority-unknown-token', 'qualified-recipient-role-structured-modes', {
|
|
42
|
+
basis: 'exact-qualified-role-assignment-modes', field: 'Assignment Modes', exactValue: structured.raw, unknownModes: structured.unknown
|
|
43
|
+
});
|
|
44
|
+
if (!structured.modes.length) return unresolved(role, holderState, 'holder-assignment-mode-authority-empty', 'qualified-recipient-role-structured-modes', {
|
|
45
|
+
basis: 'exact-qualified-role-assignment-modes', field: 'Assignment Modes', exactValue: structured.raw
|
|
46
|
+
});
|
|
47
|
+
return deepFreeze({
|
|
48
|
+
state: 'qualified',
|
|
49
|
+
modes: deepFreeze(structured.modes),
|
|
50
|
+
holderState,
|
|
51
|
+
source: 'qualified-recipient-role-structured-modes',
|
|
52
|
+
reasonCode: 'holder-assignment-mode-authority-qualified',
|
|
53
|
+
unknownModes: deepFreeze([]),
|
|
54
|
+
provenance: baseProvenance(role, {
|
|
55
|
+
basis: 'exact-qualified-role-assignment-modes',
|
|
56
|
+
field: 'Assignment Modes',
|
|
57
|
+
exactValue: structured.raw,
|
|
58
|
+
boundary: 'Positive mode authority comes only from the exact structured Assignment Modes field on the qualified current Role. Holder State is diagnostic-only; historical compatibility material does not authorize current holder binding.'
|
|
59
|
+
}),
|
|
60
|
+
boundary: 'Exact structured canonical assignment modes authorize only their named bounded mechanisms; they do not establish a holder, durable identity, participation, delegation, process, source, or acceptance authority.'
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function isCanonicalHolderAssignmentMode(value = '') {
|
|
65
|
+
return KNOWN_MODES.has(String(value || '').trim());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function parseStructuredModes(value) {
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
const raw = value.map((item) => String(item || '').trim()).filter(Boolean);
|
|
71
|
+
const tokens = raw.map(stripCode).filter(Boolean);
|
|
72
|
+
return classifyStructured(tokens, raw.join(', '), true);
|
|
73
|
+
}
|
|
74
|
+
const raw = String(value || '').trim();
|
|
75
|
+
if (!raw) return { present: false, raw: '', modes: [], unknown: [] };
|
|
76
|
+
const tokens = raw.split(',').map((item) => stripCode(item.trim())).filter(Boolean);
|
|
77
|
+
return classifyStructured(tokens, raw, true);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function classifyStructured(tokens, raw, present) {
|
|
81
|
+
const modes = [];
|
|
82
|
+
const unknown = [];
|
|
83
|
+
for (const token of tokens) {
|
|
84
|
+
if (KNOWN_MODES.has(token)) {
|
|
85
|
+
if (!modes.includes(token)) modes.push(token);
|
|
86
|
+
} else if (!unknown.includes(token)) unknown.push(token);
|
|
87
|
+
}
|
|
88
|
+
return { present, raw, modes, unknown };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function stripCode(value) {
|
|
92
|
+
const text = String(value || '').trim();
|
|
93
|
+
return /^`[^`]+`$/.test(text) ? text.slice(1, -1).trim() : text;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function unresolved(role, holderState, reasonCode, source, details = {}) {
|
|
97
|
+
return deepFreeze({
|
|
98
|
+
state: 'unresolved',
|
|
99
|
+
modes: deepFreeze([]),
|
|
100
|
+
holderState,
|
|
101
|
+
source,
|
|
102
|
+
reasonCode,
|
|
103
|
+
unknownModes: deepFreeze([...(details.unknownModes || [])]),
|
|
104
|
+
provenance: baseProvenance(role, details),
|
|
105
|
+
boundary: 'Positive holder assignment-mode authorization is unresolved. Core does not infer canonical modes from Holder State prose, historical Role compatibility, endpoint labels, package placement, session assertions, filenames, or lexical similarity.'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function baseProvenance(role = {}, details = {}) {
|
|
110
|
+
const material = role?.material?.artifact || {};
|
|
111
|
+
return deepFreeze({
|
|
112
|
+
basis: String(details.basis || ''),
|
|
113
|
+
roleArtifactPath: String(material.path || ''),
|
|
114
|
+
roleArtifactSha256: String(material.sha256 || ''),
|
|
115
|
+
roleSchemaId: String(material.schemaId || ''),
|
|
116
|
+
roleLabel: String(material.roleLabel || role?.endpoint?.label || ''),
|
|
117
|
+
section: 'Holder Relationship',
|
|
118
|
+
field: String(details.field || 'Assignment Modes'),
|
|
119
|
+
exactValue: String(details.exactValue || ''),
|
|
120
|
+
exactRoleSourcePath: '',
|
|
121
|
+
exactRoleSha256: '',
|
|
122
|
+
decisionArtifact: null,
|
|
123
|
+
boundary: String(details.boundary || 'Only exact structured Assignment Modes on exact qualified current Role material may establish canonical assignment modes. Holder State and historical compatibility material remain non-authoritative for positive authorization.')
|
|
124
|
+
});
|
|
125
|
+
}
|