@inventarch/workspace-runtime 2.0.0 → 3.0.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/README.md +3 -1
- package/SPEC.md +13 -1
- package/dist/bind.d.ts +87 -0
- package/dist/bind.d.ts.map +1 -0
- package/dist/bind.js +75 -0
- package/dist/bind.js.map +1 -0
- package/dist/corpus.js +3 -3
- package/dist/corpus.js.map +1 -1
- package/dist/generate/agent-profile.d.ts +10 -0
- package/dist/generate/agent-profile.d.ts.map +1 -0
- package/dist/generate/agent-profile.js +219 -0
- package/dist/generate/agent-profile.js.map +1 -0
- package/dist/generate/definitions.d.ts +26 -0
- package/dist/generate/definitions.d.ts.map +1 -0
- package/dist/generate/definitions.js +97 -0
- package/dist/generate/definitions.js.map +1 -0
- package/dist/generate/format.d.ts +74 -0
- package/dist/generate/format.d.ts.map +1 -0
- package/dist/generate/format.js +151 -0
- package/dist/generate/format.js.map +1 -0
- package/dist/generate/hook.d.ts +51 -0
- package/dist/generate/hook.d.ts.map +1 -0
- package/dist/generate/hook.js +122 -0
- package/dist/generate/hook.js.map +1 -0
- package/dist/generate/index.d.ts +8 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +7 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/generate/playbook.d.ts +10 -0
- package/dist/generate/playbook.d.ts.map +1 -0
- package/dist/generate/playbook.js +74 -0
- package/dist/generate/playbook.js.map +1 -0
- package/dist/installed-source-policy.js +2 -2
- package/dist/installed-source-policy.js.map +1 -1
- package/dist/record-fields.d.ts +12 -0
- package/dist/record-fields.d.ts.map +1 -0
- package/dist/record-fields.js +14 -0
- package/dist/record-fields.js.map +1 -0
- package/dist/resource-context.d.ts.map +1 -1
- package/dist/resource-context.js +4 -3
- package/dist/resource-context.js.map +1 -1
- package/dist/resource-sources.d.ts.map +1 -1
- package/dist/resource-sources.js +3 -0
- package/dist/resource-sources.js.map +1 -1
- package/package.json +21 -9
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { frozen } from '../resource-format.js';
|
|
2
|
+
import { authoredOf, capabilityClosure, closureRefusal, knownHost, textsAt, valuesAt } from './format.js';
|
|
3
|
+
import { generateAgentProfiles } from './agent-profile.js';
|
|
4
|
+
import { generatePlaybookSkills } from './playbook.js';
|
|
5
|
+
import { generateHookSet } from './hook.js';
|
|
6
|
+
/** The host set for `host` through the scope token `within` (see `HostSet`). */
|
|
7
|
+
export function generateHostSet(reader, within, host) {
|
|
8
|
+
knownHost(host);
|
|
9
|
+
const agents = generateAgentProfiles(reader, within, host), skills = generatePlaybookSkills(reader, within, host), hooks = generateHookSet(reader, within, host);
|
|
10
|
+
return frozen({
|
|
11
|
+
files: [...agents.files, ...skills.files],
|
|
12
|
+
hooks: hooks.hooks,
|
|
13
|
+
unsupported: [...agents.unsupported, ...skills.unsupported, ...hooks.unsupported],
|
|
14
|
+
definitions: definitionsOf(reader, within, [...agents.files, ...skills.files], hooks.hooks),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Definitions of authored `@operation` and `@harness` records (milestone generation-binding, task
|
|
19
|
+
* generation-operation-harness; plan amendment C11), for the receipt's `definitions` section: `generateHostSet`'s.
|
|
20
|
+
*/
|
|
21
|
+
export function generateDefinitions(reader, within, host) {
|
|
22
|
+
return generateHostSet(reader, within, host).definitions;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An operation's `execution.handler`, `input` and `output` are catalog keys an installed implementation answers, copied
|
|
26
|
+
* as authored: nothing here imports, resolves, serves or executes them (milestone 7 owns execution). A harness lists the
|
|
27
|
+
* registration set its profiles and bindings select among `files` and `hooks`: the agent files rendered for its
|
|
28
|
+
* profiles, the skills rendered for the playbooks their capabilities and every capability those include name, and the
|
|
29
|
+
* registered hooks its bindings target. A record that renders or registers nothing for the host (an unsupported one, or
|
|
30
|
+
* any agent or hook for codex) selects nothing, so hook or agent support never fails the definitions. Only authored
|
|
31
|
+
* (band 100) records are defined.
|
|
32
|
+
*/
|
|
33
|
+
function definitionsOf(reader, within, files, hooks) {
|
|
34
|
+
const records = reader.records({ within }), nodes = new Map(records.map((node) => [node.identity, node]));
|
|
35
|
+
const targets = (node, field) => reader
|
|
36
|
+
.directedView(node.identity, { within })
|
|
37
|
+
.filter((row) => row.kind === 'field-ref' && row.direction === 'out' && row.field === field)
|
|
38
|
+
.map((row) => row.counterpart);
|
|
39
|
+
const target = (value) => {
|
|
40
|
+
if (value.kind !== 'ref')
|
|
41
|
+
return undefined;
|
|
42
|
+
const resolved = reader.resolve(value, { within });
|
|
43
|
+
return resolved.ok ? nodes.get(resolved.identity) : undefined;
|
|
44
|
+
};
|
|
45
|
+
const agents = files.filter((file) => file.word === 'agent-profile'), skills = files.filter((file) => file.word === 'playbook');
|
|
46
|
+
const first = (node, field) => textsAt(node, field)[0];
|
|
47
|
+
const operation = (node) => {
|
|
48
|
+
const handler = first(node, 'execution.handler'), input = first(node, 'execution.input'), output = first(node, 'execution.output');
|
|
49
|
+
const definition = {
|
|
50
|
+
name: node.name,
|
|
51
|
+
description: first(node, 'meaning.says') ?? '',
|
|
52
|
+
...(handler === undefined ? {} : { handler }),
|
|
53
|
+
...(input === undefined ? {} : { input }),
|
|
54
|
+
...(output === undefined ? {} : { output }),
|
|
55
|
+
effects: textsAt(node, 'execution.effects'),
|
|
56
|
+
};
|
|
57
|
+
return { identity: node.identity, word: 'operation', definition };
|
|
58
|
+
};
|
|
59
|
+
const harness = (node) => {
|
|
60
|
+
const profiles = targets(node, 'composition.profiles'), bindings = targets(node, 'composition.bindings'), workspace = targets(node, 'composition.workspace')[0], hostProfile = first(node, 'execution.host-profile');
|
|
61
|
+
const selected = new Set(profiles);
|
|
62
|
+
for (const id of profiles) {
|
|
63
|
+
const profile = nodes.get(id);
|
|
64
|
+
if (profile === undefined)
|
|
65
|
+
continue;
|
|
66
|
+
// A closure the composition compiler refuses selects nothing (review finding A-RC5).
|
|
67
|
+
const roots = valuesAt(profile, 'composition.capabilities');
|
|
68
|
+
if (closureRefusal(roots, target) !== undefined)
|
|
69
|
+
continue;
|
|
70
|
+
for (const capability of capabilityClosure(roots, target))
|
|
71
|
+
for (const playbook of targets(capability, 'composition.playbooks'))
|
|
72
|
+
selected.add(playbook);
|
|
73
|
+
}
|
|
74
|
+
for (const id of bindings) {
|
|
75
|
+
const binding = nodes.get(id);
|
|
76
|
+
if (binding !== undefined)
|
|
77
|
+
for (const bound of targets(binding, 'binding.target'))
|
|
78
|
+
selected.add(bound);
|
|
79
|
+
}
|
|
80
|
+
const definition = {
|
|
81
|
+
name: node.name,
|
|
82
|
+
description: first(node, 'meaning.says') ?? '',
|
|
83
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
84
|
+
...(hostProfile === undefined ? {} : { hostProfile }),
|
|
85
|
+
profiles,
|
|
86
|
+
bindings,
|
|
87
|
+
registrations: {
|
|
88
|
+
agents: agents.filter((file) => selected.has(file.identity)).map(({ identity, path }) => ({ identity, path })),
|
|
89
|
+
skills: skills.filter((file) => selected.has(file.identity)).map(({ identity, path }) => ({ identity, path })),
|
|
90
|
+
hooks: hooks.filter((hook) => selected.has(hook.identity)),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
return { identity: node.identity, word: 'harness', definition };
|
|
94
|
+
};
|
|
95
|
+
return frozen([...authoredOf(records, 'operation').map(operation), ...authoredOf(records, 'harness').map(harness)]);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/generate/definitions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE1G,OAAO,EAAE,qBAAqB,EAAE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E,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC9G,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC9G,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC3D;SACF,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IAClE,CAAC,CAAC;IACF,OAAO,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Node } from '@inventarch/graph';
|
|
2
|
+
import type { CompiledValue } from '@inventarch/language';
|
|
3
|
+
import type { DefinitionWord, GeneratedFileWord, GeneratedRecordWord, PacketHost, UnsupportedRow } from '@inventarch/runtime';
|
|
4
|
+
/**
|
|
5
|
+
* What the host generators share (milestone generation-binding): the generated file and the unsupported row they
|
|
6
|
+
* return, the per-record rendering that reports a record instead of failing the others, the host and name checks, the
|
|
7
|
+
* authored records they render, the capability closure, and the field readers and text helpers their bodies are written
|
|
8
|
+
* with.
|
|
9
|
+
*/
|
|
10
|
+
/** The words a generator renders records of: runtime's unions, stated once there. */
|
|
11
|
+
export type GeneratedWord = GeneratedRecordWord | DefinitionWord;
|
|
12
|
+
/** One generated host file and the record it renders. */
|
|
13
|
+
export interface GeneratedFile {
|
|
14
|
+
/** Workspace-relative and `/`-separated. */
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly text: string;
|
|
17
|
+
/** The identity of the rendered record. */
|
|
18
|
+
readonly identity: string;
|
|
19
|
+
readonly word: GeneratedFileWord;
|
|
20
|
+
}
|
|
21
|
+
/** An authored record a host does not render or register, and why: the projection receipt's `unsupported` row. */
|
|
22
|
+
export type UnsupportedRecord = UnsupportedRow;
|
|
23
|
+
/** What a file generator returns: the files it renders, and one row for each authored record it does not. */
|
|
24
|
+
export interface GeneratedSet {
|
|
25
|
+
readonly files: readonly GeneratedFile[];
|
|
26
|
+
readonly unsupported: readonly UnsupportedRecord[];
|
|
27
|
+
}
|
|
28
|
+
/** An unknown host is IA-PROJECTION-INPUT-INVALID. */
|
|
29
|
+
export declare function knownHost(host: PacketHost): void;
|
|
30
|
+
/**
|
|
31
|
+
* A name that becomes a host path segment: lower-case letters, digits and single hyphens, a letter first and no hyphen
|
|
32
|
+
* last, at most 64 characters (the agent and skill name rule), and no Windows device name (`con`, `prn`, `aux`, `nul`,
|
|
33
|
+
* `com0`-`com9`, `lpt0`-`lpt9`, the rule db's input paths apply). IA-PROJECTION-INPUT-INVALID otherwise.
|
|
34
|
+
*/
|
|
35
|
+
export declare function safeName(name: string): string;
|
|
36
|
+
/** The records of `word` among `records` that the workspace authors (band 100), by identity. */
|
|
37
|
+
export declare const authoredOf: (records: readonly Node[], word: GeneratedWord) => readonly Node[];
|
|
38
|
+
/**
|
|
39
|
+
* Render each record with `render`, in order. A record `render` or its text refuses with an IA-PROJECTION-* error is
|
|
40
|
+
* not rendered and becomes an unsupported row naming the record and the reason, and the others still render (review
|
|
41
|
+
* findings A-R3 and A-R6). Every rendered text must be inert prose (projection-host's `inert`: no executable dynamic
|
|
42
|
+
* context, no active HTML), as the prose projector requires of the same records. Any other error still fails.
|
|
43
|
+
*/
|
|
44
|
+
export declare function perRecord(word: UnsupportedRecord['word'], nodes: readonly Node[], render: (node: Node) => GeneratedFile): GeneratedSet;
|
|
45
|
+
/**
|
|
46
|
+
* A profile's capabilities and every capability they include, through `composition.includes`, each once, in first-reached
|
|
47
|
+
* order; a reference no admitted `@capability` answers is left out, and a cycle ends where it meets a capability already
|
|
48
|
+
* reached (`closureRefusal` says whether the composition compiler would refuse it).
|
|
49
|
+
*/
|
|
50
|
+
export declare function capabilityClosure(roots: readonly CompiledValue[], target: (value: CompiledValue) => Node | undefined): readonly Node[];
|
|
51
|
+
/**
|
|
52
|
+
* Why the composition compiler refuses a profile's capability closure, or undefined when it does not (review finding
|
|
53
|
+
* A-RC5): an inclusion cycle, or an included capability whose effects its includer does not declare (the compiler holds
|
|
54
|
+
* each capability to its own `execution.effects` as a ceiling over what it includes).
|
|
55
|
+
*/
|
|
56
|
+
export declare function closureRefusal(roots: readonly CompiledValue[], target: (value: CompiledValue) => Node | undefined): string | undefined;
|
|
57
|
+
import { fieldsOf, stated, textsAt, valuesAt } from '../record-fields.js';
|
|
58
|
+
export { fieldsOf, stated, textsAt, valuesAt };
|
|
59
|
+
/** `text` on one line, as the packet writes an entry (runtime's `inline`), its controls made spaces. */
|
|
60
|
+
export declare const inline: (text: string) => string;
|
|
61
|
+
/** `text` as one code span, as the packet writes one (runtime's `code`). */
|
|
62
|
+
export declare const code: (text: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Authored free text for a Markdown body: on one line, each bare IA word token a code span as the packet writes it
|
|
65
|
+
* (runtime's `prose`, review finding N1); a `!` that a code span the rendering opened would follow is written `!`,
|
|
66
|
+
* so no rendered span reads as dynamic context (A-RC2); every `<!--` is written `<!--`, so no authored value opens an
|
|
67
|
+
* HTML comment that hides what follows or reads as a marker line (N3, N4); and a leading `<` is written `<`, so no
|
|
68
|
+
* value opens an HTML block (A-RC3).
|
|
69
|
+
*/
|
|
70
|
+
export declare const prose: (text: string) => string;
|
|
71
|
+
/** A list's items, comma-separated, or `none`. */
|
|
72
|
+
export declare const list: (items: readonly string[]) => string;
|
|
73
|
+
export declare const section: (heading: string, lines: readonly string[]) => readonly string[];
|
|
74
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/generate/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,cAAc,EACf,MAAM,qBAAqB,CAAC;AAU7B;;;;;GAKG;AAEH,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,cAAc,CAAC;AACjE,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AACD,kHAAkH;AAClH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAC/C,6GAA6G;AAC7G,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACpD;AAKD,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAE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M,OAAO,GAAI,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,KAAG,SAAS,MAAM,EAKlF,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { code as packetCode, inline as packetInline, prose as packetProse, } from '@inventarch/runtime/internal/packet-host';
|
|
2
|
+
import { inputFailure, ProjectionError } from '../projection-format.js';
|
|
3
|
+
import { inert } from '../projection-host.js';
|
|
4
|
+
import { frozen } from '../resource-format.js';
|
|
5
|
+
/** Records the workspace itself authors; an installed or adopted base sits at a lower band. */
|
|
6
|
+
const AUTHORED = 100;
|
|
7
|
+
/** An unknown host is IA-PROJECTION-INPUT-INVALID. */
|
|
8
|
+
export function knownHost(host) {
|
|
9
|
+
if (host !== 'claude' && host !== 'codex')
|
|
10
|
+
inputFailure(`Unknown host: ${String(host)}`);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A name that becomes a host path segment: lower-case letters, digits and single hyphens, a letter first and no hyphen
|
|
14
|
+
* last, at most 64 characters (the agent and skill name rule), and no Windows device name (`con`, `prn`, `aux`, `nul`,
|
|
15
|
+
* `com0`-`com9`, `lpt0`-`lpt9`, the rule db's input paths apply). IA-PROJECTION-INPUT-INVALID otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export function safeName(name) {
|
|
18
|
+
if (!/^[a-z][a-z0-9-]{0,63}$/.test(name) ||
|
|
19
|
+
name.endsWith('-') ||
|
|
20
|
+
name.includes('--') ||
|
|
21
|
+
/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/.test(name))
|
|
22
|
+
inputFailure(`Unsafe generated host name: ${name}`);
|
|
23
|
+
return name;
|
|
24
|
+
}
|
|
25
|
+
/** The records of `word` among `records` that the workspace authors (band 100), by identity. */
|
|
26
|
+
export const authoredOf = (records, word) => records
|
|
27
|
+
.filter((node) => node.discriminator === word && node.band === AUTHORED)
|
|
28
|
+
.sort((a, b) => (a.identity < b.identity ? -1 : a.identity > b.identity ? 1 : 0));
|
|
29
|
+
/**
|
|
30
|
+
* Render each record with `render`, in order. A record `render` or its text refuses with an IA-PROJECTION-* error is
|
|
31
|
+
* not rendered and becomes an unsupported row naming the record and the reason, and the others still render (review
|
|
32
|
+
* findings A-R3 and A-R6). Every rendered text must be inert prose (projection-host's `inert`: no executable dynamic
|
|
33
|
+
* context, no active HTML), as the prose projector requires of the same records. Any other error still fails.
|
|
34
|
+
*/
|
|
35
|
+
export function perRecord(word, nodes, render) {
|
|
36
|
+
const files = [], unsupported = [];
|
|
37
|
+
for (const node of nodes)
|
|
38
|
+
try {
|
|
39
|
+
const file = render(node);
|
|
40
|
+
inert(file.text);
|
|
41
|
+
files.push(file);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (!(error instanceof ProjectionError))
|
|
45
|
+
throw error;
|
|
46
|
+
unsupported.push({ identity: node.identity, word, reason: error.message });
|
|
47
|
+
}
|
|
48
|
+
return frozen({ files, unsupported });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A profile's capabilities and every capability they include, through `composition.includes`, each once, in first-reached
|
|
52
|
+
* order; a reference no admitted `@capability` answers is left out, and a cycle ends where it meets a capability already
|
|
53
|
+
* reached (`closureRefusal` says whether the composition compiler would refuse it).
|
|
54
|
+
*/
|
|
55
|
+
export function capabilityClosure(roots, target) {
|
|
56
|
+
const reached = new Map();
|
|
57
|
+
const visit = (value) => {
|
|
58
|
+
const node = target(value);
|
|
59
|
+
if (node === undefined || node.discriminator !== 'capability' || reached.has(node.identity))
|
|
60
|
+
return;
|
|
61
|
+
reached.set(node.identity, node);
|
|
62
|
+
for (const included of valuesAt(node, 'composition.includes'))
|
|
63
|
+
visit(included);
|
|
64
|
+
};
|
|
65
|
+
for (const root of roots)
|
|
66
|
+
visit(root);
|
|
67
|
+
return [...reached.values()];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Why the composition compiler refuses a profile's capability closure, or undefined when it does not (review finding
|
|
71
|
+
* A-RC5): an inclusion cycle, or an included capability whose effects its includer does not declare (the compiler holds
|
|
72
|
+
* each capability to its own `execution.effects` as a ceiling over what it includes).
|
|
73
|
+
*/
|
|
74
|
+
export function closureRefusal(roots, target) {
|
|
75
|
+
const done = new Set(), open = new Set();
|
|
76
|
+
const visit = (node) => {
|
|
77
|
+
if (done.has(node.identity))
|
|
78
|
+
return undefined;
|
|
79
|
+
if (open.has(node.identity))
|
|
80
|
+
return `its capabilities include one another in a cycle at ${node.identity}`;
|
|
81
|
+
open.add(node.identity);
|
|
82
|
+
const own = new Set(textsAt(node, 'execution.effects'));
|
|
83
|
+
for (const value of valuesAt(node, 'composition.includes')) {
|
|
84
|
+
const child = target(value);
|
|
85
|
+
if (child === undefined || child.discriminator !== 'capability')
|
|
86
|
+
continue;
|
|
87
|
+
const refused = visit(child);
|
|
88
|
+
if (refused !== undefined)
|
|
89
|
+
return refused;
|
|
90
|
+
const exceeding = textsAt(child, 'execution.effects').filter((effect) => !own.has(effect));
|
|
91
|
+
if (exceeding.length > 0)
|
|
92
|
+
return `${child.identity} has effects (${exceeding.join(', ')}) its includer ${node.identity} does not declare`;
|
|
93
|
+
}
|
|
94
|
+
open.delete(node.identity);
|
|
95
|
+
done.add(node.identity);
|
|
96
|
+
return undefined;
|
|
97
|
+
};
|
|
98
|
+
for (const root of roots) {
|
|
99
|
+
const node = target(root);
|
|
100
|
+
if (node === undefined || node.discriminator !== 'capability')
|
|
101
|
+
continue;
|
|
102
|
+
const refused = visit(node);
|
|
103
|
+
if (refused !== undefined)
|
|
104
|
+
return refused;
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
// The field readers are the package's one copy (../record-fields.ts, which re-exports runtime's packet readers).
|
|
109
|
+
import { fieldsOf, stated, textsAt, valuesAt } from '../record-fields.js';
|
|
110
|
+
export { fieldsOf, stated, textsAt, valuesAt };
|
|
111
|
+
// Built from strings: the class names the control characters themselves.
|
|
112
|
+
const CONTROLS = new RegExp('[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]', 'g');
|
|
113
|
+
/**
|
|
114
|
+
* Authored text as a generated file may hold it (review finding N2): every C0 or C1 control but tab and the line breaks
|
|
115
|
+
* `inline` folds, the Unicode line and paragraph separators, and the bidirectional controls become a space, so no value
|
|
116
|
+
* can start a YAML or Markdown line, drive a terminal or reorder what a reader sees.
|
|
117
|
+
*/
|
|
118
|
+
const plain = (text) => text.replace(CONTROLS, ' ');
|
|
119
|
+
/** `text` on one line, as the packet writes an entry (runtime's `inline`), its controls made spaces. */
|
|
120
|
+
export const inline = (text) => packetInline(plain(authored(text)));
|
|
121
|
+
/** `text` as one code span, as the packet writes one (runtime's `code`). */
|
|
122
|
+
export const code = (text) => packetCode(plain(text));
|
|
123
|
+
/**
|
|
124
|
+
* An authored value must itself be inert prose (projection-host's `inert`: no executable dynamic context such as
|
|
125
|
+
* `!\`cmd\``, no active HTML, no unbalanced code span or fence), so a record is reported for what its own text holds
|
|
126
|
+
* rather than for what rendering made of it (review finding A-RC2). IA-PROJECTION-FEATURE-UNAVAILABLE otherwise.
|
|
127
|
+
*/
|
|
128
|
+
function authored(text) {
|
|
129
|
+
inert(text);
|
|
130
|
+
return text;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Authored free text for a Markdown body: on one line, each bare IA word token a code span as the packet writes it
|
|
134
|
+
* (runtime's `prose`, review finding N1); a `!` that a code span the rendering opened would follow is written `!`,
|
|
135
|
+
* so no rendered span reads as dynamic context (A-RC2); every `<!--` is written `<!--`, so no authored value opens an
|
|
136
|
+
* HTML comment that hides what follows or reads as a marker line (N3, N4); and a leading `<` is written `<`, so no
|
|
137
|
+
* value opens an HTML block (A-RC3).
|
|
138
|
+
*/
|
|
139
|
+
export const prose = (text) => packetProse(plain(authored(text)))
|
|
140
|
+
.replace(/!(\s*)`/g, '!$1`')
|
|
141
|
+
.replaceAll('<!--', '<!--')
|
|
142
|
+
.replace(/^</, '<');
|
|
143
|
+
/** A list's items, comma-separated, or `none`. */
|
|
144
|
+
export const list = (items) => (items.length === 0 ? 'none' : items.join(', '));
|
|
145
|
+
export const section = (heading, lines) => [
|
|
146
|
+
'',
|
|
147
|
+
`## ${heading}`,
|
|
148
|
+
'',
|
|
149
|
+
...lines,
|
|
150
|
+
];
|
|
151
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/generate/format.ts"],"names":[],"mappings":"AASA,OAAO,EACL,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,EACtB,KAAK,IAAI,WAAW,GACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AA4B/C,+FAA+F;AAC/F,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,sDAAsD;AACtD,MAAM,UAAU,SAAS,CAAC,IAAgB;IACxC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO;QAAE,YAAY,CAAC,iBAAiB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC;AACD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IACE,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACnB,uCAAuC,CAAC,IAAI,CAAC,IAAI,CAAC;QAElD,YAAY,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC;AACd,CAAC;AACD,gGAAgG;AAChG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e,EAAE,KAAwB,EAAqB,EAAE,CAAC;IACvF,EAAE;IACF,MAAM,OAAO,EAAE;IACf,EAAE;IACF,GAAG,KAAK;CACT,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReadHandle } from '@inventarch/db';
|
|
2
|
+
import type { Node } from '@inventarch/graph';
|
|
3
|
+
import type { HostHookDeclaration, PacketHost } from '@inventarch/runtime';
|
|
4
|
+
import type { UnsupportedRecord } from './format.js';
|
|
5
|
+
/**
|
|
6
|
+
* The identities a hook registration can carry on the guard's command line: a canonical `system/kind/facet/name` of the
|
|
7
|
+
* language's lower-cased name characters, bounded. Every admitted record's identity has this shape (its name is
|
|
8
|
+
* `[A-Za-z][A-Za-z0-9-]*`, lower-cased), so only the bound can refuse one. A hook's name is not a host path, so no
|
|
9
|
+
* portable-name rule applies to it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HOOK_IDENTITY: RegExp;
|
|
12
|
+
export declare const HOOK_IDENTITY_LIMIT = 512;
|
|
13
|
+
export declare const registrableHook: (identity: unknown) => identity is string;
|
|
14
|
+
/**
|
|
15
|
+
* The bounds a registration holds (review finding H-N2): at most `HOOK_LIMIT` hooks, each with one to
|
|
16
|
+
* `HOOK_SELECTION_LIMIT` selections of at most `HOOK_SELECTION_LENGTH` characters. Generation applies them, so a hook
|
|
17
|
+
* beyond them is an unsupported row rather than a refusal of the whole registration; distribution's hook registration
|
|
18
|
+
* holds its rows to the same ones.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HOOK_LIMIT = 64;
|
|
21
|
+
export declare const HOOK_SELECTION_LIMIT = 64;
|
|
22
|
+
export declare const HOOK_SELECTION_LENGTH = 512;
|
|
23
|
+
/**
|
|
24
|
+
* A selection a registration can record: a workspace-relative G06c selection written with `/`, none empty, absolute,
|
|
25
|
+
* escaping or holding a `.` or `..` segment, an empty segment but a trailing one, a backslash or a control, and at most
|
|
26
|
+
* `HOOK_SELECTION_LENGTH` characters.
|
|
27
|
+
*/
|
|
28
|
+
export declare const registrableSelection: (path: unknown) => path is string;
|
|
29
|
+
/**
|
|
30
|
+
* Narrow an authored `@hook` to the edit events the `@mandate` guard can decide: PreToolUse, one or more of Write, Edit
|
|
31
|
+
* and MultiEdit, one or more workspace-relative path selections written with `/`, and a message. A hook that selects no
|
|
32
|
+
* path could never deny, so it is refused rather than registered as a guard that guards nothing. Tool values are never
|
|
33
|
+
* read as a regex or shell text, and nothing authored but the identity and the tools reaches a registration.
|
|
34
|
+
* IA-PROJECTION-INPUT-INVALID names what is unsupported.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hookDeclaration(node: Node): HostHookDeclaration;
|
|
37
|
+
/** What a host registers of the workspace's authored hooks, and what it reports instead of registering. */
|
|
38
|
+
export interface HookSet {
|
|
39
|
+
readonly hooks: readonly HostHookDeclaration[];
|
|
40
|
+
readonly unsupported: readonly UnsupportedRecord[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Every authored (band 100) `@hook`, by identity: each one `hookDeclaration` accepts is registered and each one it refuses
|
|
44
|
+
* is reported with its reason, so one unsupported record never blocks the others (plan amendment C9); past the first
|
|
45
|
+
* `HOOK_LIMIT` accepted hooks, each is reported, since a registration holds no more (review finding H-N2). Codex
|
|
46
|
+
* registers none and reports each (C12: Codex hooks are unsupported).
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateHookSet(reader: ReadHandle, within: string, host: PacketHost): HookSet;
|
|
49
|
+
/** The authored hooks a host registers (`generateHookSet`'s supported ones). */
|
|
50
|
+
export declare function generateHooks(reader: ReadHandle, within: string, host: PacketHost): readonly HostHookDeclaration[];
|
|
51
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/generate/hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAcrD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAA8C,CAAC;AACzE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,eAAe,GAAI,UAAU,OAAO,KAAG,QAAQ,IAAI,MACwC,CAAC;AACzG;;;;;GAKG;AACH,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,MAWkD,CAAC;AAChH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,mBAAmB,CAgC/D;AACD,2GAA2G;AAC3G,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACpD;AACD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAwB7F;AACD,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS,mBAAmB,EAAE,CAElH"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { isSelection } from '@inventarch/graph';
|
|
2
|
+
import { inputFailure, ProjectionError } from '../projection-format.js';
|
|
3
|
+
import { frozen } from '../resource-format.js';
|
|
4
|
+
import { authoredOf, knownHost, textsAt } from './format.js';
|
|
5
|
+
const TOOLS = new Map([
|
|
6
|
+
['write', 'Write'],
|
|
7
|
+
['edit', 'Edit'],
|
|
8
|
+
['multiedit', 'MultiEdit'],
|
|
9
|
+
]);
|
|
10
|
+
/**
|
|
11
|
+
* The characters no registered selection may hold: every C0 and C1 control, DEL, the Unicode line and paragraph
|
|
12
|
+
* separators and the bidirectional controls (built from a string, which names them).
|
|
13
|
+
*/
|
|
14
|
+
const CONTROL = new RegExp('[\\u0000-\\u001f\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]');
|
|
15
|
+
/**
|
|
16
|
+
* The identities a hook registration can carry on the guard's command line: a canonical `system/kind/facet/name` of the
|
|
17
|
+
* language's lower-cased name characters, bounded. Every admitted record's identity has this shape (its name is
|
|
18
|
+
* `[A-Za-z][A-Za-z0-9-]*`, lower-cased), so only the bound can refuse one. A hook's name is not a host path, so no
|
|
19
|
+
* portable-name rule applies to it.
|
|
20
|
+
*/
|
|
21
|
+
export const HOOK_IDENTITY = /^[a-z][a-z0-9-]*(?:\/[a-z][a-z0-9-]*){3}$/;
|
|
22
|
+
export const HOOK_IDENTITY_LIMIT = 512;
|
|
23
|
+
export const registrableHook = (identity) => typeof identity === 'string' && identity.length <= HOOK_IDENTITY_LIMIT && HOOK_IDENTITY.test(identity);
|
|
24
|
+
/**
|
|
25
|
+
* The bounds a registration holds (review finding H-N2): at most `HOOK_LIMIT` hooks, each with one to
|
|
26
|
+
* `HOOK_SELECTION_LIMIT` selections of at most `HOOK_SELECTION_LENGTH` characters. Generation applies them, so a hook
|
|
27
|
+
* beyond them is an unsupported row rather than a refusal of the whole registration; distribution's hook registration
|
|
28
|
+
* holds its rows to the same ones.
|
|
29
|
+
*/
|
|
30
|
+
export const HOOK_LIMIT = 64;
|
|
31
|
+
export const HOOK_SELECTION_LIMIT = 64;
|
|
32
|
+
export const HOOK_SELECTION_LENGTH = 512;
|
|
33
|
+
/**
|
|
34
|
+
* A selection a registration can record: a workspace-relative G06c selection written with `/`, none empty, absolute,
|
|
35
|
+
* escaping or holding a `.` or `..` segment, an empty segment but a trailing one, a backslash or a control, and at most
|
|
36
|
+
* `HOOK_SELECTION_LENGTH` characters.
|
|
37
|
+
*/
|
|
38
|
+
export const registrableSelection = (path) => typeof path === 'string' &&
|
|
39
|
+
path.length > 0 &&
|
|
40
|
+
path.length <= HOOK_SELECTION_LENGTH &&
|
|
41
|
+
isSelection(path) &&
|
|
42
|
+
!path.includes('\\') &&
|
|
43
|
+
!path.startsWith('/') &&
|
|
44
|
+
!/^[A-Za-z]:/.test(path) &&
|
|
45
|
+
!CONTROL.test(path) &&
|
|
46
|
+
!path
|
|
47
|
+
.split('/')
|
|
48
|
+
.some((segment, at, all) => (segment === '' && at < all.length - 1) || segment === '.' || segment === '..');
|
|
49
|
+
/**
|
|
50
|
+
* Narrow an authored `@hook` to the edit events the `@mandate` guard can decide: PreToolUse, one or more of Write, Edit
|
|
51
|
+
* and MultiEdit, one or more workspace-relative path selections written with `/`, and a message. A hook that selects no
|
|
52
|
+
* path could never deny, so it is refused rather than registered as a guard that guards nothing. Tool values are never
|
|
53
|
+
* read as a regex or shell text, and nothing authored but the identity and the tools reaches a registration.
|
|
54
|
+
* IA-PROJECTION-INPUT-INVALID names what is unsupported.
|
|
55
|
+
*/
|
|
56
|
+
export function hookDeclaration(node) {
|
|
57
|
+
const unsupported = (why) => inputFailure(`Unsupported authored hook ${node.identity}: ${why}; the edit guard decides PreToolUse edits only`);
|
|
58
|
+
if (node.discriminator !== 'hook' || node.band !== 100)
|
|
59
|
+
unsupported('not an authored @hook');
|
|
60
|
+
if (!registrableHook(node.identity))
|
|
61
|
+
unsupported(`its identity exceeds the ${HOOK_IDENTITY_LIMIT} characters a registration carries`);
|
|
62
|
+
const event = textsAt(node, 'hook.event')[0], tools = textsAt(node, 'hook.tools'), paths = textsAt(node, 'hook.paths'), message = textsAt(node, 'hook.message')[0];
|
|
63
|
+
if (event?.toLowerCase() !== 'pretooluse')
|
|
64
|
+
unsupported(`event ${event ?? 'none'} is not PreToolUse`);
|
|
65
|
+
if (tools.length === 0 || tools.some((tool) => !TOOLS.has(tool.toLowerCase())))
|
|
66
|
+
unsupported('hook.tools must name Write, Edit or MultiEdit');
|
|
67
|
+
if (paths.length === 0)
|
|
68
|
+
unsupported('hook.paths selects no path, so the hook could never deny');
|
|
69
|
+
if (paths.length > HOOK_SELECTION_LIMIT)
|
|
70
|
+
unsupported(`hook.paths holds ${paths.length} selections, and a registration records at most ${HOOK_SELECTION_LIMIT}`);
|
|
71
|
+
if (paths.some((path) => path.length > HOOK_SELECTION_LENGTH))
|
|
72
|
+
unsupported(`hook.paths holds a selection longer than the ${HOOK_SELECTION_LENGTH} characters a registration records`);
|
|
73
|
+
if (paths.some((path) => !registrableSelection(path)))
|
|
74
|
+
unsupported('hook.paths must hold workspace-relative path selections written with /');
|
|
75
|
+
if (message === undefined || message.trim() === '')
|
|
76
|
+
unsupported('hook.message is required and not blank');
|
|
77
|
+
return frozen({
|
|
78
|
+
identity: node.identity,
|
|
79
|
+
event: 'PreToolUse',
|
|
80
|
+
tools: [...new Set(tools.map((tool) => TOOLS.get(tool.toLowerCase())))],
|
|
81
|
+
paths,
|
|
82
|
+
message: message,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Every authored (band 100) `@hook`, by identity: each one `hookDeclaration` accepts is registered and each one it refuses
|
|
87
|
+
* is reported with its reason, so one unsupported record never blocks the others (plan amendment C9); past the first
|
|
88
|
+
* `HOOK_LIMIT` accepted hooks, each is reported, since a registration holds no more (review finding H-N2). Codex
|
|
89
|
+
* registers none and reports each (C12: Codex hooks are unsupported).
|
|
90
|
+
*/
|
|
91
|
+
export function generateHookSet(reader, within, host) {
|
|
92
|
+
knownHost(host);
|
|
93
|
+
const hooks = [], unsupported = [];
|
|
94
|
+
for (const node of authoredOf(reader.records({ within }), 'hook')) {
|
|
95
|
+
if (host === 'codex') {
|
|
96
|
+
unsupported.push({ identity: node.identity, word: 'hook', reason: 'Codex hooks are unsupported' });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const declaration = hookDeclaration(node);
|
|
101
|
+
if (hooks.length === HOOK_LIMIT)
|
|
102
|
+
unsupported.push({
|
|
103
|
+
identity: node.identity,
|
|
104
|
+
word: 'hook',
|
|
105
|
+
reason: `Unsupported authored hook ${node.identity}: a registration holds at most ${HOOK_LIMIT} hooks, and ${HOOK_LIMIT} come before it`,
|
|
106
|
+
});
|
|
107
|
+
else
|
|
108
|
+
hooks.push(declaration);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (!(error instanceof ProjectionError))
|
|
112
|
+
throw error;
|
|
113
|
+
unsupported.push({ identity: node.identity, word: 'hook', reason: error.message });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return frozen({ hooks, unsupported });
|
|
117
|
+
}
|
|
118
|
+
/** The authored hooks a host registers (`generateHookSet`'s supported ones). */
|
|
119
|
+
export function generateHooks(reader, within, host) {
|
|
120
|
+
return generateHookSet(reader, within, host).hooks;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../src/generate/hook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG7D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC;IACpB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,WAAW,EAAE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,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU;gBAC7B,WAAW,CAAC,IAAI,CAAC;oBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,6BAA6B,IAAI,CAAC,QAAQ,kCAAkC,UAAU,eAAe,UAAU,iBAAiB;iBACzI,CAAC,CAAC;;gBACA,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,eAAe,CAAC;gBAAE,MAAM,KAAK,CAAC;YACrD,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AACxC,CAAC;AACD,gFAAgF;AAChF,MAAM,UAAU,aAAa,CAAC,MAAkB,EAAE,MAAc,EAAE,IAAgB;IAChF,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { generateAgentProfiles } from './agent-profile.js';
|
|
2
|
+
export { generatePlaybookSkills } from './playbook.js';
|
|
3
|
+
export { generateDefinitions, generateHostSet } from './definitions.js';
|
|
4
|
+
export type { HostSet } from './definitions.js';
|
|
5
|
+
export { generateHooks, generateHookSet, HOOK_IDENTITY, HOOK_IDENTITY_LIMIT, HOOK_LIMIT, HOOK_SELECTION_LENGTH, HOOK_SELECTION_LIMIT, hookDeclaration, registrableHook, registrableSelection, } from './hook.js';
|
|
6
|
+
export type { HookSet } from './hook.js';
|
|
7
|
+
export type { GeneratedFile, GeneratedSet, GeneratedWord, UnsupportedRecord } from './format.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Host generators over authored records (milestone generation-binding). The CLI's projection writer applies
|
|
2
|
+
// generateHostSet's set (task host-consumes-generated-set).
|
|
3
|
+
export { generateAgentProfiles } from './agent-profile.js';
|
|
4
|
+
export { generatePlaybookSkills } from './playbook.js';
|
|
5
|
+
export { generateDefinitions, generateHostSet } from './definitions.js';
|
|
6
|
+
export { generateHooks, generateHookSet, HOOK_IDENTITY, HOOK_IDENTITY_LIMIT, HOOK_LIMIT, HOOK_SELECTION_LENGTH, HOOK_SELECTION_LIMIT, hookDeclaration, registrableHook, registrableSelection, } from './hook.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,4DAA4D;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReadHandle } from '@inventarch/db';
|
|
2
|
+
import type { PacketHost } from '@inventarch/runtime';
|
|
3
|
+
import type { GeneratedSet } from './format.js';
|
|
4
|
+
/**
|
|
5
|
+
* The skills of the authored `@playbook` records the scope token `within` admits, by identity, and an unsupported row
|
|
6
|
+
* for each one not rendered (see above). An unknown host is IA-PROJECTION-INPUT-INVALID; an unknown or stale token keeps
|
|
7
|
+
* its database code.
|
|
8
|
+
*/
|
|
9
|
+
export declare function generatePlaybookSkills(reader: ReadHandle, within: string, host: PacketHost): GeneratedSet;
|
|
10
|
+
//# sourceMappingURL=playbook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbook.d.ts","sourceRoot":"","sources":["../../src/generate/playbook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA2BhD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CAgBzG"}
|