@aitne/daemon 0.1.2 → 0.1.4
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/LICENSE +21 -0
- package/dist/adapters/whatsapp-adapter.d.ts.map +1 -1
- package/dist/adapters/whatsapp-adapter.js +0 -1
- package/dist/adapters/whatsapp-adapter.js.map +1 -1
- package/dist/api/integration-route-gate.d.ts +15 -11
- package/dist/api/integration-route-gate.d.ts.map +1 -1
- package/dist/api/integration-route-gate.js +60 -23
- package/dist/api/integration-route-gate.js.map +1 -1
- package/dist/api/json-body.d.ts +22 -7
- package/dist/api/json-body.d.ts.map +1 -1
- package/dist/api/json-body.js +27 -8
- package/dist/api/json-body.js.map +1 -1
- package/dist/api/routes/agent.d.ts.map +1 -1
- package/dist/api/routes/agent.js +18 -0
- package/dist/api/routes/agent.js.map +1 -1
- package/dist/api/routes/backends.d.ts.map +1 -1
- package/dist/api/routes/backends.js +96 -1
- package/dist/api/routes/backends.js.map +1 -1
- package/dist/api/routes/books.js +1 -1
- package/dist/api/routes/books.js.map +1 -1
- package/dist/api/routes/context.d.ts.map +1 -1
- package/dist/api/routes/context.js +13 -1
- package/dist/api/routes/context.js.map +1 -1
- package/dist/api/routes/dashboard.d.ts.map +1 -1
- package/dist/api/routes/dashboard.js +75 -5
- package/dist/api/routes/dashboard.js.map +1 -1
- package/dist/api/routes/github.d.ts.map +1 -1
- package/dist/api/routes/github.js +38 -5
- package/dist/api/routes/github.js.map +1 -1
- package/dist/api/routes/integrations.d.ts +35 -6
- package/dist/api/routes/integrations.d.ts.map +1 -1
- package/dist/api/routes/integrations.js +191 -16
- package/dist/api/routes/integrations.js.map +1 -1
- package/dist/api/routes/mail.d.ts.map +1 -1
- package/dist/api/routes/mail.js +112 -46
- package/dist/api/routes/mail.js.map +1 -1
- package/dist/api/routes/observations.d.ts.map +1 -1
- package/dist/api/routes/observations.js +161 -8
- package/dist/api/routes/observations.js.map +1 -1
- package/dist/api/routes/setup-migrate.d.ts +9 -1
- package/dist/api/routes/setup-migrate.d.ts.map +1 -1
- package/dist/api/routes/setup-migrate.js +4 -2
- package/dist/api/routes/setup-migrate.js.map +1 -1
- package/dist/api/routes/skills.d.ts.map +1 -1
- package/dist/api/routes/skills.js +39 -1
- package/dist/api/routes/skills.js.map +1 -1
- package/dist/api/routes/voice.d.ts.map +1 -1
- package/dist/api/routes/voice.js +154 -14
- package/dist/api/routes/voice.js.map +1 -1
- package/dist/bootstrap/adapters.d.ts +109 -0
- package/dist/bootstrap/adapters.d.ts.map +1 -0
- package/dist/bootstrap/adapters.js +237 -0
- package/dist/bootstrap/adapters.js.map +1 -0
- package/dist/bootstrap/catchup.d.ts +23 -0
- package/dist/bootstrap/catchup.d.ts.map +1 -0
- package/dist/bootstrap/catchup.js +124 -0
- package/dist/bootstrap/catchup.js.map +1 -0
- package/dist/bootstrap/schedule-helpers.d.ts +18 -0
- package/dist/bootstrap/schedule-helpers.d.ts.map +1 -0
- package/dist/bootstrap/schedule-helpers.js +96 -0
- package/dist/bootstrap/schedule-helpers.js.map +1 -0
- package/dist/bootstrap/services.d.ts +60 -0
- package/dist/bootstrap/services.d.ts.map +1 -0
- package/dist/bootstrap/services.js +209 -0
- package/dist/bootstrap/services.js.map +1 -0
- package/dist/core/backends/backend-router.d.ts +23 -0
- package/dist/core/backends/backend-router.d.ts.map +1 -1
- package/dist/core/backends/backend-router.js +48 -3
- package/dist/core/backends/backend-router.js.map +1 -1
- package/dist/core/backends/claude-auth.d.ts +70 -0
- package/dist/core/backends/claude-auth.d.ts.map +1 -0
- package/dist/core/backends/claude-auth.js +198 -0
- package/dist/core/backends/claude-auth.js.map +1 -0
- package/dist/core/backends/claude-code-core.d.ts +47 -119
- package/dist/core/backends/claude-code-core.d.ts.map +1 -1
- package/dist/core/backends/claude-code-core.js +112 -1565
- package/dist/core/backends/claude-code-core.js.map +1 -1
- package/dist/core/backends/claude-delegated.d.ts +86 -0
- package/dist/core/backends/claude-delegated.d.ts.map +1 -0
- package/dist/core/backends/claude-delegated.js +801 -0
- package/dist/core/backends/claude-delegated.js.map +1 -0
- package/dist/core/backends/claude-errors.d.ts +39 -0
- package/dist/core/backends/claude-errors.d.ts.map +1 -0
- package/dist/core/backends/claude-errors.js +71 -0
- package/dist/core/backends/claude-errors.js.map +1 -0
- package/dist/core/backends/claude-probe.d.ts +103 -0
- package/dist/core/backends/claude-probe.d.ts.map +1 -0
- package/dist/core/backends/claude-probe.js +336 -0
- package/dist/core/backends/claude-probe.js.map +1 -0
- package/dist/core/backends/claude-tool-collection.d.ts +135 -0
- package/dist/core/backends/claude-tool-collection.d.ts.map +1 -0
- package/dist/core/backends/claude-tool-collection.js +831 -0
- package/dist/core/backends/claude-tool-collection.js.map +1 -0
- package/dist/core/backends/gemini-cli-core.d.ts +21 -0
- package/dist/core/backends/gemini-cli-core.d.ts.map +1 -1
- package/dist/core/backends/gemini-cli-core.js +84 -6
- package/dist/core/backends/gemini-cli-core.js.map +1 -1
- package/dist/core/backends/prompt-utils.d.ts +1 -0
- package/dist/core/backends/prompt-utils.d.ts.map +1 -1
- package/dist/core/backends/prompt-utils.js +60 -3
- package/dist/core/backends/prompt-utils.js.map +1 -1
- package/dist/core/context-builder.d.ts +36 -12
- package/dist/core/context-builder.d.ts.map +1 -1
- package/dist/core/context-builder.js +179 -89
- package/dist/core/context-builder.js.map +1 -1
- package/dist/core/dispatcher-date-utils.d.ts +49 -0
- package/dist/core/dispatcher-date-utils.d.ts.map +1 -0
- package/dist/core/dispatcher-date-utils.js +132 -0
- package/dist/core/dispatcher-date-utils.js.map +1 -0
- package/dist/core/dispatcher-error-handling.d.ts +159 -0
- package/dist/core/dispatcher-error-handling.d.ts.map +1 -0
- package/dist/core/dispatcher-error-handling.js +393 -0
- package/dist/core/dispatcher-error-handling.js.map +1 -0
- package/dist/core/dispatcher-hourly-check.d.ts +150 -0
- package/dist/core/dispatcher-hourly-check.d.ts.map +1 -0
- package/dist/core/dispatcher-hourly-check.js +665 -0
- package/dist/core/dispatcher-hourly-check.js.map +1 -0
- package/dist/core/dispatcher-message-handler.d.ts +170 -0
- package/dist/core/dispatcher-message-handler.d.ts.map +1 -0
- package/dist/core/dispatcher-message-handler.js +1054 -0
- package/dist/core/dispatcher-message-handler.js.map +1 -0
- package/dist/core/dispatcher-morning-routine.d.ts +169 -0
- package/dist/core/dispatcher-morning-routine.d.ts.map +1 -0
- package/dist/core/dispatcher-morning-routine.js +434 -0
- package/dist/core/dispatcher-morning-routine.js.map +1 -0
- package/dist/core/dispatcher-prompt.d.ts +107 -0
- package/dist/core/dispatcher-prompt.d.ts.map +1 -0
- package/dist/core/dispatcher-prompt.js +227 -0
- package/dist/core/dispatcher-prompt.js.map +1 -0
- package/dist/core/dispatcher-repository-helpers.d.ts +39 -0
- package/dist/core/dispatcher-repository-helpers.d.ts.map +1 -0
- package/dist/core/dispatcher-repository-helpers.js +86 -0
- package/dist/core/dispatcher-repository-helpers.js.map +1 -0
- package/dist/core/dispatcher-result-processor.d.ts +145 -0
- package/dist/core/dispatcher-result-processor.d.ts.map +1 -0
- package/dist/core/dispatcher-result-processor.js +414 -0
- package/dist/core/dispatcher-result-processor.js.map +1 -0
- package/dist/core/dispatcher-scheduled-tasks.d.ts +406 -0
- package/dist/core/dispatcher-scheduled-tasks.d.ts.map +1 -0
- package/dist/core/dispatcher-scheduled-tasks.js +998 -0
- package/dist/core/dispatcher-scheduled-tasks.js.map +1 -0
- package/dist/core/dispatcher-types.d.ts +296 -0
- package/dist/core/dispatcher-types.d.ts.map +1 -0
- package/dist/core/dispatcher-types.js +106 -0
- package/dist/core/dispatcher-types.js.map +1 -0
- package/dist/core/dispatcher.d.ts +86 -610
- package/dist/core/dispatcher.d.ts.map +1 -1
- package/dist/core/dispatcher.js +293 -3542
- package/dist/core/dispatcher.js.map +1 -1
- package/dist/core/integration-health.d.ts +18 -10
- package/dist/core/integration-health.d.ts.map +1 -1
- package/dist/core/integration-health.js +31 -1
- package/dist/core/integration-health.js.map +1 -1
- package/dist/core/integration-lifecycle.d.ts +65 -0
- package/dist/core/integration-lifecycle.d.ts.map +1 -1
- package/dist/core/integration-lifecycle.js +167 -16
- package/dist/core/integration-lifecycle.js.map +1 -1
- package/dist/core/integration-main-backend.d.ts +40 -0
- package/dist/core/integration-main-backend.d.ts.map +1 -1
- package/dist/core/integration-main-backend.js +89 -2
- package/dist/core/integration-main-backend.js.map +1 -1
- package/dist/core/management-md.d.ts +51 -17
- package/dist/core/management-md.d.ts.map +1 -1
- package/dist/core/management-md.js +233 -56
- package/dist/core/management-md.js.map +1 -1
- package/dist/core/output-language-policy.d.ts +74 -0
- package/dist/core/output-language-policy.d.ts.map +1 -0
- package/dist/core/output-language-policy.js +194 -0
- package/dist/core/output-language-policy.js.map +1 -0
- package/dist/core/prompts.d.ts +1 -0
- package/dist/core/prompts.d.ts.map +1 -1
- package/dist/core/prompts.js +121 -3
- package/dist/core/prompts.js.map +1 -1
- package/dist/core/repository-management-docs.d.ts +24 -0
- package/dist/core/repository-management-docs.d.ts.map +1 -1
- package/dist/core/repository-management-docs.js +210 -26
- package/dist/core/repository-management-docs.js.map +1 -1
- package/dist/core/routine-acquisition-plan.d.ts +131 -0
- package/dist/core/routine-acquisition-plan.d.ts.map +1 -0
- package/dist/core/routine-acquisition-plan.js +268 -0
- package/dist/core/routine-acquisition-plan.js.map +1 -0
- package/dist/core/routine-fetch-window-runner.d.ts +201 -0
- package/dist/core/routine-fetch-window-runner.d.ts.map +1 -0
- package/dist/core/routine-fetch-window-runner.js +661 -0
- package/dist/core/routine-fetch-window-runner.js.map +1 -0
- package/dist/core/routine-windows.d.ts +156 -0
- package/dist/core/routine-windows.d.ts.map +1 -0
- package/dist/core/routine-windows.js +330 -0
- package/dist/core/routine-windows.js.map +1 -0
- package/dist/core/skills-compiler.d.ts +11 -0
- package/dist/core/skills-compiler.d.ts.map +1 -1
- package/dist/core/skills-compiler.js +102 -13
- package/dist/core/skills-compiler.js.map +1 -1
- package/dist/core/skills-manifest.d.ts.map +1 -1
- package/dist/core/skills-manifest.js +26 -0
- package/dist/core/skills-manifest.js.map +1 -1
- package/dist/core/system-reset.d.ts.map +1 -1
- package/dist/core/system-reset.js +25 -2
- package/dist/core/system-reset.js.map +1 -1
- package/dist/db/observations.d.ts +45 -2
- package/dist/db/observations.d.ts.map +1 -1
- package/dist/db/observations.js +112 -14
- package/dist/db/observations.js.map +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +13 -25
- package/dist/db/schema.js.map +1 -1
- package/dist/index.js +83 -610
- package/dist/index.js.map +1 -1
- package/dist/observers/delegated-sync-worker.d.ts +45 -2
- package/dist/observers/delegated-sync-worker.d.ts.map +1 -1
- package/dist/observers/delegated-sync-worker.js +71 -21
- package/dist/observers/delegated-sync-worker.js.map +1 -1
- package/dist/observers/mail-poller.d.ts +12 -5
- package/dist/observers/mail-poller.d.ts.map +1 -1
- package/dist/observers/mail-poller.js +36 -14
- package/dist/observers/mail-poller.js.map +1 -1
- package/dist/observers/manager.d.ts +37 -5
- package/dist/observers/manager.d.ts.map +1 -1
- package/dist/observers/manager.js +28 -10
- package/dist/observers/manager.js.map +1 -1
- package/dist/safety/risk-classifier.d.ts.map +1 -1
- package/dist/safety/risk-classifier.js +5 -0
- package/dist/safety/risk-classifier.js.map +1 -1
- package/dist/services/delegated-backend-invoker.d.ts +1 -51
- package/dist/services/delegated-backend-invoker.d.ts.map +1 -1
- package/dist/services/delegated-backend-invoker.js +41 -480
- package/dist/services/delegated-backend-invoker.js.map +1 -1
- package/dist/services/delegated-invoker-audit.d.ts +94 -0
- package/dist/services/delegated-invoker-audit.d.ts.map +1 -0
- package/dist/services/delegated-invoker-audit.js +238 -0
- package/dist/services/delegated-invoker-audit.js.map +1 -0
- package/dist/services/delegated-invoker-cache-hits.d.ts +34 -0
- package/dist/services/delegated-invoker-cache-hits.d.ts.map +1 -0
- package/dist/services/delegated-invoker-cache-hits.js +104 -0
- package/dist/services/delegated-invoker-cache-hits.js.map +1 -0
- package/dist/services/delegated-invoker-janitors.d.ts +28 -0
- package/dist/services/delegated-invoker-janitors.d.ts.map +1 -0
- package/dist/services/delegated-invoker-janitors.js +104 -0
- package/dist/services/delegated-invoker-janitors.js.map +1 -0
- package/dist/services/delegated-invoker-utils.d.ts +42 -0
- package/dist/services/delegated-invoker-utils.d.ts.map +1 -0
- package/dist/services/delegated-invoker-utils.js +100 -0
- package/dist/services/delegated-invoker-utils.js.map +1 -0
- package/dist/services/delegated-task-runtime.d.ts +1 -1
- package/dist/services/delegated-task-runtime.js +1 -1
- package/dist/services/integrations/snapshot-partitions.d.ts +5 -0
- package/dist/services/integrations/snapshot-partitions.d.ts.map +1 -1
- package/dist/services/integrations/snapshot-partitions.js +12 -0
- package/dist/services/integrations/snapshot-partitions.js.map +1 -1
- package/dist/services/voice/transcriber-impl.d.ts.map +1 -1
- package/dist/services/voice/transcriber-impl.js +46 -0
- package/dist/services/voice/transcriber-impl.js.map +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output language policy — one source of truth for the rule injected into
|
|
3
|
+
* every backend session.
|
|
4
|
+
*
|
|
5
|
+
* Design: `docs/design/appendices/output-language-policy.md`
|
|
6
|
+
*
|
|
7
|
+
* Two surfaces consume this module:
|
|
8
|
+
*
|
|
9
|
+
* 1. `ContextBuilder` (per-turn XML context). `renderOutputLanguagePolicyBlock`
|
|
10
|
+
* emits the full `<output_language_policy>` block alongside
|
|
11
|
+
* `<settings primary_language=…>`. Refreshes every turn, so it
|
|
12
|
+
* tracks runtime `PATCH /api/config` changes to `primaryLanguage`.
|
|
13
|
+
*
|
|
14
|
+
* 2. `skills-compiler` (persistent system prompt). The renderer in the
|
|
15
|
+
* instruction-file path emits the much shorter
|
|
16
|
+
* `## Output language` pointer paragraph. Identical byte-for-byte
|
|
17
|
+
* across CLAUDE.md / AGENTS.md / GEMINI.md so the agent reads the
|
|
18
|
+
* same rule on every backend; intentionally carries NO value
|
|
19
|
+
* substitutions (no inlined `primaryLanguage`) — the live value
|
|
20
|
+
* lives in the per-turn XML and would go stale here.
|
|
21
|
+
*
|
|
22
|
+
* Treat both renderers as the unique source of the policy text. The
|
|
23
|
+
* grep guard in `output-language-policy.test.ts` enforces this — adding
|
|
24
|
+
* the same prose elsewhere will fail CI.
|
|
25
|
+
*/
|
|
26
|
+
const POLICY_BLOCK_OPEN = "<output_language_policy>";
|
|
27
|
+
const POLICY_BLOCK_CLOSE = "</output_language_policy>";
|
|
28
|
+
/**
|
|
29
|
+
* Sentinel substring that any duplicate of the policy text would contain.
|
|
30
|
+
* The grep guard test scans `src/` and `agent-assets/` (excluding this
|
|
31
|
+
* file and the related test) for the sentinel and fails CI if it
|
|
32
|
+
* appears anywhere else.
|
|
33
|
+
*/
|
|
34
|
+
export const OUTPUT_LANGUAGE_POLICY_SENTINEL = "Apply primary_language to:";
|
|
35
|
+
/**
|
|
36
|
+
* Full `<output_language_policy>` block, populated with the current
|
|
37
|
+
* `primaryLanguage`. Injected by `ContextBuilder` once per turn,
|
|
38
|
+
* immediately after the existing `<settings primary_language=… />`
|
|
39
|
+
* line.
|
|
40
|
+
*/
|
|
41
|
+
export function renderOutputLanguagePolicyBlock(primaryLanguage) {
|
|
42
|
+
const lang = primaryLanguage.trim() || "en";
|
|
43
|
+
return [
|
|
44
|
+
POLICY_BLOCK_OPEN,
|
|
45
|
+
` Setting: primary_language="${lang}"`,
|
|
46
|
+
"",
|
|
47
|
+
" Apply primary_language to:",
|
|
48
|
+
" - Body prose, bullets, summaries, and narrative written via",
|
|
49
|
+
" /api/context/* (knowledge files under ~/.personal-agent/context/)",
|
|
50
|
+
" - Notes the agent creates in the user's Obsidian vault or Notion",
|
|
51
|
+
" - Section content under user-customized headers (whatever language",
|
|
52
|
+
" the user wrote the header in, content matches)",
|
|
53
|
+
"",
|
|
54
|
+
" DM replies to the owner:",
|
|
55
|
+
" - Match the language of the user's most recent message",
|
|
56
|
+
" - Fall back to primary_language when the input is ambiguous, empty,",
|
|
57
|
+
" or system-generated",
|
|
58
|
+
" - Character block (tone, formality, emoji, verbosity) overrides",
|
|
59
|
+
" locale defaults — preserve the user's chosen voice in any language",
|
|
60
|
+
"",
|
|
61
|
+
" Do NOT translate:",
|
|
62
|
+
" - Structural H2/H3 headers that match the shipped template skeleton",
|
|
63
|
+
" (Identity, Work Pattern, Annual Goals, etc.) — keep English so",
|
|
64
|
+
" parsers (management-md, profile-importer, journal readers) keep",
|
|
65
|
+
" working",
|
|
66
|
+
" - YAML frontmatter keys, wiki-link targets ([[user/profile]]),",
|
|
67
|
+
" file paths, tool names, identifiers, env vars",
|
|
68
|
+
" - Fenced code blocks, JSON, CLI commands, URLs",
|
|
69
|
+
" - The agent journal (agent/journal.md is English by",
|
|
70
|
+
" rules/journal-format.md)",
|
|
71
|
+
" - rules/*.md files (management, redaction, mcp, policies) — these",
|
|
72
|
+
" are a structured registry, not prose",
|
|
73
|
+
"",
|
|
74
|
+
" User-customized headers win:",
|
|
75
|
+
" - If the running file already uses a translated header (e.g.",
|
|
76
|
+
` "## アイデンティティ"), preserve it and write content under it;`,
|
|
77
|
+
" do not revert to the English template header",
|
|
78
|
+
"",
|
|
79
|
+
" Skeleton precedence:",
|
|
80
|
+
" - When creating a fresh file, copy the template skeleton verbatim",
|
|
81
|
+
" (English H2s) and fill the body in primary_language",
|
|
82
|
+
POLICY_BLOCK_CLOSE,
|
|
83
|
+
].join("\n");
|
|
84
|
+
}
|
|
85
|
+
/** Heading line used by the instruction-file pointer block. */
|
|
86
|
+
export const OUTPUT_LANGUAGE_POINTER_HEADING = "## Output language";
|
|
87
|
+
/** End-of-character-block sentinel emitted by `character-block.ts`. */
|
|
88
|
+
const CHARACTER_END_MARKER = "<!-- character:end -->";
|
|
89
|
+
/** End-of-safety-preamble sentinel emitted by `skills-compiler.ts`. */
|
|
90
|
+
const SAFETY_END_MARKER = "<!-- safety:end -->";
|
|
91
|
+
/**
|
|
92
|
+
* Insert the `## Output language` pointer block into the rendered Claude
|
|
93
|
+
* instruction body. Placement mirrors the design §13.3 stack ordering —
|
|
94
|
+
* after safety, after the user-defined character block (if any), and
|
|
95
|
+
* before the runtime profile body.
|
|
96
|
+
*
|
|
97
|
+
* Placement search order:
|
|
98
|
+
*
|
|
99
|
+
* 1. Right after the character-block end marker (`<!-- character:end -->`
|
|
100
|
+
* followed by the FOOTER paragraph and a blank line). When the
|
|
101
|
+
* character block is present this is the natural "below character"
|
|
102
|
+
* seam.
|
|
103
|
+
* 2. Right after the safety-end sentinel when the character block is
|
|
104
|
+
* absent.
|
|
105
|
+
* 3. Before the first `## ` section heading as a final fallback for
|
|
106
|
+
* legacy bodies that carry neither sentinel.
|
|
107
|
+
*
|
|
108
|
+
* Idempotent: a body that already contains the heading is returned
|
|
109
|
+
* unchanged. This matters because `applyCharacterBlockRewrite` is
|
|
110
|
+
* idempotent in the same way and the two helpers may run in succession
|
|
111
|
+
* across re-materialization.
|
|
112
|
+
*/
|
|
113
|
+
export function applyOutputLanguagePointerRewrite(content) {
|
|
114
|
+
if (content.includes(OUTPUT_LANGUAGE_POINTER_HEADING)) {
|
|
115
|
+
return content;
|
|
116
|
+
}
|
|
117
|
+
const block = renderOutputLanguagePolicyPointer();
|
|
118
|
+
const characterEndIdx = content.indexOf(CHARACTER_END_MARKER);
|
|
119
|
+
if (characterEndIdx >= 0) {
|
|
120
|
+
// The character block ends with FOOTER prose after the end-marker.
|
|
121
|
+
// Insert *after* the FOOTER, immediately before the next `## ` heading
|
|
122
|
+
// so the pointer block becomes a peer section of Character (mirrors
|
|
123
|
+
// the §13.3 stack ordering).
|
|
124
|
+
const searchFrom = characterEndIdx + CHARACTER_END_MARKER.length;
|
|
125
|
+
const tail = content.slice(searchFrom);
|
|
126
|
+
const nextHeadingOffset = tail.search(/\n## /);
|
|
127
|
+
if (nextHeadingOffset >= 0) {
|
|
128
|
+
const insertAt = searchFrom + nextHeadingOffset + 1;
|
|
129
|
+
const before = content.slice(0, insertAt);
|
|
130
|
+
const after = content.slice(insertAt);
|
|
131
|
+
return `${before}${block}\n\n${after}`;
|
|
132
|
+
}
|
|
133
|
+
const trimmed = content.replace(/\s+$/, "");
|
|
134
|
+
return `${trimmed}\n\n${block}\n`;
|
|
135
|
+
}
|
|
136
|
+
const safetyEndIdx = content.indexOf(SAFETY_END_MARKER);
|
|
137
|
+
if (safetyEndIdx >= 0) {
|
|
138
|
+
const afterSentinel = safetyEndIdx + SAFETY_END_MARKER.length;
|
|
139
|
+
let cursor = afterSentinel;
|
|
140
|
+
while (cursor < content.length && /\s/.test(content[cursor]))
|
|
141
|
+
cursor++;
|
|
142
|
+
const before = content.slice(0, afterSentinel);
|
|
143
|
+
const after = content.slice(cursor);
|
|
144
|
+
return after ? `${before}\n\n${block}\n\n${after}` : `${before}\n\n${block}\n`;
|
|
145
|
+
}
|
|
146
|
+
const firstHeadingIdx = findFirstSectionHeading(content);
|
|
147
|
+
if (firstHeadingIdx < 0) {
|
|
148
|
+
const trimmed = content.replace(/\s+$/, "");
|
|
149
|
+
if (!trimmed)
|
|
150
|
+
return `${block}\n`;
|
|
151
|
+
return `${trimmed}\n\n${block}\n`;
|
|
152
|
+
}
|
|
153
|
+
const before = content.slice(0, firstHeadingIdx);
|
|
154
|
+
const after = content.slice(firstHeadingIdx);
|
|
155
|
+
return `${before}${block}\n\n${after}`;
|
|
156
|
+
}
|
|
157
|
+
function findFirstSectionHeading(content) {
|
|
158
|
+
if (content.startsWith("## "))
|
|
159
|
+
return 0;
|
|
160
|
+
const idx = content.indexOf("\n## ");
|
|
161
|
+
return idx < 0 ? -1 : idx + 1;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Short `## Output language` pointer paragraph inlined verbatim into
|
|
165
|
+
* CLAUDE.md / AGENTS.md / GEMINI.md by `skills-compiler`. Declarative,
|
|
166
|
+
* no value substitutions — the live `primaryLanguage` is carried by
|
|
167
|
+
* the per-turn `<output_language_policy>` XML block instead, so the
|
|
168
|
+
* instruction file never goes stale when the user PATCHes the setting
|
|
169
|
+
* mid-session. See design §13.4 / §13.5.
|
|
170
|
+
*/
|
|
171
|
+
export function renderOutputLanguagePolicyPointer() {
|
|
172
|
+
return [
|
|
173
|
+
"## Output language",
|
|
174
|
+
"",
|
|
175
|
+
"Output language is governed by `<output_language_policy>` in your",
|
|
176
|
+
"turn context (full text, refreshes on every turn so it tracks runtime",
|
|
177
|
+
"setting changes). In short:",
|
|
178
|
+
"",
|
|
179
|
+
"- **Knowledge files** under `/api/context/*`, **Obsidian** notes,",
|
|
180
|
+
" **Notion** pages, and other user-facing notes → write the body in",
|
|
181
|
+
" `<settings primary_language>`; keep template H2/H3 headers in",
|
|
182
|
+
" English (or preserve user-customized headers verbatim).",
|
|
183
|
+
"- **DM replies** to the owner → match the user's input language;",
|
|
184
|
+
" fall back to `<settings primary_language>` when input is ambiguous",
|
|
185
|
+
" or the turn is system-initiated. Character block (tone, formality,",
|
|
186
|
+
" emoji) overrides locale defaults.",
|
|
187
|
+
"- **Agent-internal surfaces** (this file, skill bodies, the agent",
|
|
188
|
+
" journal, API/log/audit, `rules/*.md` registry) → English. Always.",
|
|
189
|
+
"",
|
|
190
|
+
"See `docs/design/appendices/output-language-policy.md` for the full",
|
|
191
|
+
"rule and policy taxonomy.",
|
|
192
|
+
].join("\n");
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=output-language-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-language-policy.js","sourceRoot":"","sources":["../../src/core/output-language-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AACrD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,4BAA4B,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,eAAuB;IAEvB,MAAM,IAAI,GA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CAAC;AACf,CAAC"}
|
package/dist/core/prompts.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare function resetTaskFlowsForTest(): void;
|
|
|
37
37
|
* treats null as "no override layer present".
|
|
38
38
|
*/
|
|
39
39
|
export declare function getUserTaskFlowsDir(): string | null;
|
|
40
|
+
export declare function expandPartialIncludes(content: string): string;
|
|
40
41
|
/**
|
|
41
42
|
* Get the task flow template for a given event type.
|
|
42
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAcvB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAI1E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAgBD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEnD;AA+JD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,GAC/D,MAAM,CA2BR;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE;QACnB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;CAC7D,GACL,MAAM,CAoBR;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,aAAa,IAAI,iBAAiB,EAAE,CAWnD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG;IAChD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAcA"}
|
package/dist/core/prompts.js
CHANGED
|
@@ -13,6 +13,7 @@ import { fileURLToPath } from "node:url";
|
|
|
13
13
|
import { applyIntegrationModeFilter, isCustomRoutineKey, selectTaskFlowVariantSuffix, substituteBrandTokens, } from "@aitne/shared";
|
|
14
14
|
import { appendPolicyBlocks, createPromptInjectionBudget, } from "./policy-files.js";
|
|
15
15
|
import { appendReviewContextBlocks } from "./review-context.js";
|
|
16
|
+
import { substituteIntegrationRoutingTables } from "./management-md.js";
|
|
16
17
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
18
|
let taskFlowsDir = null;
|
|
18
19
|
let userTaskFlowsDir = null;
|
|
@@ -124,11 +125,112 @@ function loadFlowVariant(eventType, backendId, integrations) {
|
|
|
124
125
|
if (suffix !== "direct") {
|
|
125
126
|
const variant = readFlowFile(`${eventType}.${suffix}.md`);
|
|
126
127
|
if (variant !== null)
|
|
127
|
-
return variant;
|
|
128
|
+
return expandTaskFlowPartials(variant, eventType);
|
|
128
129
|
}
|
|
129
130
|
// Fall back to the canonical file (covers direct mode and missing variants)
|
|
130
131
|
return loadFlow(eventType);
|
|
131
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* INTEGRATION_NATIVE_MODE_DESIGN.md §8.2 — a task-flow variant may
|
|
135
|
+
* include the canonical base flow via the `{{> base }}` directive,
|
|
136
|
+
* mirroring `renderPartialIncludes` for skills (skills-compiler.ts:1296).
|
|
137
|
+
* The directive is replaced with the body of `<eventType>.md` with the
|
|
138
|
+
* leading `{context}\n\n` block stripped — the variant carries its own
|
|
139
|
+
* `{context}` at the top, and duplicating the token would double the
|
|
140
|
+
* context-builder output once `resolveTemplate` fills both occurrences.
|
|
141
|
+
*
|
|
142
|
+
* Missing / empty base flow → directive collapses to the empty string
|
|
143
|
+
* (mirrors `renderPartialIncludes`'s missing-base behaviour). Pure
|
|
144
|
+
* function on the file content; no caching beyond the loader's existing
|
|
145
|
+
* `flowCache`.
|
|
146
|
+
*/
|
|
147
|
+
function expandTaskFlowPartials(content, eventType) {
|
|
148
|
+
if (!content.includes("{{> base }}"))
|
|
149
|
+
return content;
|
|
150
|
+
// Resolve against the BUNDLED base file only — the user-override
|
|
151
|
+
// resolution layer is one-way (variants may override; partial includes
|
|
152
|
+
// pin to canonical assets so a malformed override doesn't cascade into
|
|
153
|
+
// every variant that includes it). This matches the skill partial
|
|
154
|
+
// resolver's "read from src verbatim" stance (skills-compiler.ts:612).
|
|
155
|
+
const dir = resolveTaskFlowsDir();
|
|
156
|
+
const basePath = join(dir, `${eventType}.md`);
|
|
157
|
+
if (!existsSync(basePath))
|
|
158
|
+
return content.replaceAll("{{> base }}", "");
|
|
159
|
+
const baseRaw = substituteBrandTokens(readFileSync(basePath, "utf-8"));
|
|
160
|
+
// Strip the leading `{context}\n\n` (or `{context}\n` for unix-style
|
|
161
|
+
// files that omit the second newline) so the merged body has exactly
|
|
162
|
+
// one context block at the very top — the one the variant author put
|
|
163
|
+
// there. Anchored at start with `^` so a `{context}` token appearing
|
|
164
|
+
// mid-flow (none today, but defensive) is preserved.
|
|
165
|
+
const baseStripped = baseRaw.replace(/^\{context\}\n\n?/, "");
|
|
166
|
+
return content.replaceAll("{{> base }}", baseStripped);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* ROUTINE_DATA_ACQUISITION_DESIGN.md Phase 1 / F0 — resolve
|
|
170
|
+
* `{include:_partials/<name>.md}` directives in a task-flow body by
|
|
171
|
+
* inlining the verbatim contents of `agent-assets/task-flows/_partials/
|
|
172
|
+
* <name>.md`. Runs BEFORE `applyIntegrationModeFilter` so any
|
|
173
|
+
* `<!-- mode:...:... -->` blocks the partial carries are filtered
|
|
174
|
+
* normally for the current integration state.
|
|
175
|
+
*
|
|
176
|
+
* Behaviour:
|
|
177
|
+
* - Partials live at `agent-assets/task-flows/_partials/`. The
|
|
178
|
+
* user-override layer (`<dataDir>/task-flows/_partials/`) wins per
|
|
179
|
+
* file, matching `readFlowFile`'s contract.
|
|
180
|
+
* - The leading YAML frontmatter block (`---\n…\n---\n`) is stripped
|
|
181
|
+
* so authors may carry editorial metadata in partials without it
|
|
182
|
+
* leaking into the prompt body.
|
|
183
|
+
* - **Depth cap = 1.** Includes inside an included partial are NOT
|
|
184
|
+
* expanded — the include directive there is left visible so a
|
|
185
|
+
* runaway recursion shows up as a verbatim `{include:...}` token in
|
|
186
|
+
* the rendered prompt rather than silently looping. Tests / authors
|
|
187
|
+
* can grep for the directive to detect cycles.
|
|
188
|
+
* - Missing partials collapse to the empty string, matching
|
|
189
|
+
* `{{> base }}`'s missing-base behaviour. The lint pass (R2/F8)
|
|
190
|
+
* catches references to non-existent partials at test time.
|
|
191
|
+
* - Filename safety: `<name>` is constrained to
|
|
192
|
+
* `[A-Za-z0-9][A-Za-z0-9._-]*` — no slashes, no `..` — so an attacker
|
|
193
|
+
* or buggy authoring tool cannot path-traverse out of `_partials/`.
|
|
194
|
+
* Directives with invalid names are left verbatim, which means the
|
|
195
|
+
* raw token shows up in the prompt (visible failure) rather than
|
|
196
|
+
* silently disappearing.
|
|
197
|
+
*/
|
|
198
|
+
const PARTIAL_INCLUDE_RE = /\{include:_partials\/([A-Za-z0-9][A-Za-z0-9._-]*\.md)\}/g;
|
|
199
|
+
const FRONTMATTER_STRIP_RE = /^---\r?\n[\s\S]*?\r?\n---\r?\n?/;
|
|
200
|
+
function readPartialFile(name) {
|
|
201
|
+
// User-override layer first (mirrors readFlowFile). The file lives at
|
|
202
|
+
// `<dataDir>/task-flows/_partials/<name>` — same nesting as the
|
|
203
|
+
// bundled layout so an author can override one partial without
|
|
204
|
+
// disturbing the rest.
|
|
205
|
+
if (userTaskFlowsDir) {
|
|
206
|
+
const userPath = join(userTaskFlowsDir, "_partials", name);
|
|
207
|
+
if (existsSync(userPath)) {
|
|
208
|
+
try {
|
|
209
|
+
return substituteBrandTokens(readFileSync(userPath, "utf-8"));
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// Corrupt override falls through to the bundled file.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const bundledPath = join(resolveTaskFlowsDir(), "_partials", name);
|
|
217
|
+
if (!existsSync(bundledPath))
|
|
218
|
+
return null;
|
|
219
|
+
return substituteBrandTokens(readFileSync(bundledPath, "utf-8"));
|
|
220
|
+
}
|
|
221
|
+
export function expandPartialIncludes(content) {
|
|
222
|
+
if (!content.includes("{include:_partials/"))
|
|
223
|
+
return content;
|
|
224
|
+
return content.replace(PARTIAL_INCLUDE_RE, (_match, filename) => {
|
|
225
|
+
const raw = readPartialFile(filename);
|
|
226
|
+
if (raw === null)
|
|
227
|
+
return "";
|
|
228
|
+
// Strip leading frontmatter block, then trim a single trailing
|
|
229
|
+
// newline so the substitution doesn't accumulate blank-line drift
|
|
230
|
+
// across multiple sibling includes.
|
|
231
|
+
return raw.replace(FRONTMATTER_STRIP_RE, "").replace(/\n+$/, "\n");
|
|
232
|
+
});
|
|
233
|
+
}
|
|
132
234
|
/**
|
|
133
235
|
* Get the task flow template for a given event type.
|
|
134
236
|
*
|
|
@@ -151,14 +253,30 @@ export function getTaskFlow(eventType, backendId, integrations) {
|
|
|
151
253
|
const raw = resolveTaskFlowSource(eventType, backendId, integrations);
|
|
152
254
|
if (!raw)
|
|
153
255
|
return raw;
|
|
256
|
+
// ROUTINE_DATA_ACQUISITION_DESIGN.md F0 — expand
|
|
257
|
+
// `{include:_partials/<name>.md}` directives BEFORE mode filtering so
|
|
258
|
+
// the partial's `<!-- mode:... -->` blocks participate in the same
|
|
259
|
+
// filter pass as the host body. Depth cap = 1; nested includes inside
|
|
260
|
+
// a partial are left verbatim (visible failure on cycles).
|
|
261
|
+
let rendered = expandPartialIncludes(raw);
|
|
154
262
|
// Mode-conditional sections are stripped only when we know the session
|
|
155
263
|
// backend (from `backendId`). Tooling that doesn't carry one (legacy
|
|
156
264
|
// tests, prompt previews) keeps the markers visible — better than
|
|
157
265
|
// collapsing them with a placeholder backend that may misroute prose.
|
|
158
266
|
if (backendId && integrations) {
|
|
159
|
-
|
|
267
|
+
rendered = applyIntegrationModeFilter(rendered, integrations, backendId);
|
|
268
|
+
}
|
|
269
|
+
// INTEGRATION_NATIVE_MODE_DESIGN.md §6.5.2 / §7.3 — substitute the
|
|
270
|
+
// `<integration-routing-table>` and `<integration-routing-table-actionable>`
|
|
271
|
+
// placeholders the native variants and (Phase C onwards) the direct/
|
|
272
|
+
// delegated variants embed. Runs AFTER mode-conditional filtering so
|
|
273
|
+
// a placeholder inside a struck branch is dropped before substitution.
|
|
274
|
+
// Pure no-op when neither placeholder is present, so legacy task-flow
|
|
275
|
+
// files that pre-date the placeholder syntax are unaffected.
|
|
276
|
+
if (integrations) {
|
|
277
|
+
rendered = substituteIntegrationRoutingTables(rendered, integrations);
|
|
160
278
|
}
|
|
161
|
-
return
|
|
279
|
+
return rendered;
|
|
162
280
|
}
|
|
163
281
|
function resolveTaskFlowSource(eventType, backendId, integrations) {
|
|
164
282
|
if (backendId && integrations) {
|
package/dist/core/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,GAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,GAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAA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AK,CAAC,CAAC;aACtC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACf,kEAAkE;YAClE,IAAI,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACpC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -189,6 +189,30 @@ export declare function runRepositoryManagementScan(deps: RepositoryManagementDo
|
|
|
189
189
|
* without writing.
|
|
190
190
|
*/
|
|
191
191
|
export declare function runRepositoryArchitectureSectionReplace(deps: RepositoryManagementDocDeps, markdown: string): Promise<ArchitectureSectionReplaceResult>;
|
|
192
|
+
/**
|
|
193
|
+
* Replace the marker-bracketed Architecture block in an overview file with
|
|
194
|
+
* a freshly composed body. Exported solely so the unit suite can pin edge
|
|
195
|
+
* cases (code-fence collisions, CRLF, orphan markers) without having to
|
|
196
|
+
* stand up a full SQLite + filesystem fixture for every shape.
|
|
197
|
+
*
|
|
198
|
+
* Contract:
|
|
199
|
+
* - Marker matches inside fenced code blocks (``` or ~~~) are ignored —
|
|
200
|
+
* the daemon's own README, an Architecture body that includes example
|
|
201
|
+
* fences, or a paste from a chat could otherwise mis-anchor the merge
|
|
202
|
+
* and overwrite Summary / Notable Changes / Daily Activity Log.
|
|
203
|
+
* - CRLF input is preserved (LF input stays LF).
|
|
204
|
+
* - Orphan markers (only `:start` or only `:end` present) are stripped
|
|
205
|
+
* and a clean block is re-injected under `## Architecture` — never
|
|
206
|
+
* left to drift in the file where the next refresh might mis-bind to
|
|
207
|
+
* them.
|
|
208
|
+
* - `## Architecture` / `## Notable Changes` headings are matched with
|
|
209
|
+
* a line-anchored regex that tolerates trailing whitespace and either
|
|
210
|
+
* line ending. The previous literal-`indexOf` match silently fell
|
|
211
|
+
* through on `## Architecture \n` (trailing space) or `## Architecture\r\n`.
|
|
212
|
+
* - Final fallback is append-before-Notable-Changes-or-EOF, identical
|
|
213
|
+
* to the original contract.
|
|
214
|
+
*/
|
|
215
|
+
export declare function mergeArchitectureSection(current: string, markdown: string): string;
|
|
192
216
|
/**
|
|
193
217
|
* Re-copy the repository's README.* into `git/<slug>/README.md`,
|
|
194
218
|
* snapshotting the previous mirror to `md_file_snapshots`. Used by both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-management-docs.d.ts","sourceRoot":"","sources":["../../src/core/repository-management-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAW3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAmB1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uCAAuC,QAAiB,CAAC;AAEtE,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAA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