@x-otto/interchange 0.1.0-alpha.13 → 0.1.0-alpha.14
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/context-fragment.d.ts +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* CODE-STYLE.md §6b)。片段内容被截断只损失尾部信息,不改变已注入部分的可读性。
|
|
14
14
|
*/
|
|
15
15
|
/** system prompt 注入片段的类型化 id(与 SYSTEM_PROMPT_SECTIONS 的字段一一对应)。 */
|
|
16
|
-
type ContextFragmentId = 'toolGuidance' | 'skillLoopGuidance' | 'environment' | 'agentKnowledge' | 'memoryIndex' | 'skillCatalog' | 'lesson' | 'lessonRelevantHints' | 'memoryDelta' | 'todoReminder' | 'docSyncReminder' | 'internalize' | 'pluginFailures';
|
|
16
|
+
type ContextFragmentId = 'toolGuidance' | 'skillLoopGuidance' | 'environment' | 'environmentVolatile' | 'agentKnowledge' | 'memoryIndex' | 'skillCatalog' | 'lesson' | 'lessonRelevantHints' | 'memoryDelta' | 'todoReminder' | 'docSyncReminder' | 'internalize' | 'pluginFailures';
|
|
17
17
|
/** 有界上下文片段:id + 内容。预算声明在 SYSTEM_PROMPT_SECTIONS(runtime 包)。 */
|
|
18
18
|
interface ContextFragment {
|
|
19
19
|
id: ContextFragmentId;
|
package/dist/index.d.ts
CHANGED
|
@@ -316,7 +316,19 @@ declare const SYSTEM_PROMPT_SECTIONS: {
|
|
|
316
316
|
readonly name: "runtime:environment";
|
|
317
317
|
readonly priority: 25;
|
|
318
318
|
readonly lane: "stable";
|
|
319
|
-
readonly budgetBytes:
|
|
319
|
+
readonly budgetBytes: 2000;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* date/gitBranch/gitStatus——真正逐轮可能变化的环境事实,volatile lane(priority 26,
|
|
323
|
+
* 紧跟 stable environment 之后):每轮重算、落在 prompt cache 断点之后,不冻结、
|
|
324
|
+
* 不击穿 stable 前缀。走 `defineHook` 直接推 `output.systemTail`(同 memory-delta/
|
|
325
|
+
* todo-reminder 既有模式),不经 `definePromptSection`(该便捷层只服务 stable lane)。
|
|
326
|
+
*/
|
|
327
|
+
readonly environmentVolatile: {
|
|
328
|
+
readonly name: "runtime:environment-volatile";
|
|
329
|
+
readonly priority: 26;
|
|
330
|
+
readonly lane: "volatile";
|
|
331
|
+
readonly budgetBytes: 4000;
|
|
320
332
|
};
|
|
321
333
|
readonly agentKnowledge: {
|
|
322
334
|
readonly name: "agent-knowledge-injection";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CONVERSATION_SUMMARY_PREFIX as e,getToolCallsByAssistantMessage as t,hasToolCalls as n}from"./message.js";import{boundFragment as r,contextFragmentBytes as i}from"./context-fragment.js";import{normalizeImageData as a,toAnthropicImageMime as o}from"./image.js";import{adjustDismissedSigil as s,applySigilCompletion as c,applySigilReplacement as l,evaluateSigilTrigger as u,extractSigilPrefix as d,isSigilDismissed as f,sigilOf as p}from"./input.js";function m(e){return!Array.isArray(e.input)||e.input.length===0?{state:`unknown`}:e.input.includes(`image`)?{state:`supported`,value:!0}:{state:`unsupported`}}function h(e){return m(e).state===`supported`}function g(e){return{vision:m(e)}}const _={toolGuidance:{name:`tool-guidance-injection`,priority:20,lane:`stable`,budgetBytes:2e4},skillLoopGuidance:{name:`skill-loop-guidance-injection`,priority:21,lane:`stable`,budgetBytes:2e3},environment:{name:`runtime:environment`,priority:25,lane:`stable`,budgetBytes:
|
|
1
|
+
import{CONVERSATION_SUMMARY_PREFIX as e,getToolCallsByAssistantMessage as t,hasToolCalls as n}from"./message.js";import{boundFragment as r,contextFragmentBytes as i}from"./context-fragment.js";import{normalizeImageData as a,toAnthropicImageMime as o}from"./image.js";import{adjustDismissedSigil as s,applySigilCompletion as c,applySigilReplacement as l,evaluateSigilTrigger as u,extractSigilPrefix as d,isSigilDismissed as f,sigilOf as p}from"./input.js";function m(e){return!Array.isArray(e.input)||e.input.length===0?{state:`unknown`}:e.input.includes(`image`)?{state:`supported`,value:!0}:{state:`unsupported`}}function h(e){return m(e).state===`supported`}function g(e){return{vision:m(e)}}const _={toolGuidance:{name:`tool-guidance-injection`,priority:20,lane:`stable`,budgetBytes:2e4},skillLoopGuidance:{name:`skill-loop-guidance-injection`,priority:21,lane:`stable`,budgetBytes:2e3},environment:{name:`runtime:environment`,priority:25,lane:`stable`,budgetBytes:2e3},environmentVolatile:{name:`runtime:environment-volatile`,priority:26,lane:`volatile`,budgetBytes:4e3},agentKnowledge:{name:`agent-knowledge-injection`,priority:35,lane:`stable`,budgetBytes:28e3},skillCatalog:{name:`skill-catalog-injection`,priority:38,lane:`stable`,budgetBytes:12e3},lessonRelevantHints:{name:`lesson-relevant-hints`,priority:41,lane:`volatile`,budgetBytes:4e3},internalize:{name:`internalize-skill-injection`,priority:42,lane:`volatile`,budgetBytes:4e3},pluginFailures:{name:`plugin-failures-injection`,priority:55,lane:`volatile`,budgetBytes:4e3},memoryDelta:{name:`memory-delta-injection`,priority:60,lane:`volatile`,budgetBytes:8e3},todoReminder:{name:`todo-reminder-injection`,priority:62,lane:`volatile`,budgetBytes:4e3},docSyncReminder:{name:`doc-sync-reminder-injection`,priority:64,lane:`volatile`,budgetBytes:4e3}},v=Object.values(_),y=new Set;function b(e,t){let n=v.find(t=>t.name===e);return n?(Buffer.byteLength(t,`utf8`)>n.budgetBytes&&!y.has(e)&&(y.add(e),console.warn(`[system-prompt] section "${e}" truncated to ${n.budgetBytes} bytes (content ${Buffer.byteLength(t,`utf8`)} bytes) — check SYSTEM_PROMPT_SECTIONS budget vs content size`)),r({id:x(e),content:t},n.budgetBytes).content):t}function x(e){let t={"tool-guidance-injection":`toolGuidance`,"skill-loop-guidance-injection":`skillLoopGuidance`,"runtime:environment":`environment`,"runtime:environment-volatile":`environmentVolatile`,"agent-knowledge-injection":`agentKnowledge`,"runtime:memory-index":`memoryIndex`,"skill-catalog-injection":`skillCatalog`,"lesson-injection":`lesson`,"lesson-relevant-hints":`lessonRelevantHints`,"internalize-skill-injection":`internalize`,"plugin-failures-injection":`pluginFailures`,"memory-delta-injection":`memoryDelta`,"todo-reminder-injection":`todoReminder`,"doc-sync-reminder-injection":`docSyncReminder`}[e];if(t===void 0)throw Error(`applySectionBudget: unknown section name "${e}"`);return t}function S(e){return e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
2
2
|
`)}const C={"session.start":`durable`,"session.end":`durable`,"session.cleared":`durable`,"prompt.start":`durable`,"prompt.end":`durable`,"prompt.continued":`durable`,"turn.start":`durable`,"turn.end":`durable`,"tool.call.start":`durable`,"tool.call.end":`durable`,"messages.persist":`durable`,"compaction.start":`durable`,"compaction.end":`durable`,"memory.pruned":`durable`,error:`durable`,"stream.event":`live`,"streaming.start":`live`,"streaming.end":`live`,"agent.status":`live`,"steer.consumed":`live`,"run.paused":`live`,"run.resumed":`live`,"run.pause_requested":`live`,"run.pause_cancelled":`live`,"approval.required":`capability`,"approval.resolved":`capability`,"ask.user.required":`capability`,"ask.user.resolved":`capability`,"plan.approval.required":`capability`,"plan.approval.resolved":`capability`,"budget.notice":`capability`,"prompt.budget.notice":`capability`,"tool.call.mismatch.notice":`capability`,"image.degradation.notice":`capability`,"progress.stall.notice":`capability`,"compaction.reactive.notice":`capability`,"session.cost-budget-exceeded":`capability`,"session.crash-gap-detected":`capability`,"session.history-capped":`capability`,"session.write-lease-denied":`capability`,"session.write-lease-restored":`capability`};function w(e){return C[e]}export{e as CONVERSATION_SUMMARY_PREFIX,C as EVENT_DOMAIN,_ as SYSTEM_PROMPT_SECTIONS,v as SYSTEM_PROMPT_SECTION_ORDER,s as adjustDismissedSigil,b as applySectionBudget,c as applySigilCompletion,l as applySigilReplacement,r as boundFragment,g as collectModelCapabilityFacts,i as contextFragmentBytes,u as evaluateSigilTrigger,d as extractSigilPrefix,S as extractToolResultText,w as getEventDomain,t as getToolCallsByAssistantMessage,n as hasToolCalls,f as isSigilDismissed,m as modelImageCapability,h as modelSupportsImages,a as normalizeImageData,p as sigilOf,o as toAnthropicImageMime};
|