@inventarch/agent-composition-system 1.0.0 → 1.1.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 (80) hide show
  1. package/LANGUAGE.md +56 -0
  2. package/SPEC.md +9 -1
  3. package/dist/catalog.d.ts +2 -1
  4. package/dist/catalog.d.ts.map +1 -1
  5. package/dist/catalog.js.map +1 -1
  6. package/dist/compile.d.ts.map +1 -1
  7. package/dist/compile.js +10 -0
  8. package/dist/compile.js.map +1 -1
  9. package/dist/compiled.d.ts +2 -1
  10. package/dist/compiled.d.ts.map +1 -1
  11. package/dist/corpus.d.ts +3 -1
  12. package/dist/corpus.d.ts.map +1 -1
  13. package/dist/corpus.js +9 -1
  14. package/dist/corpus.js.map +1 -1
  15. package/dist/execution.d.ts.map +1 -1
  16. package/dist/execution.js +1 -0
  17. package/dist/execution.js.map +1 -1
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/installed-read.d.ts +29 -0
  23. package/dist/installed-read.d.ts.map +1 -0
  24. package/dist/installed-read.js +150 -0
  25. package/dist/installed-read.js.map +1 -0
  26. package/dist/lifecycle-profile.d.ts +13 -0
  27. package/dist/lifecycle-profile.d.ts.map +1 -1
  28. package/dist/lifecycle-profile.js +21 -19
  29. package/dist/lifecycle-profile.js.map +1 -1
  30. package/dist/lifecycle-rows.d.ts +12 -0
  31. package/dist/lifecycle-rows.d.ts.map +1 -0
  32. package/dist/lifecycle-rows.js +35 -0
  33. package/dist/lifecycle-rows.js.map +1 -0
  34. package/dist/lifecycle-transport.js +2 -2
  35. package/dist/lifecycle-transport.js.map +1 -1
  36. package/dist/native-selection.json +205 -0
  37. package/dist/native.ia.tgz +0 -0
  38. package/dist/projection-format.d.ts +7 -0
  39. package/dist/projection-format.d.ts.map +1 -1
  40. package/dist/projection-format.js +12 -10
  41. package/dist/projection-format.js.map +1 -1
  42. package/dist/projection-host.d.ts +2 -0
  43. package/dist/projection-host.d.ts.map +1 -1
  44. package/dist/projection-host.js +5 -0
  45. package/dist/projection-host.js.map +1 -1
  46. package/dist/projection-routine.d.ts +4 -0
  47. package/dist/projection-routine.d.ts.map +1 -0
  48. package/dist/projection-routine.js +50 -0
  49. package/dist/projection-routine.js.map +1 -0
  50. package/dist/projections.d.ts.map +1 -1
  51. package/dist/projections.js +152 -67
  52. package/dist/projections.js.map +1 -1
  53. package/dist/resource-context.d.ts.map +1 -1
  54. package/dist/resource-context.js +9 -6
  55. package/dist/resource-context.js.map +1 -1
  56. package/dist/sources.d.ts.map +1 -1
  57. package/dist/sources.js +2 -0
  58. package/dist/sources.js.map +1 -1
  59. package/dist/system-package.json +1618 -0
  60. package/dist/task-capture-format.d.ts +25 -0
  61. package/dist/task-capture-format.d.ts.map +1 -0
  62. package/dist/task-capture-format.js +62 -0
  63. package/dist/task-capture-format.js.map +1 -0
  64. package/dist/task-capture.d.ts +64 -0
  65. package/dist/task-capture.d.ts.map +1 -0
  66. package/dist/task-capture.js +421 -0
  67. package/dist/task-capture.js.map +1 -0
  68. package/dist/task-context-declaration.d.ts +19 -0
  69. package/dist/task-context-declaration.d.ts.map +1 -0
  70. package/dist/task-context-declaration.js +44 -0
  71. package/dist/task-context-declaration.js.map +1 -0
  72. package/dist/task-teaching-closure.d.ts +22 -0
  73. package/dist/task-teaching-closure.d.ts.map +1 -0
  74. package/dist/task-teaching-closure.js +202 -0
  75. package/dist/task-teaching-closure.js.map +1 -0
  76. package/package.json +49 -13
  77. package/references/installed-read.md +36 -0
  78. package/references/public-spec.md +7 -0
  79. package/references/spec-read-boundary.md +17 -0
  80. package/references/task-capture.md +23 -0
@@ -0,0 +1,19 @@
1
+ import type { Coordinate } from '@inventarch/graph';
2
+ import type { AuthoringTargetRequest } from './authoring-types.js';
3
+ import type { ResourceKey, ResourceOccurrence } from './resource-format.js';
4
+ /** Supplied only by the trusted host's reviewed task resolver, never by a remote request. */
5
+ export interface TaskContextDeclaration {
6
+ readonly format: 'ia.task-context-declaration.v1';
7
+ readonly task: ResourceOccurrence;
8
+ readonly basis: ResourceOccurrence;
9
+ readonly coordinate: Coordinate;
10
+ readonly affectedSources: readonly {
11
+ readonly source: string;
12
+ readonly path: string;
13
+ }[];
14
+ readonly authoring: readonly AuthoringTargetRequest[];
15
+ readonly requiredResources: readonly ResourceKey[];
16
+ }
17
+ /** Closed decoding is not an authority check. The owning host selects the current approved declaration. */
18
+ export declare function taskContextDeclaration(value: unknown): TaskContextDeclaration;
19
+ //# sourceMappingURL=task-context-declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-context-declaration.d.ts","sourceRoot":"","sources":["../src/task-context-declaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAYnE,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxF,QAAQ,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACtD,QAAQ,CAAC,iBAAiB,EAAE,SAAS,WAAW,EAAE,CAAC;CACpD;AACD,2GAA2G;AAC3G,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAuC7E"}
@@ -0,0 +1,44 @@
1
+ import { validateCoordinate } from '@inventarch/graph';
2
+ import { authoringRequest, unique } from './authoring-format.js';
3
+ import { frozen, list, object, occurrence, occurrenceOf, portablePath, resourceKey, keyOf, text, } from './resource-format.js';
4
+ /** Closed decoding is not an authority check. The owning host selects the current approved declaration. */
5
+ export function taskContextDeclaration(value) {
6
+ const row = object(value, [
7
+ 'format',
8
+ 'task',
9
+ 'basis',
10
+ 'coordinate',
11
+ 'affectedSources',
12
+ 'authoring',
13
+ 'requiredResources',
14
+ ]);
15
+ if (row['format'] !== 'ia.task-context-declaration.v1')
16
+ throw new Error('Unsupported task context declaration');
17
+ const coordinateInput = row['coordinate'];
18
+ if (!coordinateInput || typeof coordinateInput !== 'object' || Array.isArray(coordinateInput))
19
+ throw new Error('Invalid task context coordinate');
20
+ object(coordinateInput, Object.keys(coordinateInput));
21
+ const coordinate = validateCoordinate(coordinateInput);
22
+ const affectedSources = unique(list(row['affectedSources'], 5000).map((value) => {
23
+ const item = object(value, ['source', 'path']), source = text(item['source'], 64);
24
+ if (!/^[a-z][a-z0-9-]{0,63}$/.test(source))
25
+ throw new Error('Invalid affected source identity');
26
+ return { source, path: portablePath(item['path']) };
27
+ }), (v) => v.source + ':' + v.path);
28
+ const authoring = unique(list(row['authoring'], 2000).map(authoringRequest), (v) => JSON.stringify(v));
29
+ if (!authoring.length)
30
+ throw new Error('Explicit complete authoring coverage is required');
31
+ const declaration = {
32
+ format: row['format'],
33
+ task: occurrence(row['task']),
34
+ basis: occurrence(row['basis']),
35
+ coordinate,
36
+ affectedSources,
37
+ authoring,
38
+ requiredResources: unique(list(row['requiredResources'], 2000).map(resourceKey), keyOf),
39
+ };
40
+ if (occurrenceOf(declaration.task) === occurrenceOf(declaration.basis))
41
+ throw new Error('Task and made decision basis must be distinct occurrences');
42
+ return frozen(declaration);
43
+ }
44
+ //# sourceMappingURL=task-context-declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-context-declaration.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22 @@
1
+ import type { Graph, Node } from '@inventarch/graph';
2
+ import type { AuthoringTargetRequest, AuthoringView, CapturedAuthoringIndex, AuthoringRequirements } from './authoring-types.js';
3
+ import type { Capture } from './corpus.js';
4
+ import type { CapturedResources, ResourceKey, ResourceOccurrence } from './resource-format.js';
5
+ /** Positive metadata closure. No source discovery, ranking, or authorization lives here. */
6
+ export declare function taskTeachingClosure(capture: Capture, resources: CapturedResources, index: CapturedAuthoringIndex, graph: Graph, view: AuthoringView, addNative: (identity: string, reason: string) => boolean, fail: (message: string) => never): {
7
+ native: (o: ResourceOccurrence, reason: string) => void;
8
+ resource: (key: ResourceKey) => void;
9
+ system: (name: string) => void;
10
+ guide: (word: string) => void;
11
+ require: (request: AuthoringTargetRequest) => void;
12
+ retainNode: (node: Node) => void;
13
+ requirements: () => {
14
+ request: AuthoringTargetRequest;
15
+ requirements: AuthoringRequirements;
16
+ }[];
17
+ finish: () => {
18
+ resources: CapturedResources;
19
+ index: CapturedAuthoringIndex;
20
+ };
21
+ };
22
+ //# sourceMappingURL=task-teaching-closure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-teaching-closure.d.ts","sourceRoot":"","sources":["../src/task-teaching-closure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAEV,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK/F,4FAA4F;AAC5F,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,sBAAsB,EAC7B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EACxD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK;gBAYb,kBAAkB,UAAU,MAAM,KAAG,IAAI;oBAIrC,WAAW,KAAG,IAAI;mBAQnB,MAAM,KAAG,IAAI;kBA4Bd,MAAM,KAAG,IAAI;uBAgCR,sBAAsB,KAAG,IAAI;uBA4B7B,IAAI,KAAG,IAAI;;iBArGc,sBAAsB;sBAAgB,qBAAqB;;;;;;EAsJ/G"}
@@ -0,0 +1,202 @@
1
+ import { systemMember } from '@inventarch/db';
2
+ import { prepareAuthoringTarget, createAuthoringIndex } from './authoring.js';
3
+ import { keyOf, metadataDigest, occurrenceOf } from './resource-format.js';
4
+ import { resourceOccurrences, verifyResources } from './resources.js';
5
+ import { nativeResourcePath } from './resource-sources.js';
6
+ /** Positive metadata closure. No source discovery, ranking, or authorization lives here. */
7
+ export function taskTeachingClosure(capture, resources, index, graph, view, addNative, fail) {
8
+ const inventory = resourceOccurrences(capture).occurrences;
9
+ const nativeParts = new Map(inventory.map((o) => ['native-' + metadataDigest(o), o]));
10
+ const resourceParts = new Map(resources.files.map((f) => ['resource-' + metadataDigest(f.key), f.key]));
11
+ const resourceKeys = new Set(), systems = new Set(), artifacts = new Set(), documents = new Set(), profiles = new Set(), models = new Set();
12
+ const checkedRequests = new Map();
13
+ const native = (o, reason) => {
14
+ if (!inventory.some((v) => occurrenceOf(v) === occurrenceOf(o)))
15
+ fail('Required authoring occurrence is stale');
16
+ addNative(o.identity, reason);
17
+ };
18
+ const resource = (key) => {
19
+ if (!resources.files.some((f) => keyOf(f.key) === keyOf(key)))
20
+ fail('Required authoring resource is absent');
21
+ if (resourceKeys.has(keyOf(key)))
22
+ return;
23
+ resourceKeys.add(keyOf(key));
24
+ const associations = resources.associations.filter((a) => a.resources.some((u) => keyOf(u.key) === keyOf(key)));
25
+ if (!associations.length)
26
+ fail('Required resource has no authoritative native association');
27
+ for (const a of associations)
28
+ native(a.owner, 'required resource owner');
29
+ };
30
+ const system = (name) => {
31
+ if (name === 'floor')
32
+ name = 'taxonomy';
33
+ if (systems.has(name))
34
+ return;
35
+ const declaration = graph.registry.systems.get(name);
36
+ const matches = index.systems.filter((s) => s.system.identity === 'floor/definition/system/' + name);
37
+ if (!declaration || matches.length !== 1)
38
+ fail('Required system teaching is unavailable: ' + name);
39
+ const association = matches[0];
40
+ systems.add(name);
41
+ native(association.system, 'required owning system');
42
+ for (const item of [
43
+ ...association.methods,
44
+ ...(association.steward ? [association.steward] : []),
45
+ ...(association.base ? [association.base] : []),
46
+ ])
47
+ native(item, 'required system teaching occurrence');
48
+ for (const key of [...association.authoring, ...association.architecture, ...association.extensions])
49
+ resource(key);
50
+ for (const dependency of declaration.requires)
51
+ system(dependency.name);
52
+ // Retaining a declaration retains all its registrations: each needs its exact schema.
53
+ for (const registration of graph.registry.registrations.values())
54
+ if (registration.system === name || (name === 'taxonomy' && registration.system === 'floor')) {
55
+ const schema = graph.registry.schemas.get(registration.schema);
56
+ const occurrence = schema &&
57
+ inventory.find((o) => nativeResourcePath(capture, o) === schema.path && o.line === schema.span.line);
58
+ if (!occurrence)
59
+ fail('Required registration schema is unavailable');
60
+ native(occurrence, 'required registration schema');
61
+ }
62
+ };
63
+ const guide = (word) => {
64
+ const row = view.guides.find((g) => g.word === word);
65
+ if (!row || row.status !== 'resolved' || !row.descriptor || !row.schema || !row.document)
66
+ fail('Required primary guide is unavailable: ' + word);
67
+ native(row.descriptor, 'required primary guide descriptor');
68
+ native(row.schema, 'required primary guide schema');
69
+ resource(row.document.key);
70
+ system(row.owner);
71
+ };
72
+ const artifact = (id) => {
73
+ if (artifacts.has(id))
74
+ return;
75
+ const row = index.artifacts.find((a) => a.id === id);
76
+ if (!row)
77
+ fail('Required artifact is unavailable');
78
+ artifacts.add(id);
79
+ if (row.source.kind === 'native')
80
+ native(row.source.occurrence, 'required artifact source');
81
+ else
82
+ resource(row.source.key);
83
+ if (row.contract)
84
+ resource(row.contract);
85
+ for (const dependency of row.dependencies)
86
+ artifact(dependency);
87
+ for (const coordinate of row.lifecycle)
88
+ models.add(coordinate.model + '@' + coordinate.version);
89
+ };
90
+ const document = (id) => {
91
+ if (documents.has(id))
92
+ return;
93
+ const row = index.documents.find((d) => d.id === id);
94
+ if (!row)
95
+ fail('Required document is unavailable');
96
+ documents.add(id);
97
+ profiles.add(row.profile.id + '@' + row.profile.version);
98
+ // Preserve complete selected document membership; omission must not fabricate gaps.
99
+ for (const member of row.members)
100
+ artifact(member.artifact);
101
+ const profile = index.profiles.find((p) => p.id === row.profile.id && p.version === row.profile.version);
102
+ if (!profile)
103
+ fail('Required document profile is unavailable');
104
+ for (const role of profile.roles)
105
+ if (role.contract)
106
+ resource(role.contract);
107
+ };
108
+ const require = (request) => {
109
+ const pin = metadataDigest(request);
110
+ if (checkedRequests.has(pin))
111
+ return;
112
+ const requirements = prepareAuthoringTarget(view, request);
113
+ if (requirements.missing.length)
114
+ fail('Required authoring coverage is unavailable: ' + requirements.missing.map((m) => m.id).join(','));
115
+ checkedRequests.set(pin, { request, requirements });
116
+ const target = request.target;
117
+ if (!('kind' in target)) {
118
+ native(target, 'declared authoring target');
119
+ const node = graph.nodes.get(target.identity);
120
+ if (!node)
121
+ fail('Required native target is unavailable');
122
+ guide(node.discriminator);
123
+ }
124
+ else if (target.kind === 'word')
125
+ guide(target.word);
126
+ else if (target.kind === 'system')
127
+ system(target.name);
128
+ else if (target.kind === 'artifact')
129
+ artifact(target.id);
130
+ else
131
+ document(target.id);
132
+ if (request.document !== null)
133
+ document(request.document);
134
+ if (request.lifecycle)
135
+ models.add(request.lifecycle.model + '@' + request.lifecycle.version);
136
+ for (const part of requirements.parts) {
137
+ const o = nativeParts.get(part.id), key = resourceParts.get(part.id);
138
+ if (o)
139
+ native(o, 'required authoring dependency');
140
+ else if (key)
141
+ resource(key);
142
+ else if (part.id.startsWith('artifact-'))
143
+ artifact(part.id.slice('artifact-'.length));
144
+ else
145
+ fail('Unknown authoring requirement cannot be omitted');
146
+ }
147
+ };
148
+ const retainNode = (node) => {
149
+ const registration = graph.registry.registrations.get(node.discriminator);
150
+ if (!registration)
151
+ fail('Required registration is unavailable');
152
+ system(registration.system);
153
+ // Folder admission is independent of the discriminator's registration owner.
154
+ for (const occurrence of graph.occurrences.filter((o) => o.node.identity === node.identity)) {
155
+ const owner = systemMember(occurrence.node.source.path);
156
+ if (owner)
157
+ system(owner.name);
158
+ }
159
+ if (node.discriminator === 'system' && graph.registry.systems.has(node.name))
160
+ system(node.name);
161
+ for (const association of resources.associations)
162
+ if (association.owner.identity === node.identity) {
163
+ native(association.owner, 'retained explicit resource association');
164
+ for (const use of association.resources) {
165
+ if (use.required || resources.files.some((f) => keyOf(f.key) === keyOf(use.key)))
166
+ resource(use.key);
167
+ }
168
+ }
169
+ };
170
+ return {
171
+ native,
172
+ resource,
173
+ system,
174
+ guide,
175
+ require,
176
+ retainNode,
177
+ requirements: () => [...checkedRequests.values()],
178
+ finish: () => {
179
+ const body = {
180
+ format: resources.format,
181
+ sourceRevisions: resources.sourceRevisions,
182
+ nativeCaptureRevision: capture.revision,
183
+ files: resources.files.filter((f) => resourceKeys.has(keyOf(f.key))),
184
+ associations: resources.associations
185
+ .filter((a) => a.resources.some((u) => resourceKeys.has(keyOf(u.key))))
186
+ .map((a) => ({ ...a, resources: a.resources.filter((u) => resourceKeys.has(keyOf(u.key))) })),
187
+ };
188
+ const selectedResources = verifyResources({ ...body, digest: metadataDigest(body) }, capture);
189
+ const input = {
190
+ systems: index.systems.filter((s) => systems.has(s.system.identity.split('/').at(-1))),
191
+ artifacts: index.artifacts.filter((a) => artifacts.has(a.id)).map(({ revision: _revision, ...a }) => a),
192
+ documents: index.documents
193
+ .filter((d) => documents.has(d.id))
194
+ .map((d) => ({ ...d, members: d.members.map(({ revision: _revision, ...m }) => m) })),
195
+ profiles: index.profiles.filter((p) => profiles.has(p.id + '@' + p.version)),
196
+ lifecycles: index.lifecycles.filter((m) => models.has(m.id + '@' + m.version)),
197
+ };
198
+ return { resources: selectedResources, index: createAuthoringIndex(capture, selectedResources, input) };
199
+ },
200
+ };
201
+ }
202
+ //# sourceMappingURL=task-teaching-closure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-teaching-closure.js","sourceRoot":"","sources":["../src/task-teaching-closure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAU9E,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,4FAA4F;AAC5F,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,SAA4B,EAC5B,KAA6B,EAC7B,KAAY,EACZ,IAAmB,EACnB,SAAwD,EACxD,IAAgC;IAEhC,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC;IAC3D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxG,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,EACpC,OAAO,GA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CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvF,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC5E,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;aAC/E,CAAC;YACF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;QAC1G,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inventarch/agent-composition-system",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -117,6 +117,10 @@
117
117
  "types": "./dist/installed-catalog.d.ts",
118
118
  "default": "./dist/installed-catalog.js"
119
119
  },
120
+ "./internal/installed-read": {
121
+ "types": "./dist/installed-read.d.ts",
122
+ "default": "./dist/installed-read.js"
123
+ },
120
124
  "./internal/installed-source-policy": {
121
125
  "types": "./dist/installed-source-policy.d.ts",
122
126
  "default": "./dist/installed-source-policy.js"
@@ -125,6 +129,10 @@
125
129
  "types": "./dist/lifecycle-profile.d.ts",
126
130
  "default": "./dist/lifecycle-profile.js"
127
131
  },
132
+ "./internal/lifecycle-rows": {
133
+ "types": "./dist/lifecycle-rows.d.ts",
134
+ "default": "./dist/lifecycle-rows.js"
135
+ },
128
136
  "./internal/lifecycle-transport": {
129
137
  "types": "./dist/lifecycle-transport.d.ts",
130
138
  "default": "./dist/lifecycle-transport.js"
@@ -149,6 +157,10 @@
149
157
  "types": "./dist/projection-host.d.ts",
150
158
  "default": "./dist/projection-host.js"
151
159
  },
160
+ "./internal/projection-routine": {
161
+ "types": "./dist/projection-routine.d.ts",
162
+ "default": "./dist/projection-routine.js"
163
+ },
152
164
  "./internal/projections": {
153
165
  "types": "./dist/projections.d.ts",
154
166
  "default": "./dist/projections.js"
@@ -181,6 +193,22 @@
181
193
  "types": "./dist/sources.d.ts",
182
194
  "default": "./dist/sources.js"
183
195
  },
196
+ "./internal/task-capture-format": {
197
+ "types": "./dist/task-capture-format.d.ts",
198
+ "default": "./dist/task-capture-format.js"
199
+ },
200
+ "./internal/task-capture": {
201
+ "types": "./dist/task-capture.d.ts",
202
+ "default": "./dist/task-capture.js"
203
+ },
204
+ "./internal/task-context-declaration": {
205
+ "types": "./dist/task-context-declaration.d.ts",
206
+ "default": "./dist/task-context-declaration.js"
207
+ },
208
+ "./internal/task-teaching-closure": {
209
+ "types": "./dist/task-teaching-closure.d.ts",
210
+ "default": "./dist/task-teaching-closure.js"
211
+ },
184
212
  "./internal/templates": {
185
213
  "types": "./dist/templates.d.ts",
186
214
  "default": "./dist/templates.js"
@@ -195,17 +223,25 @@
195
223
  "README.md",
196
224
  "SPEC.md",
197
225
  "LICENSE",
198
- "NOTICE"
226
+ "NOTICE",
227
+ "LANGUAGE.md",
228
+ "references/installed-read.md",
229
+ "references/public-spec.md",
230
+ "references/spec-read-boundary.md",
231
+ "references/task-capture.md"
199
232
  ],
200
233
  "dependencies": {
201
- "@inventarch/session-system": "1.0.0",
202
- "@inventarch/agent-system": "1.0.0",
203
- "@inventarch/db": "1.0.0",
204
- "@inventarch/runtime": "1.0.0",
205
- "@inventarch/template-system": "1.0.0",
206
- "@inventarch/authoring-system": "1.0.0",
207
- "@inventarch/graph": "1.0.0",
208
- "@inventarch/language": "1.0.0"
234
+ "@inventarch/agent-system": "1.1.0",
235
+ "@inventarch/session-system": "1.1.0",
236
+ "@inventarch/authoring-system": "1.1.0",
237
+ "@inventarch/template-system": "1.1.0",
238
+ "@inventarch/runtime": "1.1.0",
239
+ "@inventarch/db": "1.1.0",
240
+ "@inventarch/language": "1.1.0",
241
+ "@inventarch/graph": "1.1.0",
242
+ "@inventarch/compliance-system": "1.1.0",
243
+ "@inventarch/governance-system": "1.1.0",
244
+ "@inventarch/workspace-system": "1.1.0"
209
245
  },
210
246
  "devDependencies": {
211
247
  "@types/node": "^22.19.0",
@@ -213,13 +249,13 @@
213
249
  "vitest": "^4.1.4"
214
250
  },
215
251
  "license": "Apache-2.0",
252
+ "engines": {
253
+ "node": ">=22.22.0 <23"
254
+ },
216
255
  "publishConfig": {
217
256
  "access": "public",
218
257
  "registry": "https://registry.npmjs.org"
219
258
  },
220
- "engines": {
221
- "node": ">=22.22.0 <23"
222
- },
223
259
  "repository": {
224
260
  "type": "git",
225
261
  "url": "git+https://github.com/inventarch/ia.git",
@@ -0,0 +1,36 @@
1
+ # First-party installed captured-source read
2
+
3
+ The operator approved first-party statically imported governed read adapters for the initial installed slice. This boundary does not admit executable plugins, third-party imports or private expert methodology. The producer layout remains `.ia/src/systems`; release selection remains owned by the packaging task.
4
+
5
+ The implementation extends the existing `Corpus` read consumer through an installed descriptor and adapter, the existing native harness compiler, execution-manifest conversion and Engine. It reads exact retained native capture bytes only. It does not load an operation from a source path, add filesystem access, issue grants or mutate a store. StageE `executeOwned` constraints remain unchanged.
6
+
7
+ The host retains an exact capture, compiled harness, installed catalogue and execution manifest and owns current grants. A required current-capture callback supplies fresh source identity without choosing executable code. The adapter checks the whole executable manifest, selected installed operation/validator descriptors and actual installed first-party code bytes; it requires Engine's current-authority callback before and after reading. A repeatable retry uses the same checks. Installation and catalogue compilation never invoke the read consumer.
8
+
9
+ Qualification must establish ordinary installed root exports, bounded captured reads, explicit refusal of outside paths and forged arguments, absent/expired/revoked grants and denied effects, changed source/code/catalogue/manifest pins, cancellation and close, policy evaluation, repeatable recovery with retained accounting and fresh authority, and no invocation during installation. Windows evidence alone cannot qualify other platforms. The fake model used for qualification does not establish live provider behavior or production tenant authorization.
10
+
11
+ Use the existing root exports `INSTALLED_READ`, `installedReadCatalog` and `installedReadAdapters`; no new package subpath or module loader is needed. Merge the catalogue fragment's validators and operations into the host's explicit `CompositionCatalog`. Its fixed operation identity is `authoring-system/binding/operation/read-captured-source`, implementation `captured-source-read-v1`, handler `ia.captured-source.read.v1`. The native operation's physical owner must be `agent-composition-system`, with governed-v1, read-only effects, repeatable recovery and the fixed input/output validator ids. An authored or adopted occurrence may select that first-party binding; the path supplies data and never executable code.
12
+
13
+ The native [operation](../operations/read-captured-source.ia) implements the dedicated `REQ-RT-CAPTURED-INPUT`, `REQ-RT-CAPTURED-READ` and `REQ-RT-CAPTURED-REFUSE` clauses in the [runtime contract](../contract.ia). The [canonical execution binding](../records/read-captured-source-binding.ia) is available for explicit host selection; no shipped production harness selects it. Its presence grants no operation or effect. The [success and authority-refusal cases](../cases/read-captured-source.ia) name `tests/installed-read.test.ts`, which reads their admitted operation, contract and result declarations while checking actual retained-byte reads and authority refusals. The portable fixture selects this same binding in its test-owned harness.
14
+
15
+ After ordinary `compileHarness` and `executionManifest`, bind:
16
+
17
+ ```ts
18
+ const read = installedReadAdapters(capture, {
19
+ manifest, compiled, catalog, principal,
20
+ currentCapture: () => hostOwnedCurrentCapture(),
21
+ });
22
+ const operations = { ...otherFirstPartyAdapters, ...read.operations };
23
+ // Supply operations to EngineHost; that host also owns authorization,
24
+ // full current-manifest/code verification, policy evaluation and preflight.
25
+ // Retain the captured reader throughout this host/session ownership.
26
+ ```
27
+
28
+ Call `read.close()` when the owning host/session ends, after in-flight reads settle. Keep it open while a session may wait, resume or retry. Closing immediately after binding causes the first dispatch to refuse.
29
+
30
+ The constructor reconstructs the whole execution manifest and recompiles the selected harness from the same retained capture. A rehashed but forged compiled object therefore cannot establish the binding. This first slice uses a common task/definition capture; a separately retained hosted definition capture is not implicitly admitted. The host callback returns a current verified Capture, not a boolean assertion of freshness or a module path. It is never called during catalogue creation, compilation or adapter construction. Actual reads require a real Engine `assertCurrent` consumer before and after the read, a current permitted profile/agent, principal, workspace, operation, effect, capture and grant deadline. All required compiled evaluators and preflight remain Engine responsibilities; a forged no-op callback is not independently authenticated authority.
31
+
32
+ Inputs are a closed object with exact captured `path`, optional zero-based `start` (0–100000) and `limit` (1–400). Extra root, actor, module, source or authority selectors refuse. Inputs are snapshotted before awaits. The operation exposes only the existing Corpus read path, with a 10-second contract, 65536-byte complete-output ceiling, exact capture revision and one citation. It returns effect none, never draft artifacts, filesystem reads beyond the capture, writes or store access. An oversized result refuses rather than truncating data into an unpinned contract.
33
+
34
+ Installed byte hashing reuses the fixed installed first-party package entrypoints; it does not discover plugins or attest a signed release or already-loaded process code. Trusted release selection, an immutable deployment and actual host authority remain required. Captured native data are scoped at the granted Capture revision; this is not a new tenant or database authorization mechanism.
35
+
36
+ `tests/installed-read-fixture.mjs` runs under ordinary Node against installed root exports with deterministic fake-model adapters and memory/SQLite stores. Its optional `--mutate-installed-code` flag is only for a disposable installed consumer: it replaces and restores that consumer's fixed module directory entry to test byte drift before read and retry, without writing through pnpm store hard links. Final published namespace, public native operation selection and archive safety remain the release owner's separate qualification.
@@ -0,0 +1,7 @@
1
+ # Public maintained specifications and explicit bodies
2
+
3
+ The existing work-system @spec records a maintained specification. Its canonical closed schema requires meaning, title and a draft, accepted, superseded or withdrawn status. A spec may supersede at most one other spec. A decision records a choice; a playbook records a method; a contract declares boundary obligations; explicit adoption and a selected executable consumer provide enforcement. Status and admission do not establish semantic quality or execution evidence.
4
+
5
+ The author chooses a specification's contents, decomposition and document/resource membership using the existing captured-resource and authoring APIs. work.source is a text locator, not an implicit body loader. The first-party installed native reader returns captured IA source; Markdown bodies require explicit byte-pinned capture, association and separate disclosure authority.
6
+
7
+ The neutral public-spec-fixture uses a consumer-owned anchor, exact Markdown bytes, a resource association and a fixture-only document profile. It demonstrates current capture, artifact/document membership, honest missing evidence and refused stale/digest/scope inputs through installed APIs. It does not define product vision, brief, requirements vocabulary or new lifecycle policy.
@@ -0,0 +1,17 @@
1
+ # Read a spec anchor and its explicit body
2
+
3
+ The [public spec seam](public-spec.md) and [first-party installed read](installed-read.md) use separate access boundaries. A current Engine grant for the native capture can read an admitted `@spec` anchor. Its `work.source "documents/specification.md"` is a locator; that grant does not make Markdown a native source or disclose a resource body.
4
+
5
+ The neutral `tests/spec-read-boundary-fixture.mjs` recipe copies selected public native sources into a fresh caller-selected workspace and authors one draft spec anchor and a literal Markdown body. It reuses the installed-read example's existing harness and installed contracts. A scripted provider makes one real Engine operation read of the anchor and one refused native read of the body path. This is qualification code: its model, evaluator and grants are deterministic host fixtures, not application authorization.
6
+
7
+ The caller then supplies the exact resource source revision, body path, size, SHA-256, media type, encoding and association to that admitted spec occurrence. `captureResources` retains those bytes; `resolveResources` additionally requires the native handle scope, selected owner, matching envelope digest, finite byte budget and independently allowed resource key. An empty resource allowlist refuses the required body even after the native read succeeds. Supplying the exact allowed key returns the captured Markdown bytes and citation. No model receives body prose through the native read. Semantic coherence and artifact/document membership remain governed by the existing [public spec example](public-spec.md).
8
+
9
+ Run the recipe from an installed public consumer containing the two recipe modules and its selected native extraction:
10
+
11
+ ```sh
12
+ node spec-read-boundary-fixture.mjs <public-native-root> <new-empty-output>
13
+ ```
14
+
15
+ Use a nonexistent output directory; the recipe refuses an existing path. The installed recipe uses the release's public package names. Ordinary Node runs it against compiled installed exports, with no development condition or TypeScript loader. The output records capture, compilation, installed-code and resource identities, provider and dispatch counts, native body-path refusal and separate body-disclosure refusal. Output files are caller-owned fixture data.
16
+
17
+ The current source callback and grants must be supplied by an authentic application host in production. The host also owns the resource root and disclosure allowlist; passing a resource key into this pure API is not authentication. A successful native read proves the retained anchor bytes were disclosed under that host's checks; it does not prove body freshness, semantic quality, a new policy or a release-wide acceptance result.
@@ -0,0 +1,23 @@
1
+ # Complete task capture
2
+
3
+ The root exports `prepareTaskCapture`, `verifyTaskCapture`, `taskCaptureRequest`, `TaskCaptureError` and their types. A host supplies a complete authorized native/resource/index view, a current-state check, and a `resolveTaskContext(request)` callback selecting an already reviewed declaration. Remote requests still contain only the exact work identity and phase/primitive. Missing host authority refuses.
4
+
5
+ The closed `TaskContextDeclaration` binds exact task and made grounding-decision occurrences, the explicit coordinate, affected native source paths, complete existing authoring requests (including document/lifecycle applicability) and any extra required resources. A null document or lifecycle is the host's affirmative declaration that it is inapplicable. It is never inferred from a missing check. Neither the declaration nor a made status is a write grant.
6
+
7
+ The fixed policy retains global/unscoped governance and any governance that existing native selectors cannot definitively disqualify using the declared coordinates. Missing coordinate axes do not justify omission. It adds required schema, registration, owning-system and teaching context. Required authoring inputs use the existing guide, artifact, document-role and lifecycle semantics.
8
+
9
+ Prerequisites and typed parent references are followed outward. Governing, constraining, forbidding and enforcing records are followed inward, as are made decisions grounding selected work. Supersession retains history and an unambiguous successor without replacing the selected task or granting current authority. A stale basis, conflicting successors or cycles refuse. Reverse prerequisites, milestone siblings and cited-by records are not automatically relevant.
10
+
11
+ Selection retains whole native files and every authored relationship endpoint and outgoing typed reference from co-located records, including inverse assertions and nonblocking citations. Enclosing system declarations are retained independently of the registration owner. Empty omitted system folders do not remain as fabricated source observations. It preserves the complete native floor and competing resolution occurrences. Every omission includes its original hash and policy reason. There is no prose ranking, record slicing or silent truncation. Unknown source bytes remain conservative.
12
+
13
+ Compiler-required contract case producers must be explicit authoring targets when the closure depends on them; selection does not infer every incoming implementation is relevant. Missing coverage refuses admission.
14
+
15
+ Only positively required resource/index associations are retained. Complete selected document membership remains intact; expected outputs are not fabricated as inputs. Extra resources supplement computed teaching and cannot subtract from it. Re-admission must preserve all retained winner bytes, relationship completeness and required authoring semantics.
16
+
17
+ A version-2 capture pins the declaration digest, policy, implementation, full source/resource/index, selected teaching and closure proof. The exact known historical policy remains readable, but current admission requires a fresh reviewed declaration and recomputation. Unknown policy implementations fail closed. Whole-workspace version-1 capture remains unchanged. Disclosure includes the reviewed declaration and every selected/omitted file and required resource pin. Client and receiver must select byte-identical implementation files (absolute install paths may differ). Development source, a different compiled release or a bundled build is not implicitly compatible. A trusted bundled host may supply its verified matching artifact digest; no caller digest or compatibility allowlist is accepted. Mismatched implementation bytes produce the distinct implementation refusal before closure recomputation. The receiver must recompute using its own current trusted full view and declaration; accepting a caller's subset or digest as completeness is unavailable.
18
+
19
+ The exact serialized native capture, including scope metadata, must fit **716800 bytes**. A smaller caller limit is allowed; widening is unavailable. Resources and disclosure retain their separate existing limits. Required overflow records the measured size and proof. Freshness covers excluded files, authoring metadata and the declaration itself.
20
+
21
+ Compose complete authorized personal/project views before selection. Mounting a selected subset refuses so that composition cannot erase scope. This is task-context preparation; private whole-corpus review, effect authority, authentication, grants and execution budgets remain independent.
22
+
23
+ A real task may still overflow this policy. Such a refusal describes this declared closure, not a minimum size across all imaginable policies. Synthetic or installed checks do not establish a deployed host's authority or whole-product release readiness.