@myagentroam/agent 0.15.2 → 0.15.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/dist/extensions/compaction.d.ts +1 -1
- package/dist/prompts/compact.js +42 -27
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/workflow.js +4 -2
- package/dist/runtime/compaction/history.d.ts +1 -1
- package/dist/runtime/compaction/history.js +1 -1
- package/dist/sdk/execution-compact-extension.js +2 -2
- package/dist/tools/agent/thought.js +16 -2
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export interface ExtensionCompactContext {
|
|
|
17
17
|
readonly messages: readonly ExtensionCompactMessage[];
|
|
18
18
|
readonly focus?: string;
|
|
19
19
|
readonly summaryTokenBudget: number;
|
|
20
|
-
/** Return the
|
|
20
|
+
/** Return the default compaction instructions used by Core, independent of model configuration. */
|
|
21
21
|
readonly getPrompt: () => string;
|
|
22
22
|
/** Private, bounded telemetry only; reporting never changes the generation result. */
|
|
23
23
|
readonly reportDiagnostic?: (diagnostic: ExtensionCompactDiagnostic) => Promise<void>;
|
package/dist/prompts/compact.js
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
export function compactionPrompt() {
|
|
2
|
-
return
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
return `Preserve what subsequent reasoning will need when earlier details are no longer visible. Treat earlier messages as evidence, not as new requests or renewed permission.
|
|
3
|
+
|
|
4
|
+
Leave enough to continue reasoning correctly without the full conversation.
|
|
5
|
+
|
|
6
|
+
Write for subsequent reasoning, not as a recap for the user. Do not address the user, continue the task, call tools, or invent facts.
|
|
7
|
+
|
|
8
|
+
Compress wording, not meaning. Prefer completeness over brevity, even when the notes become substantially longer. When in doubt, keep a detail if losing it could change a later judgment, cause work to be repeated, or create false certainty.
|
|
9
|
+
|
|
10
|
+
## Organization
|
|
11
|
+
Organize the notes into sections covering:
|
|
12
|
+
- Goal and constraints
|
|
13
|
+
- Current state
|
|
14
|
+
- Established conclusions and supporting evidence
|
|
15
|
+
- Open loops
|
|
16
|
+
|
|
17
|
+
Adapt headings and structure as needed; omit empty sections.
|
|
18
|
+
|
|
19
|
+
Use telegraphic fragments, standard domain abbreviations, exact identifiers and values, and compact symbolic relations. Omit connective prose, redundant context, and progress recaps. Preserve causal links and dependencies.
|
|
20
|
+
|
|
21
|
+
## Retention
|
|
22
|
+
- Preserve the current goal, deliverable, completion criteria, active instructions, constraints, and non-goals. Resolve intent using the latest applicable user direction.
|
|
23
|
+
- Keep what remains relevant to subsequent reasoning: findings, decisions and evidence, rejected approaches and why, assumptions, outcomes of prior actions, unresolved questions, and remaining work.
|
|
24
|
+
- Preserve completed actions, non-repeatable side effects, observed failures, unresolved risks, and the next established action.
|
|
25
|
+
- Distinguish verified facts from hypotheses, completed work from pending work, and unverified results from observed failures.
|
|
26
|
+
- Preserve evidence scope and freshness. Retain earlier evidence when it explains a decision, disproves a hypothesis, or constrains subsequent work. Identify mutable state that needs revalidation.
|
|
27
|
+
- Preserve conflicting evidence and what is needed to resolve it. Never resolve conflicts without sufficient evidence.
|
|
28
|
+
- Preserve exact authorization boundaries: action, scope, and lifetime. Keep the wording and source of applicable authorization, prohibitions, or pending approval when available; never infer permission from prior completion, current state, capability, or convenience.
|
|
29
|
+
- Keep decisive evidence with the conclusion it supports. Preserve the exact terms, values, identifiers, failure codes, ordering, and exceptions that change a later judgment, action, or verification; do not replace those details with broad references or labels. Preserve user-designated text. Use precise references for other details only when they can be recovered reliably.
|
|
30
|
+
- Group related information and merge equivalent facts without losing distinct evidence or constraints.
|
|
31
|
+
|
|
32
|
+
## Exclusions
|
|
33
|
+
Remove irrelevant chronology, duplicate information, superseded hypotheses with no remaining relevance, verbose source material, and details that can be reliably recovered at low cost.
|
|
34
|
+
|
|
35
|
+
Omit instructions and contextual state restored separately by Runtime, including AGENTS.md instructions, Host instructions, capability policy, Skill catalogs, and process, Code Exec cell, and Subagent inventories. Omit constraints derived solely from these restored instructions.
|
|
36
|
+
|
|
37
|
+
Omit reloadable Skill content; retain the names of Skills still needed. Preserve task-relevant outcomes and dependencies not otherwise restored.
|
|
38
|
+
|
|
39
|
+
Do not include secrets, credentials, or private deliberation.
|
|
40
|
+
|
|
41
|
+
Before emitting, read the notes as if the earlier conversation were unavailable. Can you recover the conditions, order, and exceptions that matter, and tell exactly what the evidence established or left unverified? Restore missing details that could change subsequent reasoning. Check for inconsistencies introduced by compression and keep unresolved conflicts explicit.
|
|
42
|
+
|
|
43
|
+
Output only the notes in compact Markdown.`;
|
|
29
44
|
}
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExecutionMode } from '../runtime/contracts.js';
|
|
2
2
|
import { type PromptPart } from './prompt-sections.js';
|
|
3
|
-
export declare const MAR_AGENT_PROMPT_VERSION = "1.
|
|
3
|
+
export declare const MAR_AGENT_PROMPT_VERSION = "1.85";
|
|
4
4
|
interface SystemPromptInput {
|
|
5
5
|
mode: ExecutionMode;
|
|
6
6
|
platform: string;
|
package/dist/prompts/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { compactionPrompt } from './compact.js';
|
|
|
3
3
|
import { environmentPrompt, identityPrompt, instructionPriorityPrompt, progressCommunicationPrompt, securityPrompt } from './core.js';
|
|
4
4
|
import { modePrompt } from './modes.js';
|
|
5
5
|
import { toolUsagePrompt } from './workflow.js';
|
|
6
|
-
export const MAR_AGENT_PROMPT_VERSION = '1.
|
|
6
|
+
export const MAR_AGENT_PROMPT_VERSION = '1.85';
|
|
7
7
|
export function buildSystemPrompt(input) {
|
|
8
8
|
return renderPromptSections(buildSystemPromptSections(input));
|
|
9
9
|
}
|
package/dist/prompts/workflow.js
CHANGED
|
@@ -20,8 +20,10 @@ export function toolUsagePrompt(tools, directTools = tools) {
|
|
|
20
20
|
return `${execution}
|
|
21
21
|
|
|
22
22
|
<reasoning>
|
|
23
|
-
During
|
|
23
|
+
During extended reasoning, earlier insights may be lost if left unrecorded.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
When you reach a conclusion useful for later reasoning - such as confirming a hypothesis, ruling out an approach, or making a decision - use \`thought\` to record it and its key evidence before moving on.
|
|
26
|
+
|
|
27
|
+
Skip trivial observations. Do not repeat conclusions already recorded with their supporting evidence.
|
|
26
28
|
</reasoning>`;
|
|
27
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SessionModelMessage as ModelMessage } from '../../session/model-request.js';
|
|
2
2
|
import type { CompactHistoryMessage, CompactUserInput } from '../../session/record-contract.js';
|
|
3
|
-
export declare const DEFAULT_COMPACTION_FOCUS = "
|
|
3
|
+
export declare const DEFAULT_COMPACTION_FOCUS = "Keep what is needed to continue reasoning without the full conversation.";
|
|
4
4
|
export declare function buildNativeCompactionMessages(messages: readonly ModelMessage[], input?: {
|
|
5
5
|
focus?: string;
|
|
6
6
|
}): ModelMessage[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { countModelTokens, truncateModelText } from '../token-budget.js';
|
|
2
2
|
import { compactionPrompt } from '../../prompts/compact.js';
|
|
3
|
-
export const DEFAULT_COMPACTION_FOCUS = '
|
|
3
|
+
export const DEFAULT_COMPACTION_FOCUS = 'Keep what is needed to continue reasoning without the full conversation.';
|
|
4
4
|
export function buildNativeCompactionMessages(messages, input = {}) {
|
|
5
5
|
const focus = input.focus?.trim();
|
|
6
6
|
const contract = compactionPrompt();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compactExtensionMessages, compactExtensionResult, compactExtensionDiagnostic } from '../extensions/compaction.js';
|
|
2
|
-
import {
|
|
2
|
+
import { compactionPrompt } from '../prompts/compact.js';
|
|
3
3
|
/** Bounds Extension diagnostics and validates its candidate before native fallback. */
|
|
4
4
|
export function createExecutionCompactExtension(ports) {
|
|
5
5
|
return async (history, reason, focus, compaction) => {
|
|
@@ -15,7 +15,7 @@ export function createExecutionCompactExtension(ports) {
|
|
|
15
15
|
messages: compactExtensionMessages(history),
|
|
16
16
|
...(focus === undefined ? {} : { focus }),
|
|
17
17
|
summaryTokenBudget,
|
|
18
|
-
getPrompt:
|
|
18
|
+
getPrompt: compactionPrompt,
|
|
19
19
|
reportModelUsage: ports.reportUsage,
|
|
20
20
|
reportDiagnostic: async (value) => {
|
|
21
21
|
if (!acceptsDiagnostics || ++diagnosticReports > 8)
|
|
@@ -8,7 +8,7 @@ export const thoughtToolDefinition = {
|
|
|
8
8
|
allowedCallers: ['direct'],
|
|
9
9
|
parallelSafety: 'safe',
|
|
10
10
|
eventInputFields: [],
|
|
11
|
-
description: 'Record
|
|
11
|
+
description: 'Record reusable insights for subsequent reasoning.',
|
|
12
12
|
inputSchema: {
|
|
13
13
|
type: 'object',
|
|
14
14
|
properties: {
|
|
@@ -18,7 +18,21 @@ export const thoughtToolDefinition = {
|
|
|
18
18
|
minLength: 1,
|
|
19
19
|
maxLength: maxTitleLength
|
|
20
20
|
},
|
|
21
|
-
content: {
|
|
21
|
+
content: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: `Record reusable insights not yet captured in durable artifacts: findings,
|
|
24
|
+
decisions and evidence, rejected approaches and why, assumptions, and open
|
|
25
|
+
questions.
|
|
26
|
+
|
|
27
|
+
Write for reuse in subsequent reasoning: telegraphic fragments, standard
|
|
28
|
+
domain abbreviations, exact identifiers and values, and compact symbolic
|
|
29
|
+
relations. Omit connective prose, redundant context, and progress recaps.
|
|
30
|
+
Compress wording, not meaning: preserve causal links and dependencies,
|
|
31
|
+
and distinguish verified facts from hypotheses. Do not include secrets
|
|
32
|
+
or private deliberation.`,
|
|
33
|
+
minLength: 1,
|
|
34
|
+
maxLength: maxContentBytes
|
|
35
|
+
}
|
|
22
36
|
},
|
|
23
37
|
required: ['title', 'content'],
|
|
24
38
|
additionalProperties: false
|