@poncho-ai/harness 0.59.10 → 0.59.12
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 +21 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +22 -7
- package/package.json +1 -1
- package/src/default-agent.ts +11 -1
- package/src/harness.ts +31 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.59.
|
|
2
|
+
> @poncho-ai/harness@0.59.12 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[32m560.73 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 254ms
|
|
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 8487ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m102.50 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.59.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4dc94a7`](https://github.com/cesr/poncho-ai/commit/4dc94a7d7d1d411baa9ca4ac1e98053d6d2e66c3) Thanks [@cesr](https://github.com/cesr)! - `defaultAgentDefinition()` accepts an optional `tagline` to override the
|
|
8
|
+
opening line's descriptor ("You are **{name}**, {tagline}."). Default is
|
|
9
|
+
unchanged ("a helpful assistant built with Poncho"). Lets SDK consumers
|
|
10
|
+
shipping a differently-branded product keep the framework name out of the
|
|
11
|
+
agent's system prompt.
|
|
12
|
+
|
|
13
|
+
## 0.59.11
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`7464ad0`](https://github.com/cesr/poncho-ai/commit/7464ad04448095b34c4b1cbd52da559cf6bd6024) Thanks [@cesr](https://github.com/cesr)! - The user's memory file gets its own 1-hour Anthropic cache breakpoint.
|
|
18
|
+
It previously rode the uncached dynamic system tail (with todos + time),
|
|
19
|
+
which re-wrote the memory block — typically the bulk of a new
|
|
20
|
+
conversation's one-time cache cost — on every cold prefix, despite memory
|
|
21
|
+
only changing on explicit writes. System prompt is now three tiers:
|
|
22
|
+
static (1h), memory (1h), volatile todos+time (uncached).
|
|
23
|
+
|
|
3
24
|
## 0.59.10
|
|
4
25
|
|
|
5
26
|
### 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}}
|
|
@@ -10720,11 +10722,11 @@ ${skillContextWindow}${browserContext}${fsContext}${isolateContext}` : `${agentP
|
|
|
10720
10722
|
const timeContext = `
|
|
10721
10723
|
|
|
10722
10724
|
Current UTC time (hour precision): ${hourlyTime}`;
|
|
10723
|
-
const dynamicPart = `${
|
|
10724
|
-
return { staticPart, dynamicPart };
|
|
10725
|
+
const dynamicPart = `${todoContext}${timeContext}`;
|
|
10726
|
+
return { staticPart, memoryPart: memoryContext, dynamicPart };
|
|
10725
10727
|
};
|
|
10726
|
-
let { staticPart: staticSystemPart, dynamicPart: dynamicSystemPart } = await buildSystemPromptParts();
|
|
10727
|
-
let systemPrompt = `${staticSystemPart}${dynamicSystemPart}`;
|
|
10728
|
+
let { staticPart: staticSystemPart, memoryPart: memorySystemPart, dynamicPart: dynamicSystemPart } = await buildSystemPromptParts();
|
|
10729
|
+
let systemPrompt = `${staticSystemPart}${memorySystemPart}${dynamicSystemPart}`;
|
|
10728
10730
|
let lastPromptFingerprint = `${this.agentFileFingerprint}
|
|
10729
10731
|
${this.skillFingerprint}`;
|
|
10730
10732
|
const pushEvent = (event) => {
|
|
@@ -11203,6 +11205,18 @@ ${textContent}` };
|
|
|
11203
11205
|
anthropic: { cacheControl: { type: "ephemeral", ttl: "1h" } }
|
|
11204
11206
|
}
|
|
11205
11207
|
},
|
|
11208
|
+
// Memory: per-user, conversation-independent, changes only on
|
|
11209
|
+
// an explicit memory write — its own 1h breakpoint means a
|
|
11210
|
+
// memory edit busts THIS block forward but a normal turn reads
|
|
11211
|
+
// it (plus everything before it) from cache. Breakpoint budget:
|
|
11212
|
+
// Anthropic allows 4; this is #2 of 3 (static, memory, tail).
|
|
11213
|
+
...memorySystemPart.length > 0 ? [{
|
|
11214
|
+
role: "system",
|
|
11215
|
+
content: memorySystemPart,
|
|
11216
|
+
providerOptions: {
|
|
11217
|
+
anthropic: { cacheControl: { type: "ephemeral", ttl: "1h" } }
|
|
11218
|
+
}
|
|
11219
|
+
}] : [],
|
|
11206
11220
|
...dynamicSystemPart.length > 0 ? [{ role: "system", content: dynamicSystemPart }] : [],
|
|
11207
11221
|
...cachedMessages
|
|
11208
11222
|
] : cachedMessages;
|
|
@@ -11844,8 +11858,8 @@ ${textContent}` };
|
|
|
11844
11858
|
const currentFingerprint = `${this.agentFileFingerprint}
|
|
11845
11859
|
${this.skillFingerprint}`;
|
|
11846
11860
|
if (currentFingerprint !== lastPromptFingerprint) {
|
|
11847
|
-
({ staticPart: staticSystemPart, dynamicPart: dynamicSystemPart } = await buildSystemPromptParts());
|
|
11848
|
-
systemPrompt = `${staticSystemPart}${dynamicSystemPart}`;
|
|
11861
|
+
({ staticPart: staticSystemPart, memoryPart: memorySystemPart, dynamicPart: dynamicSystemPart } = await buildSystemPromptParts());
|
|
11862
|
+
systemPrompt = `${staticSystemPart}${memorySystemPart}${dynamicSystemPart}`;
|
|
11849
11863
|
lastPromptFingerprint = currentFingerprint;
|
|
11850
11864
|
}
|
|
11851
11865
|
}
|
|
@@ -14644,6 +14658,7 @@ export {
|
|
|
14644
14658
|
DEFAULT_MAX_STEPS,
|
|
14645
14659
|
DEFAULT_MODEL_NAME,
|
|
14646
14660
|
DEFAULT_MODEL_PROVIDER,
|
|
14661
|
+
DEFAULT_TAGLINE,
|
|
14647
14662
|
DEFAULT_TEMPERATURE,
|
|
14648
14663
|
DEFAULT_TIMEOUT,
|
|
14649
14664
|
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/harness.ts
CHANGED
|
@@ -2331,13 +2331,17 @@ ${typeStubs}
|
|
|
2331
2331
|
Code is wrapped in an async IIFE — use \`return\` to return a value to the tool result.`;
|
|
2332
2332
|
}
|
|
2333
2333
|
|
|
2334
|
-
// Split the system prompt into
|
|
2335
|
-
//
|
|
2336
|
-
//
|
|
2337
|
-
//
|
|
2338
|
-
//
|
|
2339
|
-
//
|
|
2340
|
-
|
|
2334
|
+
// Split the system prompt into THREE cacheability tiers (see the
|
|
2335
|
+
// streamText site for the breakpoint wiring):
|
|
2336
|
+
// 1. staticPart — agent body + skills + runtime context. Stable across
|
|
2337
|
+
// turns, conversations, and jobs within an hour. 1h breakpoint.
|
|
2338
|
+
// 2. memoryPart — the user's memory file. Per-user, shared by every
|
|
2339
|
+
// conversation, and only changes on an explicit memory write — so
|
|
2340
|
+
// it gets its own 1h breakpoint instead of riding the volatile
|
|
2341
|
+
// tail (where it busted the message-history cache for no reason).
|
|
2342
|
+
// 3. dynamicPart — todos + hour-quantized time. Genuinely volatile
|
|
2343
|
+
// within a conversation; uncached, kept as small as possible.
|
|
2344
|
+
const buildSystemPromptParts = async (): Promise<{ staticPart: string; memoryPart: string; dynamicPart: string }> => {
|
|
2341
2345
|
const agentPrompt = renderCurrentAgentPrompt();
|
|
2342
2346
|
const tenantSkills = await this.getSkillsForTenant(input.tenantId);
|
|
2343
2347
|
const skillContextWindow = buildSkillContextWindow(tenantSkills);
|
|
@@ -2358,13 +2362,13 @@ Code is wrapped in an async IIFE — use \`return\` to return a value to the too
|
|
|
2358
2362
|
return `${weekday} ${d.toISOString().slice(0, 13)}Z`;
|
|
2359
2363
|
})();
|
|
2360
2364
|
const timeContext = `\n\nCurrent UTC time (hour precision): ${hourlyTime}`;
|
|
2361
|
-
const dynamicPart = `${
|
|
2362
|
-
return { staticPart, dynamicPart };
|
|
2365
|
+
const dynamicPart = `${todoContext}${timeContext}`;
|
|
2366
|
+
return { staticPart, memoryPart: memoryContext, dynamicPart };
|
|
2363
2367
|
};
|
|
2364
|
-
let { staticPart: staticSystemPart, dynamicPart: dynamicSystemPart } =
|
|
2368
|
+
let { staticPart: staticSystemPart, memoryPart: memorySystemPart, dynamicPart: dynamicSystemPart } =
|
|
2365
2369
|
await buildSystemPromptParts();
|
|
2366
2370
|
// Concatenated form for legacy consumers (token estimation, telemetry).
|
|
2367
|
-
let systemPrompt = `${staticSystemPart}${dynamicSystemPart}`;
|
|
2371
|
+
let systemPrompt = `${staticSystemPart}${memorySystemPart}${dynamicSystemPart}`;
|
|
2368
2372
|
let lastPromptFingerprint = `${this.agentFileFingerprint}\n${this.skillFingerprint}`;
|
|
2369
2373
|
|
|
2370
2374
|
const pushEvent = (event: AgentEvent): AgentEvent => {
|
|
@@ -3008,6 +3012,20 @@ Code is wrapped in an async IIFE — use \`return\` to return a value to the too
|
|
|
3008
3012
|
anthropic: { cacheControl: { type: "ephemeral", ttl: "1h" } },
|
|
3009
3013
|
},
|
|
3010
3014
|
},
|
|
3015
|
+
// Memory: per-user, conversation-independent, changes only on
|
|
3016
|
+
// an explicit memory write — its own 1h breakpoint means a
|
|
3017
|
+
// memory edit busts THIS block forward but a normal turn reads
|
|
3018
|
+
// it (plus everything before it) from cache. Breakpoint budget:
|
|
3019
|
+
// Anthropic allows 4; this is #2 of 3 (static, memory, tail).
|
|
3020
|
+
...(memorySystemPart.length > 0
|
|
3021
|
+
? [{
|
|
3022
|
+
role: "system" as const,
|
|
3023
|
+
content: memorySystemPart,
|
|
3024
|
+
providerOptions: {
|
|
3025
|
+
anthropic: { cacheControl: { type: "ephemeral", ttl: "1h" } },
|
|
3026
|
+
},
|
|
3027
|
+
}]
|
|
3028
|
+
: []),
|
|
3011
3029
|
...(dynamicSystemPart.length > 0
|
|
3012
3030
|
? [{ role: "system" as const, content: dynamicSystemPart }]
|
|
3013
3031
|
: []),
|
|
@@ -3794,9 +3812,9 @@ Code is wrapped in an async IIFE — use \`return\` to return a value to the too
|
|
|
3794
3812
|
agent = this.parsedAgent as ParsedAgent;
|
|
3795
3813
|
const currentFingerprint = `${this.agentFileFingerprint}\n${this.skillFingerprint}`;
|
|
3796
3814
|
if (currentFingerprint !== lastPromptFingerprint) {
|
|
3797
|
-
({ staticPart: staticSystemPart, dynamicPart: dynamicSystemPart } =
|
|
3815
|
+
({ staticPart: staticSystemPart, memoryPart: memorySystemPart, dynamicPart: dynamicSystemPart } =
|
|
3798
3816
|
await buildSystemPromptParts());
|
|
3799
|
-
systemPrompt = `${staticSystemPart}${dynamicSystemPart}`;
|
|
3817
|
+
systemPrompt = `${staticSystemPart}${memorySystemPart}${dynamicSystemPart}`;
|
|
3800
3818
|
lastPromptFingerprint = currentFingerprint;
|
|
3801
3819
|
}
|
|
3802
3820
|
}
|