@poncho-ai/harness 0.59.11 → 0.59.13
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +26 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +32 -22
- package/package.json +1 -1
- package/src/default-agent.ts +11 -1
- package/src/memory.ts +36 -22
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.59.
|
|
2
|
+
> @poncho-ai/harness@0.59.13 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
|
|
3
3
|
> node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[embed-docs] Generated poncho-docs.ts with 4 topics
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[32mESM[39m [1mdist/isolate-F2PPSUL6.js [22m[32m53.82 KB[39m
|
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m561.36 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 214ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m102.
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 8568ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m102.50 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.59.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bf77523`](https://github.com/cesr/poncho-ai/commit/bf775237af883a53ee90f0a620434a1929ac82ea) Thanks [@cesr](https://github.com/cesr)! - `memory_main_edit` now treats an empty `old_str` as append: `new_str` is
|
|
8
|
+
appended to the end of memory (separated by a blank line when memory is
|
|
9
|
+
non-empty). This also handles the first-ever write into empty memory, so
|
|
10
|
+
`memory_main_edit` alone can bootstrap, add new facts, and edit existing
|
|
11
|
+
text — consumers that want to drop `memory_main_write` from the tool
|
|
12
|
+
surface no longer lose the ability to seed empty memory.
|
|
13
|
+
|
|
14
|
+
Both `memory_main_edit` and `memory_main_write` now return a minimal
|
|
15
|
+
`{ ok: true, bytes }` result instead of echoing the entire memory
|
|
16
|
+
document back as the tool result, which kept re-injecting the whole
|
|
17
|
+
document into the conversation on every targeted edit.
|
|
18
|
+
|
|
19
|
+
## 0.59.12
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`4dc94a7`](https://github.com/cesr/poncho-ai/commit/4dc94a7d7d1d411baa9ca4ac1e98053d6d2e66c3) Thanks [@cesr](https://github.com/cesr)! - `defaultAgentDefinition()` accepts an optional `tagline` to override the
|
|
24
|
+
opening line's descriptor ("You are **{name}**, {tagline}."). Default is
|
|
25
|
+
unchanged ("a helpful assistant built with Poncho"). Lets SDK consumers
|
|
26
|
+
shipping a differently-branded product keep the framework name out of the
|
|
27
|
+
agent's system prompt.
|
|
28
|
+
|
|
3
29
|
## 0.59.11
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -853,9 +853,18 @@ interface DefaultAgentDefinitionOptions {
|
|
|
853
853
|
maxSteps?: number;
|
|
854
854
|
/** Hard timeout in seconds. Default: 300. */
|
|
855
855
|
timeout?: number;
|
|
856
|
+
/**
|
|
857
|
+
* The descriptor that follows the name in the opening line
|
|
858
|
+
* ("You are **{name}**, {tagline}."). Default:
|
|
859
|
+
* "a helpful assistant built with Poncho". SDK consumers shipping a
|
|
860
|
+
* differently-branded product can override this so the framework name
|
|
861
|
+
* does not leak into the agent's system prompt.
|
|
862
|
+
*/
|
|
863
|
+
tagline?: string;
|
|
856
864
|
}
|
|
857
865
|
declare const DEFAULT_AGENT_NAME = "agent";
|
|
858
866
|
declare const DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
867
|
+
declare const DEFAULT_TAGLINE = "a helpful assistant built with Poncho";
|
|
859
868
|
declare const DEFAULT_MODEL_PROVIDER: "anthropic";
|
|
860
869
|
declare const DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
861
870
|
declare const DEFAULT_TEMPERATURE = 0.2;
|
|
@@ -2383,4 +2392,4 @@ type NewEntryNoId = NewConversationEntry extends infer T ? T extends NewConversa
|
|
|
2383
2392
|
*/
|
|
2384
2393
|
declare const appendEntriesSafe: (store: ConversationStore, conversation: Pick<Conversation, "conversationId" | "ownerId" | "tenantId">, entries: NewEntryNoId[], log: Logger) => Promise<ConversationEntry[]>;
|
|
2385
2394
|
|
|
2386
|
-
export { type ActiveConversationRun, type ActiveSubagentRun, type AgentFrontmatter, AgentHarness, type AgentIdentity, type AgentLimitsConfig, type AgentModelConfig, AgentOrchestrator, type ApprovalEventItem, type ArchivedToolResult$1 as ArchivedToolResult, type BashConfig, BashEnvironmentManager, type BashExecutionLimits, type BuiltInToolToggles, CALLBACK_LOCK_STALE_MS, type CallbackStartedEntry, type CompactMessagesOptions, type CompactResult, type CompactionConfig, type ContinuationHooks, type Conversation, type ConversationCreateInit, type ConversationEntry, type ConversationState, type ConversationStatusSnapshot, type ConversationStore, type ConversationSummary, type CreateSkillToolsOptions, type CronJobConfig, DEFAULT_AGENT_DESCRIPTION, DEFAULT_AGENT_NAME, DEFAULT_MAX_STEPS, DEFAULT_MODEL_NAME, DEFAULT_MODEL_PROVIDER, DEFAULT_TEMPERATURE, DEFAULT_TIMEOUT, type DefaultAgentDefinitionOptions, type EventSink, type ExecuteTurnResult, type HarnessOptions, type HarnessRunOutput, type HistorySource, InMemoryConversationStore, InMemoryEngine, InMemoryStateStore, type IsolateBinding, type IsolateConfig, LocalMcpBridge, LocalUploadStore, MAX_CONCURRENT_SUBAGENTS, MAX_CONTINUATION_COUNT, MAX_SUBAGENT_CALLBACK_COUNT, MAX_SUBAGENT_NESTING, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type MessagingChannelConfig, type ModelProviderFactory, type MountProvider, type NetworkConfig, type NewConversationEntry, OPENAI_CODEX_CLIENT_ID, type OpenAICodexAuthConfig, type OpenAICodexDeviceAuthRequest, type OpenAICodexSession, type OrchestratorHooks, type OrchestratorOptions, type OtlpConfig, type OtlpOption, PONCHO_UPLOAD_SCHEME, type ParsedAgent, type PendingSubagentApproval, type PendingSubagentResult, type PendingToolCall, type PonchoConfig, PonchoFsAdapter, PostgresEngine, type ProviderConfig, type Recurrence, type RecurrenceType, type Reminder, type ReminderCreateInput, type ReminderStatus, type ReminderStore, type RemoteMcpServerConfig, type RunConversationTurnOpts, type RunConversationTurnResult, type RunOutcome, type RunRequest, type RuntimeRenderContext, S3UploadStore, STALE_SUBAGENT_THRESHOLD_MS, STORAGE_SCHEMA_VERSION, type SecretsStore, type SkillContextEntry, type SkillMetadata, type SkillSource, SqliteEngine, type StateConfig, type StateProviderName, type StateStore, type StorageConfig, type StorageEngine, type StorageFactoryOptions, type StorageProvider, type StoredApproval, type SubagentManager, type SubagentResult, type SubagentResultEntry, type SubagentSpawnResult, type SubagentSummary, type SubagentTranscript, type SubagentTranscriptMode, TOOL_RESULT_ARCHIVE_PARAM, type TelemetryConfig, TelemetryEmitter, type TenantTokenPayload, type ToolAccess, type ToolCall, ToolDispatcher, type ToolExecutionResult, type TurnDraftState, type TurnResultMetadata, type TurnSection, type UploadStore, type UploadsConfig, VFS_SCHEME, VercelBlobUploadStore, type VfsDirEntry, type VfsStat, type VirtualMount, abnormalEndResponse, appendEntriesSafe, applyTurnMetadata, buildAgentDirectoryName, buildApprovalCheckpoints, buildAssistantMetadata, buildSkillContextWindow, buildToolCompletedText, cloneSections, compactMessages, completeOpenAICodexDeviceAuth, computeNextOccurrence, createBashTool, createConversationStore, createConversationStoreFromEngine, createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createEditTool, createMemoryStore, createMemoryStoreFromEngine, createMemoryTools, createModelProvider, createReminderStore, createReminderStoreFromEngine, createReminderTools, createSearchTools, createSecretsStore, createSkillTools, createStateStore, createStorageEngine, createSubagentTools, createTodoStoreFromEngine, createTurnDraftState, createUploadStore, createWriteTool, decodeFileInputData, defaultAgentDefinition, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPendingSubagentResults, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, lastAssistantText, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadSkillMetadataFromDirs, loadVfsSkillMetadata, mergeSkills, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, normalizeToolAccess, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, realResponseText, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };
|
|
2395
|
+
export { type ActiveConversationRun, type ActiveSubagentRun, type AgentFrontmatter, AgentHarness, type AgentIdentity, type AgentLimitsConfig, type AgentModelConfig, AgentOrchestrator, type ApprovalEventItem, type ArchivedToolResult$1 as ArchivedToolResult, type BashConfig, BashEnvironmentManager, type BashExecutionLimits, type BuiltInToolToggles, CALLBACK_LOCK_STALE_MS, type CallbackStartedEntry, type CompactMessagesOptions, type CompactResult, type CompactionConfig, type ContinuationHooks, type Conversation, type ConversationCreateInit, type ConversationEntry, type ConversationState, type ConversationStatusSnapshot, type ConversationStore, type ConversationSummary, type CreateSkillToolsOptions, type CronJobConfig, DEFAULT_AGENT_DESCRIPTION, DEFAULT_AGENT_NAME, DEFAULT_MAX_STEPS, DEFAULT_MODEL_NAME, DEFAULT_MODEL_PROVIDER, DEFAULT_TAGLINE, DEFAULT_TEMPERATURE, DEFAULT_TIMEOUT, type DefaultAgentDefinitionOptions, type EventSink, type ExecuteTurnResult, type HarnessOptions, type HarnessRunOutput, type HistorySource, InMemoryConversationStore, InMemoryEngine, InMemoryStateStore, type IsolateBinding, type IsolateConfig, LocalMcpBridge, LocalUploadStore, MAX_CONCURRENT_SUBAGENTS, MAX_CONTINUATION_COUNT, MAX_SUBAGENT_CALLBACK_COUNT, MAX_SUBAGENT_NESTING, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type MessagingChannelConfig, type ModelProviderFactory, type MountProvider, type NetworkConfig, type NewConversationEntry, OPENAI_CODEX_CLIENT_ID, type OpenAICodexAuthConfig, type OpenAICodexDeviceAuthRequest, type OpenAICodexSession, type OrchestratorHooks, type OrchestratorOptions, type OtlpConfig, type OtlpOption, PONCHO_UPLOAD_SCHEME, type ParsedAgent, type PendingSubagentApproval, type PendingSubagentResult, type PendingToolCall, type PonchoConfig, PonchoFsAdapter, PostgresEngine, type ProviderConfig, type Recurrence, type RecurrenceType, type Reminder, type ReminderCreateInput, type ReminderStatus, type ReminderStore, type RemoteMcpServerConfig, type RunConversationTurnOpts, type RunConversationTurnResult, type RunOutcome, type RunRequest, type RuntimeRenderContext, S3UploadStore, STALE_SUBAGENT_THRESHOLD_MS, STORAGE_SCHEMA_VERSION, type SecretsStore, type SkillContextEntry, type SkillMetadata, type SkillSource, SqliteEngine, type StateConfig, type StateProviderName, type StateStore, type StorageConfig, type StorageEngine, type StorageFactoryOptions, type StorageProvider, type StoredApproval, type SubagentManager, type SubagentResult, type SubagentResultEntry, type SubagentSpawnResult, type SubagentSummary, type SubagentTranscript, type SubagentTranscriptMode, TOOL_RESULT_ARCHIVE_PARAM, type TelemetryConfig, TelemetryEmitter, type TenantTokenPayload, type ToolAccess, type ToolCall, ToolDispatcher, type ToolExecutionResult, type TurnDraftState, type TurnResultMetadata, type TurnSection, type UploadStore, type UploadsConfig, VFS_SCHEME, VercelBlobUploadStore, type VfsDirEntry, type VfsStat, type VirtualMount, abnormalEndResponse, appendEntriesSafe, applyTurnMetadata, buildAgentDirectoryName, buildApprovalCheckpoints, buildAssistantMetadata, buildSkillContextWindow, buildToolCompletedText, cloneSections, compactMessages, completeOpenAICodexDeviceAuth, computeNextOccurrence, createBashTool, createConversationStore, createConversationStoreFromEngine, createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createEditTool, createMemoryStore, createMemoryStoreFromEngine, createMemoryTools, createModelProvider, createReminderStore, createReminderStoreFromEngine, createReminderTools, createSearchTools, createSecretsStore, createSkillTools, createStateStore, createStorageEngine, createSubagentTools, createTodoStoreFromEngine, createTurnDraftState, createUploadStore, createWriteTool, decodeFileInputData, defaultAgentDefinition, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPendingSubagentResults, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, lastAssistantText, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadSkillMetadataFromDirs, loadVfsSkillMetadata, mergeSkills, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, normalizeToolAccess, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, realResponseText, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };
|
package/dist/index.js
CHANGED
|
@@ -670,6 +670,7 @@ var loadPonchoConfig = async (workingDir) => {
|
|
|
670
670
|
import { randomBytes } from "crypto";
|
|
671
671
|
var DEFAULT_AGENT_NAME = "agent";
|
|
672
672
|
var DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
673
|
+
var DEFAULT_TAGLINE = "a helpful assistant built with Poncho";
|
|
673
674
|
var DEFAULT_MODEL_PROVIDER = "anthropic";
|
|
674
675
|
var DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
675
676
|
var DEFAULT_TEMPERATURE = 0.2;
|
|
@@ -685,6 +686,7 @@ var defaultAgentDefinition = (opts = {}) => {
|
|
|
685
686
|
temperature: ${opts.temperature}` : "";
|
|
686
687
|
const maxSteps = opts.maxSteps ?? DEFAULT_MAX_STEPS;
|
|
687
688
|
const timeout = opts.timeout ?? DEFAULT_TIMEOUT;
|
|
689
|
+
const tagline = opts.tagline ?? DEFAULT_TAGLINE;
|
|
688
690
|
return `---
|
|
689
691
|
name: ${name}
|
|
690
692
|
id: ${id}
|
|
@@ -699,7 +701,7 @@ limits:
|
|
|
699
701
|
|
|
700
702
|
# {{name}}
|
|
701
703
|
|
|
702
|
-
You are **{{name}}**,
|
|
704
|
+
You are **{{name}}**, ${tagline}.
|
|
703
705
|
|
|
704
706
|
Working directory: {{runtime.workingDir}}
|
|
705
707
|
Environment: {{runtime.environment}}
|
|
@@ -1640,7 +1642,7 @@ When \`memory.enabled\` is true in \`poncho.config.js\`, the harness enables a s
|
|
|
1640
1642
|
|
|
1641
1643
|
- A single persistent main memory document is loaded at run start and interpolated into the system prompt under \`## Persistent Memory\`.
|
|
1642
1644
|
- \`memory_main_write\` overwrites the entire memory document (for initial writes or full rewrites).
|
|
1643
|
-
- \`memory_main_edit\` performs targeted string-replacement edits on memory (find \`old_str\`, replace with \`new_str\`), mirroring \`edit_file\` semantics. The tool description instructs the model to proactively evaluate each turn whether durable memory should be updated.
|
|
1645
|
+
- \`memory_main_edit\` performs targeted string-replacement edits on memory (find \`old_str\`, replace with \`new_str\`), mirroring \`edit_file\` semantics. An empty \`old_str\` appends \`new_str\` to the end of memory, which also handles the first-ever write into empty memory. The tool description instructs the model to proactively evaluate each turn whether durable memory should be updated.
|
|
1644
1646
|
- \`conversation_recall\` can search, browse, and fetch past conversations. It supports keyword search (scoring by relevance), date-range filtering (\`after\`/\`before\`), and fetching a specific conversation's full message history by ID.
|
|
1645
1647
|
|
|
1646
1648
|
\`\`\`javascript
|
|
@@ -5968,22 +5970,22 @@ var createMemoryTools = (store, options) => {
|
|
|
5968
5970
|
throw new Error("content is required");
|
|
5969
5971
|
}
|
|
5970
5972
|
const memory = await resolveStore(context).updateMainMemory({ content });
|
|
5971
|
-
return { ok: true, memory };
|
|
5973
|
+
return { ok: true, bytes: memory.content.length };
|
|
5972
5974
|
}
|
|
5973
5975
|
}),
|
|
5974
5976
|
defineTool6({
|
|
5975
5977
|
name: "memory_main_edit",
|
|
5976
|
-
description: "Edit persistent main memory
|
|
5978
|
+
description: "Edit persistent main memory. With a non-empty old_str, replace that exact string (which must match exactly one location) with new_str; use an empty new_str to delete the matched content. With an empty old_str, append new_str to the end of memory \u2014 use this to add a brand-new fact or to write the first fact when memory is still empty. Proactively evaluate every turn whether memory should be updated.",
|
|
5977
5979
|
inputSchema: {
|
|
5978
5980
|
type: "object",
|
|
5979
5981
|
properties: {
|
|
5980
5982
|
old_str: {
|
|
5981
5983
|
type: "string",
|
|
5982
|
-
description: "The exact text to find and replace (must be unique in memory). Include surrounding context if needed to ensure uniqueness."
|
|
5984
|
+
description: "The exact text to find and replace (must be unique in memory). Include surrounding context if needed to ensure uniqueness. Leave empty to append new_str to the end of memory instead."
|
|
5983
5985
|
},
|
|
5984
5986
|
new_str: {
|
|
5985
5987
|
type: "string",
|
|
5986
|
-
description: "The replacement text (use empty string to delete the matched content)"
|
|
5988
|
+
description: "The replacement text (use empty string to delete the matched content), or the text to append when old_str is empty."
|
|
5987
5989
|
}
|
|
5988
5990
|
},
|
|
5989
5991
|
required: ["old_str", "new_str"],
|
|
@@ -5992,26 +5994,33 @@ var createMemoryTools = (store, options) => {
|
|
|
5992
5994
|
handler: async (input, context) => {
|
|
5993
5995
|
const oldStr = typeof input.old_str === "string" ? input.old_str : "";
|
|
5994
5996
|
const newStr = typeof input.new_str === "string" ? input.new_str : "";
|
|
5995
|
-
if (!oldStr) {
|
|
5996
|
-
throw new Error("old_str must not be empty.");
|
|
5997
|
-
}
|
|
5998
5997
|
const current = await resolveStore(context).getMainMemory();
|
|
5999
5998
|
const content = current.content;
|
|
6000
|
-
|
|
6001
|
-
if (
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
)
|
|
5999
|
+
let newContent;
|
|
6000
|
+
if (!oldStr) {
|
|
6001
|
+
if (!newStr) {
|
|
6002
|
+
throw new Error("new_str must not be empty when appending (old_str is empty).");
|
|
6003
|
+
}
|
|
6004
|
+
newContent = content ? `${content.replace(/\s+$/, "")}
|
|
6005
|
+
|
|
6006
|
+
${newStr}` : newStr;
|
|
6007
|
+
} else {
|
|
6008
|
+
const first = content.indexOf(oldStr);
|
|
6009
|
+
if (first === -1) {
|
|
6010
|
+
throw new Error(
|
|
6011
|
+
"old_str not found in memory. Make sure it matches exactly, including whitespace and line breaks."
|
|
6012
|
+
);
|
|
6013
|
+
}
|
|
6014
|
+
const last = content.lastIndexOf(oldStr);
|
|
6015
|
+
if (first !== last) {
|
|
6016
|
+
throw new Error(
|
|
6017
|
+
"old_str appears multiple times in memory. Please provide more context to ensure a unique match."
|
|
6018
|
+
);
|
|
6019
|
+
}
|
|
6020
|
+
newContent = content.slice(0, first) + newStr + content.slice(first + oldStr.length);
|
|
6011
6021
|
}
|
|
6012
|
-
const newContent = content.slice(0, first) + newStr + content.slice(first + oldStr.length);
|
|
6013
6022
|
const memory = await resolveStore(context).updateMainMemory({ content: newContent });
|
|
6014
|
-
return { ok: true, memory };
|
|
6023
|
+
return { ok: true, bytes: memory.content.length };
|
|
6015
6024
|
}
|
|
6016
6025
|
}),
|
|
6017
6026
|
defineTool6({
|
|
@@ -14656,6 +14665,7 @@ export {
|
|
|
14656
14665
|
DEFAULT_MAX_STEPS,
|
|
14657
14666
|
DEFAULT_MODEL_NAME,
|
|
14658
14667
|
DEFAULT_MODEL_PROVIDER,
|
|
14668
|
+
DEFAULT_TAGLINE,
|
|
14659
14669
|
DEFAULT_TEMPERATURE,
|
|
14660
14670
|
DEFAULT_TIMEOUT,
|
|
14661
14671
|
InMemoryConversationStore,
|
package/package.json
CHANGED
package/src/default-agent.ts
CHANGED
|
@@ -37,10 +37,19 @@ export interface DefaultAgentDefinitionOptions {
|
|
|
37
37
|
maxSteps?: number;
|
|
38
38
|
/** Hard timeout in seconds. Default: 300. */
|
|
39
39
|
timeout?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The descriptor that follows the name in the opening line
|
|
42
|
+
* ("You are **{name}**, {tagline}."). Default:
|
|
43
|
+
* "a helpful assistant built with Poncho". SDK consumers shipping a
|
|
44
|
+
* differently-branded product can override this so the framework name
|
|
45
|
+
* does not leak into the agent's system prompt.
|
|
46
|
+
*/
|
|
47
|
+
tagline?: string;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
export const DEFAULT_AGENT_NAME = "agent";
|
|
43
51
|
export const DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
52
|
+
export const DEFAULT_TAGLINE = "a helpful assistant built with Poncho";
|
|
44
53
|
export const DEFAULT_MODEL_PROVIDER = "anthropic" as const;
|
|
45
54
|
export const DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
46
55
|
export const DEFAULT_TEMPERATURE = 0.2;
|
|
@@ -66,6 +75,7 @@ export const defaultAgentDefinition = (
|
|
|
66
75
|
opts.temperature !== undefined ? `\n temperature: ${opts.temperature}` : "";
|
|
67
76
|
const maxSteps = opts.maxSteps ?? DEFAULT_MAX_STEPS;
|
|
68
77
|
const timeout = opts.timeout ?? DEFAULT_TIMEOUT;
|
|
78
|
+
const tagline = opts.tagline ?? DEFAULT_TAGLINE;
|
|
69
79
|
|
|
70
80
|
return `---
|
|
71
81
|
name: ${name}
|
|
@@ -81,7 +91,7 @@ limits:
|
|
|
81
91
|
|
|
82
92
|
# {{name}}
|
|
83
93
|
|
|
84
|
-
You are **{{name}}**,
|
|
94
|
+
You are **{{name}}**, ${tagline}.
|
|
85
95
|
|
|
86
96
|
Working directory: {{runtime.workingDir}}
|
|
87
97
|
Environment: {{runtime.environment}}
|
package/src/memory.ts
CHANGED
|
@@ -192,15 +192,17 @@ export const createMemoryTools = (
|
|
|
192
192
|
throw new Error("content is required");
|
|
193
193
|
}
|
|
194
194
|
const memory = await resolveStore(context).updateMainMemory({ content });
|
|
195
|
-
return { ok: true, memory };
|
|
195
|
+
return { ok: true, bytes: memory.content.length };
|
|
196
196
|
},
|
|
197
197
|
}),
|
|
198
198
|
defineTool({
|
|
199
199
|
name: "memory_main_edit",
|
|
200
200
|
description:
|
|
201
|
-
"Edit persistent main memory
|
|
202
|
-
"
|
|
203
|
-
"
|
|
201
|
+
"Edit persistent main memory. With a non-empty old_str, replace that exact " +
|
|
202
|
+
"string (which must match exactly one location) with new_str; use an empty " +
|
|
203
|
+
"new_str to delete the matched content. With an empty old_str, append new_str " +
|
|
204
|
+
"to the end of memory — use this to add a brand-new fact or to write the first " +
|
|
205
|
+
"fact when memory is still empty. " +
|
|
204
206
|
"Proactively evaluate every turn whether memory should be updated.",
|
|
205
207
|
inputSchema: {
|
|
206
208
|
type: "object",
|
|
@@ -209,11 +211,14 @@ export const createMemoryTools = (
|
|
|
209
211
|
type: "string",
|
|
210
212
|
description:
|
|
211
213
|
"The exact text to find and replace (must be unique in memory). " +
|
|
212
|
-
"Include surrounding context if needed to ensure uniqueness."
|
|
214
|
+
"Include surrounding context if needed to ensure uniqueness. " +
|
|
215
|
+
"Leave empty to append new_str to the end of memory instead.",
|
|
213
216
|
},
|
|
214
217
|
new_str: {
|
|
215
218
|
type: "string",
|
|
216
|
-
description:
|
|
219
|
+
description:
|
|
220
|
+
"The replacement text (use empty string to delete the matched content), " +
|
|
221
|
+
"or the text to append when old_str is empty.",
|
|
217
222
|
},
|
|
218
223
|
},
|
|
219
224
|
required: ["old_str", "new_str"],
|
|
@@ -222,26 +227,35 @@ export const createMemoryTools = (
|
|
|
222
227
|
handler: async (input, context) => {
|
|
223
228
|
const oldStr = typeof input.old_str === "string" ? input.old_str : "";
|
|
224
229
|
const newStr = typeof input.new_str === "string" ? input.new_str : "";
|
|
225
|
-
if (!oldStr) {
|
|
226
|
-
throw new Error("old_str must not be empty.");
|
|
227
|
-
}
|
|
228
230
|
const current = await resolveStore(context).getMainMemory();
|
|
229
231
|
const content = current.content;
|
|
230
|
-
|
|
231
|
-
if (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
232
|
+
let newContent: string;
|
|
233
|
+
if (!oldStr) {
|
|
234
|
+
// Append mode: add new_str to the end. Handles the first-ever write
|
|
235
|
+
// (empty memory) and adding new facts without needing existing text
|
|
236
|
+
// to match. Separate from prior content with a blank line when both
|
|
237
|
+
// sides are non-empty.
|
|
238
|
+
if (!newStr) {
|
|
239
|
+
throw new Error("new_str must not be empty when appending (old_str is empty).");
|
|
240
|
+
}
|
|
241
|
+
newContent = content ? `${content.replace(/\s+$/, "")}\n\n${newStr}` : newStr;
|
|
242
|
+
} else {
|
|
243
|
+
const first = content.indexOf(oldStr);
|
|
244
|
+
if (first === -1) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"old_str not found in memory. Make sure it matches exactly, including whitespace and line breaks.",
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
const last = content.lastIndexOf(oldStr);
|
|
250
|
+
if (first !== last) {
|
|
251
|
+
throw new Error(
|
|
252
|
+
"old_str appears multiple times in memory. Please provide more context to ensure a unique match.",
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
newContent = content.slice(0, first) + newStr + content.slice(first + oldStr.length);
|
|
241
256
|
}
|
|
242
|
-
const newContent = content.slice(0, first) + newStr + content.slice(first + oldStr.length);
|
|
243
257
|
const memory = await resolveStore(context).updateMainMemory({ content: newContent });
|
|
244
|
-
return { ok: true, memory };
|
|
258
|
+
return { ok: true, bytes: memory.content.length };
|
|
245
259
|
},
|
|
246
260
|
}),
|
|
247
261
|
defineTool({
|