@rasensio/aidlc 1.65.0 → 1.67.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/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/roadmap.d.ts +20 -3
- package/dist/commands/roadmap.d.ts.map +1 -1
- package/dist/commands/roadmap.js +60 -15
- package/dist/commands/roadmap.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +9 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/compile/adapters/claude-code.d.ts +18 -1
- package/dist/compile/adapters/claude-code.d.ts.map +1 -1
- package/dist/compile/adapters/claude-code.js +66 -3
- package/dist/compile/adapters/claude-code.js.map +1 -1
- package/dist/compile/adapters/codex.d.ts +33 -2
- package/dist/compile/adapters/codex.d.ts.map +1 -1
- package/dist/compile/adapters/codex.js +106 -17
- package/dist/compile/adapters/codex.js.map +1 -1
- package/dist/compile/agents.d.ts +53 -0
- package/dist/compile/agents.d.ts.map +1 -0
- package/dist/compile/agents.js +97 -0
- package/dist/compile/agents.js.map +1 -0
- package/dist/compile/loaders.d.ts.map +1 -1
- package/dist/compile/loaders.js +1 -0
- package/dist/compile/loaders.js.map +1 -1
- package/dist/compile/reviewer-guard.d.ts +47 -0
- package/dist/compile/reviewer-guard.d.ts.map +1 -0
- package/dist/compile/reviewer-guard.js +106 -0
- package/dist/compile/reviewer-guard.js.map +1 -0
- package/dist/core/types.d.ts +25 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/doctor/migrations/index.d.ts.map +1 -1
- package/dist/doctor/migrations/index.js +5 -0
- package/dist/doctor/migrations/index.js.map +1 -1
- package/dist/doctor/migrations/roadmap-mermaid-graphs.d.ts +22 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.d.ts.map +1 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.js +74 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.js.map +1 -0
- package/dist/roadmap/graph.d.ts +73 -28
- package/dist/roadmap/graph.d.ts.map +1 -1
- package/dist/roadmap/graph.js +184 -125
- package/dist/roadmap/graph.js.map +1 -1
- package/dist/roadmap/next.d.ts +5 -0
- package/dist/roadmap/next.d.ts.map +1 -1
- package/dist/roadmap/next.js +7 -1
- package/dist/roadmap/next.js.map +1 -1
- package/dist/roadmap/open-browser.d.ts +34 -0
- package/dist/roadmap/open-browser.d.ts.map +1 -0
- package/dist/roadmap/open-browser.js +40 -0
- package/dist/roadmap/open-browser.js.map +1 -0
- package/dist/roadmap/paths.d.ts +5 -1
- package/dist/roadmap/paths.d.ts.map +1 -1
- package/dist/roadmap/paths.js +5 -9
- package/dist/roadmap/paths.js.map +1 -1
- package/dist/roadmap/view-assets.d.ts +18 -0
- package/dist/roadmap/view-assets.d.ts.map +1 -0
- package/dist/roadmap/view-assets.js +301 -0
- package/dist/roadmap/view-assets.js.map +1 -0
- package/dist/roadmap/view-html.d.ts +37 -0
- package/dist/roadmap/view-html.d.ts.map +1 -0
- package/dist/roadmap/view-html.js +317 -0
- package/dist/roadmap/view-html.js.map +1 -0
- package/dist/roadmap/view-model.d.ts +93 -0
- package/dist/roadmap/view-model.d.ts.map +1 -0
- package/dist/roadmap/view-model.js +194 -0
- package/dist/roadmap/view-model.js.map +1 -0
- package/package.json +2 -2
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* - Canonical skill bodies → `.aidlc/skills/<filename>`
|
|
8
8
|
* - Per-skill shims → `.claude/skills/aidlc-<name>/SKILL.md`
|
|
9
|
+
* - Per-agent files → `.claude/agents/<name>.md`, with the command guard their
|
|
10
|
+
* hook runs at `.claude/hooks/<name>-guard.mjs` (native-reviewer-agent)
|
|
9
11
|
* - State protocol + context-doc references → `merge-block` into `CLAUDE.md`
|
|
10
12
|
*
|
|
11
13
|
* Capability map consumption follows the resolution precedence:
|
|
@@ -19,6 +21,21 @@
|
|
|
19
21
|
*
|
|
20
22
|
* @module
|
|
21
23
|
*/
|
|
22
|
-
import type { PlatformAdapter } from '../../core/types.js';
|
|
24
|
+
import type { AgentDefinition, PlatformAdapter } from '../../core/types.js';
|
|
25
|
+
/**
|
|
26
|
+
* A Claude Code agent file (native-reviewer-agent/AC-3, AC-4).
|
|
27
|
+
*
|
|
28
|
+
* `tools` is an allowlist of tool names, so naming four leaves out Edit, Write,
|
|
29
|
+
* NotebookEdit, Agent and every MCP tool. `Bash` stays because the reviewer
|
|
30
|
+
* reads the branch with `git diff`; the hook narrows it to the definition's
|
|
31
|
+
* commands — see `compile/reviewer-guard.ts` for why a hook and not a `tools`
|
|
32
|
+
* specifier. No `model`, `effort` or `permissionMode`: the session's are
|
|
33
|
+
* inherited, and a permission mode would not survive a parent that bypasses
|
|
34
|
+
* permissions, which the tool list and the hook do.
|
|
35
|
+
*
|
|
36
|
+
* The hook command is single-quoted YAML so its `"` and `$` reach the shell as
|
|
37
|
+
* written.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatClaudeAgent(agent: AgentDefinition): string;
|
|
23
40
|
export declare const claudeCodeAdapter: PlatformAdapter;
|
|
24
41
|
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/compile/adapters/claude-code.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/compile/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAShB,MAAM,qBAAqB,CAAC;AAsE7B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAiBhE;AAqDD,eAAO,MAAM,iBAAiB,EAAE,eA6H/B,CAAC"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* - Canonical skill bodies → `.aidlc/skills/<filename>`
|
|
8
8
|
* - Per-skill shims → `.claude/skills/aidlc-<name>/SKILL.md`
|
|
9
|
+
* - Per-agent files → `.claude/agents/<name>.md`, with the command guard their
|
|
10
|
+
* hook runs at `.claude/hooks/<name>-guard.mjs` (native-reviewer-agent)
|
|
9
11
|
* - State protocol + context-doc references → `merge-block` into `CLAUDE.md`
|
|
10
12
|
*
|
|
11
13
|
* Capability map consumption follows the resolution precedence:
|
|
@@ -19,6 +21,8 @@
|
|
|
19
21
|
*
|
|
20
22
|
* @module
|
|
21
23
|
*/
|
|
24
|
+
import { AGENT_MARKER, findAgent } from '../agents.js';
|
|
25
|
+
import { guardHookCommand, guardPath, renderGuard } from '../reviewer-guard.js';
|
|
22
26
|
import { MAX_SKILL_NAME_LENGTH, SKILL_NAME_RE, canonicalSkillFilename, normalizeSkillName, } from '../naming.js';
|
|
23
27
|
import { formatCanonicalSkill } from '../skill-format.js';
|
|
24
28
|
import { resolveActivation, validateCapabilityMap } from '../capability-resolve.js';
|
|
@@ -36,17 +40,28 @@ function canonicalFilename(skill) {
|
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Generate the SKILL.md shim content for Claude Code.
|
|
43
|
+
*
|
|
44
|
+
* A skill that runs in an agent forks into it: `context: fork` starts the skill
|
|
45
|
+
* without the parent's conversation and `agent` names who runs it, so the review
|
|
46
|
+
* is independent by construction rather than because the prose asked
|
|
47
|
+
* (native-reviewer-agent/AC-9). Such a shim carries no activation line — the
|
|
48
|
+
* review skill's phase is `requirements`, which would hand a reviewer with no
|
|
49
|
+
* plan-mode tool a directive to enter plan mode.
|
|
39
50
|
*/
|
|
40
|
-
function generateShimContent(skill, dirName, activation, canonicalPath) {
|
|
51
|
+
function generateShimContent(skill, dirName, activation, canonicalPath, agent) {
|
|
41
52
|
const lines = [];
|
|
42
53
|
// Frontmatter
|
|
43
54
|
lines.push('---');
|
|
44
55
|
lines.push(`name: ${dirName}`);
|
|
45
56
|
lines.push(`description: ${skill.meta.description}`);
|
|
57
|
+
if (agent) {
|
|
58
|
+
lines.push('context: fork');
|
|
59
|
+
lines.push(`agent: ${agent.name}`);
|
|
60
|
+
}
|
|
46
61
|
lines.push('---');
|
|
47
62
|
lines.push('');
|
|
48
63
|
// Activation directive (if any)
|
|
49
|
-
if (activation) {
|
|
64
|
+
if (activation && !agent) {
|
|
50
65
|
lines.push(activation);
|
|
51
66
|
lines.push('');
|
|
52
67
|
}
|
|
@@ -55,6 +70,38 @@ function generateShimContent(skill, dirName, activation, canonicalPath) {
|
|
|
55
70
|
lines.push('');
|
|
56
71
|
return lines.join('\n');
|
|
57
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* A Claude Code agent file (native-reviewer-agent/AC-3, AC-4).
|
|
75
|
+
*
|
|
76
|
+
* `tools` is an allowlist of tool names, so naming four leaves out Edit, Write,
|
|
77
|
+
* NotebookEdit, Agent and every MCP tool. `Bash` stays because the reviewer
|
|
78
|
+
* reads the branch with `git diff`; the hook narrows it to the definition's
|
|
79
|
+
* commands — see `compile/reviewer-guard.ts` for why a hook and not a `tools`
|
|
80
|
+
* specifier. No `model`, `effort` or `permissionMode`: the session's are
|
|
81
|
+
* inherited, and a permission mode would not survive a parent that bypasses
|
|
82
|
+
* permissions, which the tool list and the hook do.
|
|
83
|
+
*
|
|
84
|
+
* The hook command is single-quoted YAML so its `"` and `$` reach the shell as
|
|
85
|
+
* written.
|
|
86
|
+
*/
|
|
87
|
+
export function formatClaudeAgent(agent) {
|
|
88
|
+
return [
|
|
89
|
+
'---',
|
|
90
|
+
`name: ${agent.name}`,
|
|
91
|
+
`description: ${agent.description}`,
|
|
92
|
+
'tools: Read, Grep, Glob, Bash',
|
|
93
|
+
'hooks:',
|
|
94
|
+
' PreToolUse:',
|
|
95
|
+
' - matcher: Bash',
|
|
96
|
+
' hooks:',
|
|
97
|
+
' - type: command',
|
|
98
|
+
` command: '${guardHookCommand(agent.name)}'`,
|
|
99
|
+
'---',
|
|
100
|
+
AGENT_MARKER,
|
|
101
|
+
'',
|
|
102
|
+
agent.instructions,
|
|
103
|
+
].join('\n');
|
|
104
|
+
}
|
|
58
105
|
/**
|
|
59
106
|
* Generate the CLAUDE.md managed block content (state protocol + context refs).
|
|
60
107
|
*/
|
|
@@ -123,13 +170,29 @@ export const claudeCodeAdapter = {
|
|
|
123
170
|
const dirName = normalizeSkillName(skill.meta.name, { prefix: true });
|
|
124
171
|
const activation = resolveActivation(skill, 'claude-code', phaseMap);
|
|
125
172
|
const canonicalPath = canonicalFilename(skill);
|
|
126
|
-
const
|
|
173
|
+
const agent = findAgent(ctx, skill.meta.agent);
|
|
174
|
+
const shimContent = generateShimContent(skill, dirName, activation, canonicalPath, agent);
|
|
127
175
|
ops.push({
|
|
128
176
|
kind: 'create',
|
|
129
177
|
path: `.claude/skills/${dirName}/SKILL.md`,
|
|
130
178
|
content: shimContent,
|
|
131
179
|
});
|
|
132
180
|
}
|
|
181
|
+
// 2b. One agent file and its command guard per agent definition. The guard is
|
|
182
|
+
// written by the same run that names it, so the hook never points at a
|
|
183
|
+
// script that is not there (native-reviewer-agent/AC-4).
|
|
184
|
+
for (const agent of ctx.agents ?? []) {
|
|
185
|
+
ops.push({
|
|
186
|
+
kind: 'create',
|
|
187
|
+
path: `.claude/agents/${agent.name}.md`,
|
|
188
|
+
content: formatClaudeAgent(agent),
|
|
189
|
+
});
|
|
190
|
+
ops.push({
|
|
191
|
+
kind: 'create',
|
|
192
|
+
path: guardPath(agent.name),
|
|
193
|
+
content: renderGuard(agent.name, agent.commands),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
133
196
|
// 3. Generate merge-block into CLAUDE.md with state protocol + context refs
|
|
134
197
|
const claudeMdContent = generateClaudeMdBlock(ctx);
|
|
135
198
|
ops.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/compile/adapters/claude-code.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/compile/adapters/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAY;IACrC,OAAO,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAC1B,KAAY,EACZ,OAAe,EACf,UAAyB,EACzB,aAAqB,EACrB,KAA6B;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,cAAc;IACd,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,KAAK,CAAC,IAAI,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IACD,KAAK,CAA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CAAC;oBAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;wBACnC,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;oBACpE,CAAC;oBACD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;wBAC1C,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;oBAC3E,CAAC;oBAED,uCAAuC;oBACvC,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;oBACvD,IAAI,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;wBACjD,MAAM,CAAC,IAAI,CACT,gCAAgC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gCAAgC,OAAO,GAAG,CAC9F,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC1E,CAAC;CACF,CAAC"}
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* - A single `merge-block` into `AGENTS.md` at project root containing
|
|
7
7
|
* overview, state protocol, per-phase pointers to `.aidlc/skills/`, and
|
|
8
8
|
* context-doc references.
|
|
9
|
+
* - One custom agent per agent definition at `.codex/agents/<name>.toml`, with a
|
|
10
|
+
* read-only sandbox (native-reviewer-agent).
|
|
9
11
|
*
|
|
10
12
|
* Requirements: 1.1, 1.6
|
|
11
13
|
*
|
|
12
14
|
* @module
|
|
13
15
|
*/
|
|
14
|
-
import type { PlatformAdapter, Skill } from '../../core/types.js';
|
|
16
|
+
import type { AgentDefinition, PlatformAdapter, Skill } from '../../core/types.js';
|
|
15
17
|
/**
|
|
16
18
|
* Directory name for a Codex skill: `aidlc-<name>`.
|
|
17
19
|
*
|
|
@@ -31,8 +33,37 @@ export declare function skillDirName(skill: Skill): string;
|
|
|
31
33
|
*
|
|
32
34
|
* The body is the canonical skill body, not a pointer to it: a pointer is exactly
|
|
33
35
|
* what made Codex second-class.
|
|
36
|
+
*
|
|
37
|
+
* `directives` go above the body, one paragraph each, as Copilot puts its
|
|
38
|
+
* activation line. Before native-reviewer-agent a Codex skill file carried none,
|
|
39
|
+
* so the task-agents rule's condition — the skill's entry says sub-agents are
|
|
40
|
+
* available — could never hold on Codex (AC-15).
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatCodexSkill(skill: Skill, directives?: string[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* The line that hands a skill to its agent (native-reviewer-agent/AC-16).
|
|
45
|
+
*
|
|
46
|
+
* Codex has no `context: fork`, so the hand-off is an instruction to the session
|
|
47
|
+
* that loaded the skill. The fallback is spelled out because `.codex/` loads only
|
|
48
|
+
* in a trusted project, and a review that quietly ran in the author's session
|
|
49
|
+
* would claim an independence it does not have.
|
|
50
|
+
*/
|
|
51
|
+
export declare function agentDirective(agent: AgentDefinition): string;
|
|
52
|
+
/**
|
|
53
|
+
* A Codex custom agent file (native-reviewer-agent/AC-12, AC-13).
|
|
54
|
+
*
|
|
55
|
+
* `developer_instructions` is a TOML multi-line *literal* string, which
|
|
56
|
+
* processes no escapes, so markdown passes through byte for byte. The one thing
|
|
57
|
+
* it cannot hold is its own delimiter, and TOML forbids most control characters
|
|
58
|
+
* in it; for those the file is not written at all, because a half-valid TOML file
|
|
59
|
+
* is one Codex refuses to load with the agent's name on it. `description` is a
|
|
60
|
+
* basic string, and `JSON.stringify` of a one-line string is a valid one.
|
|
61
|
+
*
|
|
62
|
+
* `sandbox_mode = "read-only"` is the enforcement. Whether a child spawned from a
|
|
63
|
+
* workspace-write parent keeps it is what the live test checks
|
|
64
|
+
* (native-reviewer-agent/AC-24).
|
|
34
65
|
*/
|
|
35
|
-
export declare function
|
|
66
|
+
export declare function formatCodexAgent(agent: AgentDefinition): string | null;
|
|
36
67
|
/**
|
|
37
68
|
* Codex platform adapter implementation.
|
|
38
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/compile/adapters/codex.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/compile/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,KAAK,EAMN,MAAM,qBAAqB,CAAC;AAa7B;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,MAAM,CAYhF;AA2BD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAO7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAatE;AA4GD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,eA2E1B,CAAC"}
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* - A single `merge-block` into `AGENTS.md` at project root containing
|
|
7
7
|
* overview, state protocol, per-phase pointers to `.aidlc/skills/`, and
|
|
8
8
|
* context-doc references.
|
|
9
|
+
* - One custom agent per agent definition at `.codex/agents/<name>.toml`, with a
|
|
10
|
+
* read-only sandbox (native-reviewer-agent).
|
|
9
11
|
*
|
|
10
12
|
* Requirements: 1.1, 1.6
|
|
11
13
|
*
|
|
12
14
|
* @module
|
|
13
15
|
*/
|
|
16
|
+
import { AGENT_MARKER_TEXT, findAgent } from '../agents.js';
|
|
14
17
|
import { canonicalSkillFilename, normalizeSkillName } from '../naming.js';
|
|
15
18
|
import { formatCanonicalSkill } from '../skill-format.js';
|
|
16
19
|
/**
|
|
@@ -41,37 +44,90 @@ export function skillDirName(skill) {
|
|
|
41
44
|
*
|
|
42
45
|
* The body is the canonical skill body, not a pointer to it: a pointer is exactly
|
|
43
46
|
* what made Codex second-class.
|
|
47
|
+
*
|
|
48
|
+
* `directives` go above the body, one paragraph each, as Copilot puts its
|
|
49
|
+
* activation line. Before native-reviewer-agent a Codex skill file carried none,
|
|
50
|
+
* so the task-agents rule's condition — the skill's entry says sub-agents are
|
|
51
|
+
* available — could never hold on Codex (AC-15).
|
|
44
52
|
*/
|
|
45
|
-
export function formatCodexSkill(skill) {
|
|
53
|
+
export function formatCodexSkill(skill, directives = []) {
|
|
46
54
|
const lines = ['---'];
|
|
47
55
|
lines.push(`name: ${skillDirName(skill)}`);
|
|
48
56
|
lines.push(`description: ${skill.meta.description}`);
|
|
49
57
|
lines.push('---');
|
|
50
58
|
lines.push('');
|
|
59
|
+
for (const directive of directives) {
|
|
60
|
+
lines.push(directive);
|
|
61
|
+
lines.push('');
|
|
62
|
+
}
|
|
51
63
|
lines.push(skill.body);
|
|
52
64
|
return lines.join('\n');
|
|
53
65
|
}
|
|
54
66
|
/**
|
|
55
|
-
*
|
|
67
|
+
* Every activation directive for a skill's phase, in map order.
|
|
68
|
+
*
|
|
69
|
+
* Every match, not the first: `code-generation` and `subagents` both cover
|
|
70
|
+
* implementation, and the first-match rule would silently drop one. This is
|
|
71
|
+
* Codex's own resolver, so the change reaches Codex output and nothing else —
|
|
72
|
+
* the shared `capability-resolve.ts` stays one-per-phase for the reasons the
|
|
73
|
+
* `question-rendering-rides-capability-map` decision records
|
|
74
|
+
* (native-reviewer-agent/AC-14, DD-3). A `native_mode_hint` naming an entry
|
|
75
|
+
* still wins outright.
|
|
56
76
|
*/
|
|
57
|
-
function
|
|
77
|
+
function getCapabilityDirectives(skill, caps) {
|
|
58
78
|
if (!caps)
|
|
59
|
-
return
|
|
60
|
-
// Check skill-level native_mode_hint first
|
|
79
|
+
return [];
|
|
61
80
|
const hint = skill.meta.native_mode_hint?.codex;
|
|
62
81
|
if (hint) {
|
|
63
|
-
// Look up the named capability in the map
|
|
64
82
|
const entry = caps.capabilities[hint];
|
|
65
83
|
if (entry)
|
|
66
|
-
return entry.activation;
|
|
84
|
+
return [entry.activation];
|
|
67
85
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
return Object.values(caps.capabilities)
|
|
87
|
+
.filter((entry) => entry.phases.includes(skill.meta.phase))
|
|
88
|
+
.map((entry) => entry.activation);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The line that hands a skill to its agent (native-reviewer-agent/AC-16).
|
|
92
|
+
*
|
|
93
|
+
* Codex has no `context: fork`, so the hand-off is an instruction to the session
|
|
94
|
+
* that loaded the skill. The fallback is spelled out because `.codex/` loads only
|
|
95
|
+
* in a trusted project, and a review that quietly ran in the author's session
|
|
96
|
+
* would claim an independence it does not have.
|
|
97
|
+
*/
|
|
98
|
+
export function agentDirective(agent) {
|
|
99
|
+
return (`Run this skill in the \`${agent.name}\` custom agent: start it with spawn_agent, naming ` +
|
|
100
|
+
`\`${agent.name}\`, and give it the instance and artifact. If it is not available, run it in ` +
|
|
101
|
+
'a fresh sub-agent told to edit nothing, and say the review was read-only by request, not by ' +
|
|
102
|
+
'the sandbox.');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A Codex custom agent file (native-reviewer-agent/AC-12, AC-13).
|
|
106
|
+
*
|
|
107
|
+
* `developer_instructions` is a TOML multi-line *literal* string, which
|
|
108
|
+
* processes no escapes, so markdown passes through byte for byte. The one thing
|
|
109
|
+
* it cannot hold is its own delimiter, and TOML forbids most control characters
|
|
110
|
+
* in it; for those the file is not written at all, because a half-valid TOML file
|
|
111
|
+
* is one Codex refuses to load with the agent's name on it. `description` is a
|
|
112
|
+
* basic string, and `JSON.stringify` of a one-line string is a valid one.
|
|
113
|
+
*
|
|
114
|
+
* `sandbox_mode = "read-only"` is the enforcement. Whether a child spawned from a
|
|
115
|
+
* workspace-write parent keeps it is what the live test checks
|
|
116
|
+
* (native-reviewer-agent/AC-24).
|
|
117
|
+
*/
|
|
118
|
+
export function formatCodexAgent(agent) {
|
|
119
|
+
if (agent.instructions.includes("'''") || /[\x00-\x08\x0b-\x1f\x7f]/.test(agent.instructions)) {
|
|
120
|
+
return null;
|
|
73
121
|
}
|
|
74
|
-
return
|
|
122
|
+
return [
|
|
123
|
+
`# ${AGENT_MARKER_TEXT}`,
|
|
124
|
+
`name = ${JSON.stringify(agent.name)}`,
|
|
125
|
+
`description = ${JSON.stringify(agent.description)}`,
|
|
126
|
+
'sandbox_mode = "read-only"',
|
|
127
|
+
"developer_instructions = '''",
|
|
128
|
+
`${agent.instructions}'''`,
|
|
129
|
+
'',
|
|
130
|
+
].join('\n');
|
|
75
131
|
}
|
|
76
132
|
/**
|
|
77
133
|
* Build the AGENTS.md managed block content.
|
|
@@ -107,14 +163,30 @@ function buildAgentsBlock(skills, caps, ctx) {
|
|
|
107
163
|
'Invoke one explicitly with `/skills` or `$aidlc-<name>`.');
|
|
108
164
|
lines.push('');
|
|
109
165
|
for (const skill of skills) {
|
|
110
|
-
const
|
|
166
|
+
const directives = getCapabilityDirectives(skill, caps);
|
|
111
167
|
let entry = `- **${skill.meta.phase}**: \`${skillDirName(skill)}\``;
|
|
112
|
-
if (
|
|
113
|
-
entry += ` — ${
|
|
168
|
+
if (directives.length > 0) {
|
|
169
|
+
entry += ` — ${directives.join(' ')}`;
|
|
114
170
|
}
|
|
115
171
|
lines.push(entry);
|
|
116
172
|
}
|
|
117
173
|
lines.push('');
|
|
174
|
+
// The reviewer, and what holds when Codex has not loaded it
|
|
175
|
+
// (native-reviewer-agent/AC-17).
|
|
176
|
+
for (const agent of ctx.agents ?? []) {
|
|
177
|
+
lines.push('## Reviewer Agent');
|
|
178
|
+
lines.push('');
|
|
179
|
+
lines.push(`Reviews run in the \`${agent.name}\` custom agent, defined in ` +
|
|
180
|
+
`\`.codex/agents/${agent.name}.toml\` with \`sandbox_mode = "read-only"\`: the ` +
|
|
181
|
+
'adversarial review (`aidlc-review`) and the per-task check in ' +
|
|
182
|
+
'`.aidlc/resources/rules/task-agents.md`. Start it with spawn_agent, naming ' +
|
|
183
|
+
`\`${agent.name}\`. It replies with its findings; write them unchanged.`);
|
|
184
|
+
lines.push('');
|
|
185
|
+
lines.push('Codex loads `.codex/` only in a trusted project. Where this agent is not loaded, run the ' +
|
|
186
|
+
'review in a fresh sub-agent told to edit nothing, as before — read-only by request, not ' +
|
|
187
|
+
'by the sandbox — and say so in the review.');
|
|
188
|
+
lines.push('');
|
|
189
|
+
}
|
|
118
190
|
// Context-doc references
|
|
119
191
|
const contextEntries = Object.entries(ctx.contextDocs);
|
|
120
192
|
if (contextEntries.length > 0) {
|
|
@@ -161,6 +233,11 @@ export const codexAdapter = {
|
|
|
161
233
|
// anyone who clones the repository. Instruction-only, deliberately
|
|
162
234
|
// (agent-portability/AC-1, AC-46).
|
|
163
235
|
for (const skill of skills) {
|
|
236
|
+
const agent = findAgent(ctx, skill.meta.agent);
|
|
237
|
+
const directives = [
|
|
238
|
+
...(agent ? [agentDirective(agent)] : []),
|
|
239
|
+
...getCapabilityDirectives(skill, caps),
|
|
240
|
+
];
|
|
164
241
|
ops.push({
|
|
165
242
|
kind: 'create',
|
|
166
243
|
path: `.aidlc/skills/${skillFileName(skill)}`,
|
|
@@ -169,9 +246,21 @@ export const codexAdapter = {
|
|
|
169
246
|
ops.push({
|
|
170
247
|
kind: 'create',
|
|
171
248
|
path: `.agents/skills/${skillDirName(skill)}/SKILL.md`,
|
|
172
|
-
content: formatCodexSkill(skill),
|
|
249
|
+
content: formatCodexSkill(skill, directives),
|
|
173
250
|
});
|
|
174
251
|
}
|
|
252
|
+
// 1b. One custom agent per definition. `.codex/agents/` is Codex's project
|
|
253
|
+
// agent directory; like the rest of `.codex/`, it loads only in a trusted
|
|
254
|
+
// project, which the AGENTS.md block says (native-reviewer-agent/AC-12).
|
|
255
|
+
for (const agent of ctx.agents ?? []) {
|
|
256
|
+
const content = formatCodexAgent(agent);
|
|
257
|
+
if (content === null) {
|
|
258
|
+
warnings.push(`agent '${agent.name}': its instructions cannot be a TOML literal string ` +
|
|
259
|
+
"(they contain ''' or a control character) — .codex/agents file not written");
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
ops.push({ kind: 'create', path: `.codex/agents/${agent.name}.toml`, content });
|
|
263
|
+
}
|
|
175
264
|
// 2. Generate managed block in AGENTS.md
|
|
176
265
|
const blockContent = buildAgentsBlock(skills, caps, ctx);
|
|
177
266
|
ops.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/compile/adapters/codex.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/compile/adapters/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;GAGG;AACH,SAAS,aAAa,CAAC,KAAY;IACjC,OAAO,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAY;IACvC,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY,EAAE,aAAuB,EAAE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,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC1D,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent definitions, validated on their way from the content package to the
|
|
3
|
+
* adapters (native-reviewer-agent/AC-1, AC-11, DD-1).
|
|
4
|
+
*
|
|
5
|
+
* One definition per agent lives in `packages/content/agents/`. Each adapter
|
|
6
|
+
* that can enforce what the agent may do writes it in its harness's own format:
|
|
7
|
+
* Claude Code as `.claude/agents/<name>.md` plus a command guard, Codex as
|
|
8
|
+
* `.codex/agents/<name>.toml` with a read-only sandbox. They reach the adapters
|
|
9
|
+
* through `ProjectContext.agents`, which is why `plan()` did not grow a
|
|
10
|
+
* parameter — see `ProjectContext.agents` for what `undefined` means there.
|
|
11
|
+
*
|
|
12
|
+
* Validation happens here rather than in the content loader because this is
|
|
13
|
+
* where the values become something: the name a path segment in every project,
|
|
14
|
+
* the commands source text inside a script the harness runs. Both are checked
|
|
15
|
+
* against an allowlist before they become either.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type { Agent } from '@rasensio/aidlc-content';
|
|
20
|
+
import type { AgentDefinition, ProjectContext, Skill } from '../core/types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Ownership notice for every agent file and guard. Same wording as the rules'
|
|
23
|
+
* marker, so a reader meets one sentence for "generated, do not edit".
|
|
24
|
+
*/
|
|
25
|
+
export declare const AGENT_MARKER = "<!-- aidlc:generated \u2014 framework-owned. Edits are overwritten by `aidlc update`. -->";
|
|
26
|
+
/** The marker as a comment line for files whose syntax is not HTML-friendly. */
|
|
27
|
+
export declare const AGENT_MARKER_TEXT = "aidlc:generated \u2014 framework-owned. Edits are overwritten by `aidlc update`.";
|
|
28
|
+
/**
|
|
29
|
+
* Keep the agents that are safe to write, and say why each other one is not.
|
|
30
|
+
*
|
|
31
|
+
* @param raw - Definitions as the content package parsed them. A test seam;
|
|
32
|
+
* defaults to the content package's own.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveAgents(raw?: Agent[]): {
|
|
35
|
+
agents: AgentDefinition[];
|
|
36
|
+
warnings: string[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The agent a skill runs in, or `null` when it names none or none is supplied.
|
|
40
|
+
*
|
|
41
|
+
* Silent, so that each adapter falls back to the plain shim without repeating a
|
|
42
|
+
* warning per platform; `undefinedAgentWarnings` says it once per run.
|
|
43
|
+
*/
|
|
44
|
+
export declare function findAgent(ctx: ProjectContext, name: string | undefined): AgentDefinition | null;
|
|
45
|
+
/**
|
|
46
|
+
* One warning per skill that names an agent nobody defined (AC-11).
|
|
47
|
+
*
|
|
48
|
+
* Raised by `init` and `update` once, beside the adapter pass, rather than by
|
|
49
|
+
* each adapter: the gap is in the content, not in any platform, and two
|
|
50
|
+
* configured platforms would otherwise print it twice.
|
|
51
|
+
*/
|
|
52
|
+
export declare function undefinedAgentWarnings(skills: Skill[], agents: AgentDefinition[]): string[];
|
|
53
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/compile/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAW/E;;;GAGG;AACH,eAAO,MAAM,YAAY,8FAC+D,CAAC;AAEzF,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,qFACiD,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,KAAK,EAAiB,GAAG;IAC1D,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAmBA;AAcD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAG/F;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAQ3F"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent definitions, validated on their way from the content package to the
|
|
3
|
+
* adapters (native-reviewer-agent/AC-1, AC-11, DD-1).
|
|
4
|
+
*
|
|
5
|
+
* One definition per agent lives in `packages/content/agents/`. Each adapter
|
|
6
|
+
* that can enforce what the agent may do writes it in its harness's own format:
|
|
7
|
+
* Claude Code as `.claude/agents/<name>.md` plus a command guard, Codex as
|
|
8
|
+
* `.codex/agents/<name>.toml` with a read-only sandbox. They reach the adapters
|
|
9
|
+
* through `ProjectContext.agents`, which is why `plan()` did not grow a
|
|
10
|
+
* parameter — see `ProjectContext.agents` for what `undefined` means there.
|
|
11
|
+
*
|
|
12
|
+
* Validation happens here rather than in the content loader because this is
|
|
13
|
+
* where the values become something: the name a path segment in every project,
|
|
14
|
+
* the commands source text inside a script the harness runs. Both are checked
|
|
15
|
+
* against an allowlist before they become either.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { loadAgents } from '@rasensio/aidlc-content';
|
|
20
|
+
/** A name that is safe as a filename on every harness. */
|
|
21
|
+
const SAFE_NAME = /^[a-z][a-z0-9-]*$/;
|
|
22
|
+
/**
|
|
23
|
+
* A command prefix the guard may embed: lowercase words separated by single
|
|
24
|
+
* spaces. Nothing here can be an operator, a quote or a path.
|
|
25
|
+
*/
|
|
26
|
+
const SAFE_COMMAND = /^[a-z][a-z0-9-]*(?: [a-z][a-z0-9-]*)*$/;
|
|
27
|
+
/**
|
|
28
|
+
* Ownership notice for every agent file and guard. Same wording as the rules'
|
|
29
|
+
* marker, so a reader meets one sentence for "generated, do not edit".
|
|
30
|
+
*/
|
|
31
|
+
export const AGENT_MARKER = '<!-- aidlc:generated — framework-owned. Edits are overwritten by `aidlc update`. -->';
|
|
32
|
+
/** The marker as a comment line for files whose syntax is not HTML-friendly. */
|
|
33
|
+
export const AGENT_MARKER_TEXT = 'aidlc:generated — framework-owned. Edits are overwritten by `aidlc update`.';
|
|
34
|
+
/**
|
|
35
|
+
* Keep the agents that are safe to write, and say why each other one is not.
|
|
36
|
+
*
|
|
37
|
+
* @param raw - Definitions as the content package parsed them. A test seam;
|
|
38
|
+
* defaults to the content package's own.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveAgents(raw = loadAgents()) {
|
|
41
|
+
const agents = [];
|
|
42
|
+
const warnings = [];
|
|
43
|
+
for (const agent of raw) {
|
|
44
|
+
const problem = whyUnsafe(agent);
|
|
45
|
+
if (problem) {
|
|
46
|
+
warnings.push(`agents: skipped '${agent.name}' — ${problem}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
agents.push({
|
|
50
|
+
name: agent.name,
|
|
51
|
+
description: agent.description.trim(),
|
|
52
|
+
commands: [...agent.commands],
|
|
53
|
+
instructions: agent.instructions.replace(/^\n+/, '').replace(/\s+$/, '') + '\n',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return { agents, warnings };
|
|
57
|
+
}
|
|
58
|
+
function whyUnsafe(agent) {
|
|
59
|
+
if (!SAFE_NAME.test(agent.name))
|
|
60
|
+
return 'not a safe name';
|
|
61
|
+
if (agent.description.trim() === '' || /[\r\n]/.test(agent.description.trim())) {
|
|
62
|
+
return 'its description must be one non-empty line';
|
|
63
|
+
}
|
|
64
|
+
if (agent.instructions.trim() === '')
|
|
65
|
+
return 'it has no instructions';
|
|
66
|
+
if (agent.commands.length === 0)
|
|
67
|
+
return 'it lists no commands';
|
|
68
|
+
const bad = agent.commands.find((c) => !SAFE_COMMAND.test(c));
|
|
69
|
+
if (bad !== undefined)
|
|
70
|
+
return `command '${bad}' is not lowercase words`;
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The agent a skill runs in, or `null` when it names none or none is supplied.
|
|
75
|
+
*
|
|
76
|
+
* Silent, so that each adapter falls back to the plain shim without repeating a
|
|
77
|
+
* warning per platform; `undefinedAgentWarnings` says it once per run.
|
|
78
|
+
*/
|
|
79
|
+
export function findAgent(ctx, name) {
|
|
80
|
+
if (!name || !ctx.agents)
|
|
81
|
+
return null;
|
|
82
|
+
return ctx.agents.find((a) => a.name === name) ?? null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* One warning per skill that names an agent nobody defined (AC-11).
|
|
86
|
+
*
|
|
87
|
+
* Raised by `init` and `update` once, beside the adapter pass, rather than by
|
|
88
|
+
* each adapter: the gap is in the content, not in any platform, and two
|
|
89
|
+
* configured platforms would otherwise print it twice.
|
|
90
|
+
*/
|
|
91
|
+
export function undefinedAgentWarnings(skills, agents) {
|
|
92
|
+
const names = new Set(agents.map((a) => a.name));
|
|
93
|
+
return skills
|
|
94
|
+
.filter((s) => s.meta.agent !== undefined && !names.has(s.meta.agent))
|
|
95
|
+
.map((s) => `skill '${s.meta.name}' names agent '${s.meta.agent}', which is not defined — written without it`);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/compile/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,0DAA0D;AAC1D,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAEtC;;;GA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,IAAI,CAAC,KAAK,8CAA8C,CACpG,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/compile/loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,KAAK,EAAE,KAAK,EAAa,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMxE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAe3C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/compile/loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,KAAK,EAAE,KAAK,EAAa,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMxE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAe3C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CA2DvE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAerD;AAqFD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAuB1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACzC,IA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