@tiinex/core 0.13.0 → 0.15.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.
Files changed (29) hide show
  1. package/package.json +5 -5
  2. package/src/integrity/integrity.c14nV1.js +28 -0
  3. package/src/lineage/lineage.integrity.js +108 -22
  4. package/src/lineage/lineage.resolve.js +21 -14
  5. package/src/lineage/lineage.sourceScope.js +41 -12
  6. package/src/lineage/lineage.targetKeys.js +26 -7
  7. package/src/tooling/portable/adapters/cli/cli.handoff-manufacture.js +47 -10
  8. package/src/tooling/portable/adapters/node/bootstrapCarrier.manufacture.js +18 -0
  9. package/src/tooling/portable/adapters/node/workspaceCarrier.manufacture.js +13 -3
  10. package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.md +2 -2
  11. package/src/tooling/portable/handoff/bootstrapCarrier.manufacture.js +56 -0
  12. package/src/tooling/portable/handoff/contracts/tiinex.handoff.package.v1.schema.md +340 -77
  13. package/src/tooling/portable/handoff/manufacture.js +3 -1
  14. package/src/tooling/portable/handoff/recipientV2.artifactFirst.build.js +73 -32
  15. package/src/tooling/portable/handoff/recipientV2.artifactFirst.closure.js +1 -1
  16. package/src/tooling/portable/handoff/recipientV2.artifactFirst.inspect.js +9 -1
  17. package/src/tooling/portable/handoff/recipientV2.artifactFirst.materials.js +28 -6
  18. package/src/tooling/portable/handoff/recipientV2.artifactFirst.shared.js +8 -0
  19. package/src/tooling/portable/handoff/recipientV2.coldProjection.js +11 -6
  20. package/src/tooling/portable/handoff/recipientV2.entryContract.js +12 -0
  21. package/src/tooling/portable/handoff/recipientV2.humanOutput.js +48 -6
  22. package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +55 -43
  23. package/src/tooling/portable/handoff/recipientV2.packageV1.contract.js +57 -31
  24. package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.helpers.js +63 -10
  25. package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.js +55 -16
  26. package/src/tooling/portable/handoff/recipientV2.packageV1.workspaceProjection.js +14 -1
  27. package/src/tooling/portable/handoff/recipientV2.topology.js +3 -4
  28. package/src/tooling/portable/handoff/recipientV2.topology.materials.js +14 -0
  29. package/src/tooling/portable/handoff/workspaceCarrier.manufacture.js +42 -13
@@ -3,7 +3,7 @@ import { enumerateNodeWorkspace } from './handoff.manufacture.enumeration.js';
3
3
  import { buildToolingBootstrapTransportFiles } from './handoff.manufacture.bootstrap.js';
4
4
  import { qualifyToolingRuntimeSourceAlignment } from './handoff.manufacture.runtimeSource.js';
5
5
  import { inferWorkspaceTitle, normalizeAdditionalWorkspaceDescriptors, safeWorkspaceToken } from './handoff.manufacture.multiRoot.js';
6
- import { normalizeWorkspaceTargetBindings } from './handoff.manufacture.scope.js';
6
+ import { normalizeWorkspaceScopes, normalizeWorkspaceTargetBindings, projectBoundedWorkspaceMaterialization } from './handoff.manufacture.scope.js';
7
7
  import { normalizeHandoffCarrierLineage } from '../../handoff/carrierLineage.js';
8
8
  import { normalizeHandoffCarrierProfile } from '../../handoff/carrierProfile.js';
9
9
 
@@ -43,6 +43,15 @@ export async function prepareNodeWorkspaceCarrierManufacturingInput(input = {},
43
43
  explicitBindings: input.workspaceTargets || input.workspaceTargetBindings || [],
44
44
  additionalWorkspaceDescriptors
45
45
  });
46
+ const workspaceScopes = normalizeWorkspaceScopes(input.workspaceScopes || input.workspaceScopeBindings || []);
47
+ const materializations = enumerations.map((item) => {
48
+ const materialization = item.materialization;
49
+ const scope = workspaceScopes.get(String(materialization.id || '')) || null;
50
+ if (!scope || scope.coverage !== 'bounded') return materialization;
51
+ const targets = workspaceTargets.filter((target) => String(target.workspaceId || '') === String(materialization.id || ''));
52
+ if (targets.length !== 1) throw new Error(`portable.workspace-carrier.workspace-scope.target-${targets.length ? 'ambiguous' : 'required'}:${materialization.id}`);
53
+ return projectBoundedWorkspaceMaterialization(materialization, scope, targets[0].path);
54
+ });
46
55
  const toolingBootstrap = await buildToolingBootstrapTransportFiles({
47
56
  delivery: input.toolingBootstrap || input.bootstrapDelivery || 'embedded',
48
57
  runtimeRoot: input.runtimeRoot || options.runtimeRoot,
@@ -51,13 +60,14 @@ export async function prepareNodeWorkspaceCarrierManufacturingInput(input = {},
51
60
  });
52
61
  const runtimeSourceAlignment = await qualifyToolingRuntimeSourceAlignment({
53
62
  runtimeIdentity: toolingBootstrap.runtimeIdentity,
54
- localWorkspaces: enumerations.map((item) => Object.freeze({ id: item.materialization.id, root: item.root, materialization: item.materialization })),
63
+ localWorkspaces: enumerations.map((item, index) => Object.freeze({ id: materializations[index].id, root: item.root, materialization: item.materialization })),
55
64
  maxFiles: input.bootstrapMaxFiles || options.bootstrapMaxFiles
56
65
  });
57
66
  return Object.freeze({
58
67
  carrierMode: 'workspace',
59
68
  createdAt: String(input.createdAt || ''),
60
- workspaceMaterializations: Object.freeze(enumerations.map((item) => item.materialization)),
69
+ workspaceMaterializations: Object.freeze(materializations),
70
+ materialRepresentationWorkspaceIds: Object.freeze([...(input.materialRepresentationWorkspaceIds || input.genericMaterialWorkspaceIds || [])].map(String)),
61
71
  workspaceTargets,
62
72
  additionalTransportFiles: toolingBootstrap.files,
63
73
  carrierLineage: normalizeHandoffCarrierLineage(input.carrierLineage || null),
@@ -18,9 +18,9 @@ The same workflow must survive different host arrangements:
18
18
 
19
19
  When this bootstrap or the portable repository is available as a project source, normalize only the explicitly uploaded Markdown, archive, and project-source material, then start with `discover-tooling` or `prepare-task`.
20
20
 
21
- ### Qualified routed Handoff package
21
+ ### Qualified Tiinex package
22
22
 
23
- When a received carrier exposes the qualified recipient-facing Tiinex Handoff package surface, start at `001-1-READ-BEFORE-PROCEEDING.trace.md`. Before Tiinex Tooling is available, the host may perform only the bounded bootstrap exception: read the declared bootstrap node, extract `001-2-bootstrap.zip` into a writable runtime location, and make its Tooling entrypoint callable. Prefer a location that survives turns in the current runtime, but never treat that location as project or artifact authority. Do not manually unpack Workspace/cache payloads or perform broad ZIP/filesystem/repository archaeology. The Tooling entrypoint is exactly `runtime/tools/tiinex-portable.mjs` relative to the chosen extraction root; do not search/list the extracted runtime to discover it. Give the untouched original Handoff-package carrier to that entrypoint and use `orient-handoff-package` as the first semantic operation. Keep the outer Continue-from path opaque to native access. After orientation, use `ground <same-package.zip> --route <same-Continue-from>` as the one shared human/LLM decision-grounding path. Its bounded default receipt composes the selected Handoff authority, exact qualified Required Context identities, the selected-route declared-Parent leaf, a compact declared-Parent continuity-to-qualified-root proof, declared current-work frontier, blockers, and explicit unresolved evidence. Continue substantive bounded work only when `readiness.state` is `grounded-to-act`; `grounded-to-discuss` and `insufficient-grounding` must not be upgraded by generic inference. An apparent loaded root that still declares an unavailable Parent is not cold-start closure: follow `readiness.nextAction.recovery` exactly. If a bound exact repository-read host capability is available, use the projected `plan-host-action` request, normalize the host result through `accept-host-receipt`, then resume the same `ground` command with `--recovery <accepted-host-receipt.json>`; otherwise request exactly the named material from the Transport Operator. When an accepted pinned repository Parent declares a deterministic relative Parent, Tooling may derive only that exact sibling path from the accepted repository/commit/base-path context. For repeated recovery, call `accept-host-receipt --prior <previous-accepted.json>` so the newest accepted result explicitly carries all prior accepted recovery material; pass only that newest cumulative result back to the same `ground --recovery` seam. Never broaden search or treat fetched material as verified before lineage identity/integrity qualification. Re-run the same `ground` command with `--include-required-context <requirement-id,name|all>` only when exact qualified Required Context body text is needed. No external qualification schema, Tooling source inspection, `--help`/operation discovery, context-audit detour, or separate `ground-cold-consumer` call is required before this decision grounding. Native host tools remain valid execution mechanics after Tiinex takeover on already-resolved ordinary source, and explicit degraded fallback only when qualification explains why it was required.
23
+ When a received carrier exposes the qualified recipient-facing Tiinex package surface, start at its declared Start artifact (normally `001-1-READ-BEFORE-PROCEEDING.trace.md`). Before Tiinex Tooling is available, the host may perform only the bounded bootstrap exception: read the declared bootstrap node, extract `001-2-bootstrap.zip` into a writable runtime location, and make its Tooling entrypoint callable. Prefer a location that survives turns in the current runtime, but never treat that location as project or artifact authority. Do not manually unpack Workspace/cache payloads or perform broad ZIP/filesystem/repository archaeology. The Tooling entrypoint is exactly `runtime/tools/tiinex-portable.mjs` relative to the chosen extraction root; do not search/list the extracted runtime to discover it. Give the untouched original package carrier to that entrypoint and use `orient-handoff-package` as the first semantic operation. Package role is qualified from the carried package contract rather than inferred from filenames, Workspace/Role presence, or transport labels. A bootstrap-only or pointerless Workspace carrier has no Handoff route and must not be upgraded into recipient, holder, participation, delegation, current-work, or grounded-to-act authority; use the qualified route-less orientation/material projection only. For a routed Handoff carrier, keep the outer Continue-from path opaque to native access and, after orientation, use `ground <same-package.zip> --route <same-Continue-from>` as the one shared human/LLM decision-grounding path. Its bounded default receipt composes the selected Handoff authority, exact qualified Required Context identities, the selected-route declared-Parent leaf, a compact declared-Parent continuity-to-qualified-root proof, declared current-work frontier, blockers, and explicit unresolved evidence. Continue substantive bounded work only when `readiness.state` is `grounded-to-act`; `grounded-to-discuss` and `insufficient-grounding` must not be upgraded by generic inference. An apparent loaded root that still declares an unavailable Parent is not cold-start closure: follow `readiness.nextAction.recovery` exactly. If a bound exact repository-read host capability is available, use the projected `plan-host-action` request, normalize the host result through `accept-host-receipt`, then resume the same `ground` command with `--recovery <accepted-host-receipt.json>`; otherwise request exactly the named material from the Transport Operator. When an accepted pinned repository Parent declares a deterministic relative Parent, Tooling may derive only that exact sibling path from the accepted repository/commit/base-path context. For repeated recovery, call `accept-host-receipt --prior <previous-accepted.json>` so the newest accepted result explicitly carries all prior accepted recovery material; pass only that newest cumulative result back to the same `ground --recovery` seam. Never broaden search or treat fetched material as verified before lineage identity/integrity qualification. Re-run the same `ground` command with `--include-required-context <requirement-id,name|all>` only when exact qualified Required Context body text is needed. No external qualification schema, Tooling source inspection, `--help`/operation discovery, context-audit detour, or separate `ground-cold-consumer` call is required before this decision grounding. Native host tools remain valid execution mechanics after Tiinex takeover on already-resolved ordinary source, and explicit degraded fallback only when qualification explains why it was required.
24
24
 
25
25
  ### Bootstrap travels inside an archive
26
26
 
@@ -0,0 +1,56 @@
1
+ import { finalizeFile } from '../../../export/package.fileMap.js';
2
+ import { summarizePortableFindings } from '../findings.js';
3
+ import { inspectPortableToolingBootstrap } from './toolingBootstrap.js';
4
+ import { renderRecipientV2Pointer } from './recipientV2.artifacts.js';
5
+ import { RECIPIENT_V2_READ_PATH, RECIPIENT_V2_FORMAT_ID } from './recipientV2.topology.js';
6
+ import { recipientV2BootstrapEntryCurrentRead } from './recipientV2.entryContract.js';
7
+ import { recipientV2TransportFacts } from './recipientV2.transportManifest.js';
8
+ import { buildRecipientV2BootstrapCarrier, recipientV2ParentAuthority } from './recipientV2.topology.workspaces.js';
9
+ import { RECIPIENT_V2_PACKAGE_V1_ROOT_PATH, RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID, RECIPIENT_V2_PACKAGE_V1_SCHEMA_TARGET } from './recipientV2.packageV1.constants.js';
10
+ import { BOOTSTRAP_PACKAGE_ROLE, renderHandoffPackageV1 } from './recipientV2.packageV1.contract.js';
11
+ import { deepFreeze } from './recipientV2.packageV1.shared.js';
12
+ import { inspectRecipientFacingV2Topology, roundTripRecipientFacingV2Topology } from './recipientV2.inspect.js';
13
+
14
+ export function manufactureRecipientRelativeBootstrapPackage(input = {}) {
15
+ const findings = [];
16
+ const createdAt = String(input.createdAt || '1970-01-01 00:00:00');
17
+ const bootstrapSource = (input.additionalTransportFiles || []).filter((file) => String(file.path || '').startsWith('tiinex.bootstrap/'));
18
+ const sourceInspection = inspectPortableToolingBootstrap({ files: bootstrapSource });
19
+ if (sourceInspection.status !== 'valid') findings.push(...(sourceInspection.findings || []));
20
+ if (!bootstrapSource.length) findings.push(Object.freeze({ severity: 'error', code: 'portable.bootstrap-carrier.bootstrap-missing', message: 'Bootstrap-only carrier requires one qualified portable Tooling bootstrap source.' }));
21
+ const packageFile = finalizeFile({
22
+ path: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH,
23
+ kind: 'tiinex-handoff-package-artifact', logicalKind: 'recipient-v2-package-v1-root', mediaType: 'text/markdown',
24
+ content: renderHandoffPackageV1({ createdAt, packageRole: BOOTSTRAP_PACKAGE_ROLE, workspaces: [], materialRepresentations: [], carrierLineage: input.carrierLineage || {}, carrierProfile: input.carrierProfile || null, startPath: RECIPIENT_V2_READ_PATH, bootstrapPath: '001-2-bootstrap.trace.md' })
25
+ });
26
+ const packageParent = recipientV2ParentAuthority(packageFile, RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID, RECIPIENT_V2_PACKAGE_V1_SCHEMA_TARGET, createdAt);
27
+ const files = [packageFile];
28
+ const bootstrap = bootstrapSource.length ? buildRecipientV2BootstrapCarrier(bootstrapSource, createdAt, findings, packageParent) : null;
29
+ if (bootstrap) files.push(bootstrap.artifact, bootstrap.payload);
30
+ const readFacts = recipientV2TransportFacts('recovery-orientation', {
31
+ format: 'tiinex-recipient-facing-handoff-package-v1', packageRole: BOOTSTRAP_PACKAGE_ROLE,
32
+ packageRootPath: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH, entryArtifactPath: RECIPIENT_V2_READ_PATH,
33
+ artifactSurface: 'tiinex.handoff.package.v1-plus-qualified-bootstrap-only', routeAuthority: 'none', routeSelectionAuthority: 'none', siblingRouteInference: false,
34
+ carrierLineage: input.carrierLineage || null, pathParentProjection: true, pathAuthority: false
35
+ });
36
+ const readFile = finalizeFile({
37
+ path: RECIPIENT_V2_READ_PATH, kind: 'handoff-recovery-pointer', logicalKind: 'recipient-v2-package-v1-bootstrap-recovery-orientation', mediaType: 'text/markdown', transportFacts: readFacts,
38
+ content: renderRecipientV2Pointer({ createdAt, parent: packageParent, role: 'recovery-orientation', title: 'READ BEFORE PROCEEDING — Tiinex Bootstrap Carrier', summary: 'Qualified recovery/orientation Pointer for a bootstrap-only package-v1 carrier.', prose: 'Read this Start artifact first and qualify the declared Tooling bootstrap. This carrier intentionally contains no project/source Workspace material and no Handoff route. Do not infer recipient, holder, Role, current-work, participation, delegation, or grounded-to-act authority from transport.', currentRead: [...recipientV2BootstrapEntryCurrentRead(), { label: 'Package Artifact', value: `[Bootstrap Package](${RECIPIENT_V2_PACKAGE_V1_ROOT_PATH})` }, { label: 'Carrier Dimension', value: `\`${String(input.carrierLineage?.dimension || '001')}\`` }], destinations: [{ label: 'Bootstrap Package contract', target: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH }, ...(bootstrap ? [{ label: 'Portable Tooling bootstrap', target: bootstrap.projection.artifactPath }] : [])], facts: readFacts })
39
+ });
40
+ files.push(readFile);
41
+ const sortedFiles = Object.freeze([...files].sort((a, b) => String(a.path || '').localeCompare(String(b.path || ''))));
42
+ const bundle = deepFreeze({ status: 'ready', files: sortedFiles, handoffClosure: null, transportFormat: RECIPIENT_V2_FORMAT_ID, boundary: 'Bootstrap-only recipient carrier. Start/bootstrap qualification creates no Workspace, Role, Handoff, recipient, holder, work, or action authority.' });
43
+ const inspection = inspectRecipientFacingV2Topology(bundle);
44
+ const roundtrip = input.verifyRoundtrip === false ? null : roundTripRecipientFacingV2Topology(bundle, inspection);
45
+ const toolingBootstrapInspection = inspection.bootstrapInspection || sourceInspection;
46
+ const allFindings = [...findings, ...(inspection.findings || []), ...(roundtrip?.findings || [])];
47
+ const ready = inspection.status === 'valid' && inspection.carrierProjection?.mode === 'bootstrap' && inspection.carrierProjection?.status === 'ready' && (!roundtrip || roundtrip.status === 'passed') && toolingBootstrapInspection.status === 'valid' && !allFindings.some((item) => item.severity === 'error');
48
+ return deepFreeze({
49
+ schema: 'tiinex.portable.handoff-manufacturing.v2', status: ready ? 'ready' : 'blocked', executable: ready, transportExecutable: ready,
50
+ verification: Object.freeze({ baselineManufacture: 'ready', manufacturePath: 'qualified-bootstrap-to-zero-material-package-v1', packageInspection: inspection.status, closureInspection: 'not-applicable', carrierInspection: inspection.status, selectedHandoffConformance: 'not-applicable', pointerEntrypointInspection: 'not-applicable', coldConsumerEntrypointInspection: inspection.status, companionInspection: 'not-applicable', roundtrip: roundtrip?.status || 'not-requested', toolingBootstrap: toolingBootstrapInspection.status }),
51
+ plan: Object.freeze({ status: ready ? 'ready' : 'blocked', requiredClosureReady: true, semanticHandoffStatus: 'not-declared', workspaceMaterializations: Object.freeze([]), requirements: Object.freeze({ required: Object.freeze([]), reference: Object.freeze([]) }) }),
52
+ bundle, inspection, carrierProjection: inspection.carrierProjection, roundtrip, toolingBootstrapInspection, toolingBootstrap: input.toolingBootstrap || null, carrierLineage: input.carrierLineage || inspection.carrierProjection?.lineage || null, manufacturingEvidence: input.manufacturingEvidence || null,
53
+ findings: Object.freeze(allFindings), findingSummary: summarizePortableFindings(allFindings), operationBoundary: Object.freeze({ sourceMutation: false, remoteWrite: false, handoffSemantics: false, recipientAuthority: false, holderAuthority: false, workAuthority: false }),
54
+ boundary: 'Canonical bootstrap-only carrier manufacture. Qualified Start/bootstrap mechanics only; no project/source material or Handoff/Role/recipient/holder/work authority is created.'
55
+ });
56
+ }