@poncho-ai/harness 0.42.0 → 0.43.0
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 +36 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +57 -2
- package/package.json +1 -1
- package/src/default-agent.ts +89 -0
- package/src/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.
|
|
2
|
+
> @poncho-ai/harness@0.43.0 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
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[34mCLI[39m tsup v8.5.1
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.js [22m[32m504.78 KB[39m
|
|
12
11
|
[32mESM[39m [1mdist/isolate-VY35DGLM.js [22m[32m49.43 KB[39m
|
|
13
|
-
[32mESM[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m506.40 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 222ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 6907ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m80.85 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.43.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ff89631`](https://github.com/cesr/poncho-ai/commit/ff89631715e54d6fdce174943e6e0fc9e4ce5d1e) Thanks [@cesr](https://github.com/cesr)! - harness: export `defaultAgentDefinition` so SDK consumers can match `poncho init` exactly
|
|
8
|
+
|
|
9
|
+
Lifts the `AGENT_TEMPLATE` markdown body from `@poncho-ai/cli` (where it lived
|
|
10
|
+
inside the `init` scaffolding) into a public helper on `@poncho-ai/harness`.
|
|
11
|
+
SDK consumers (PonchOS, custom servers, anyone calling
|
|
12
|
+
`new AgentHarness({ agentDefinition })` directly) can now do:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { defaultAgentDefinition } from "@poncho-ai/harness";
|
|
16
|
+
|
|
17
|
+
const harness = new AgentHarness({
|
|
18
|
+
agentDefinition: defaultAgentDefinition({
|
|
19
|
+
name: "poncho",
|
|
20
|
+
modelName: "claude-sonnet-4-6",
|
|
21
|
+
}),
|
|
22
|
+
// ... storageEngine, config, etc.
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This eliminates hand-copying the template — drift between consumers and
|
|
27
|
+
`poncho init` is no longer possible.
|
|
28
|
+
|
|
29
|
+
The CLI's `AGENT_TEMPLATE` export is preserved as a thin back-compat
|
|
30
|
+
wrapper that delegates to `defaultAgentDefinition`. No behavior change.
|
|
31
|
+
|
|
32
|
+
API additions (harness):
|
|
33
|
+
- `defaultAgentDefinition(opts?: DefaultAgentDefinitionOptions): string`
|
|
34
|
+
- `DefaultAgentDefinitionOptions`
|
|
35
|
+
- `DEFAULT_AGENT_NAME`, `DEFAULT_AGENT_DESCRIPTION`,
|
|
36
|
+
`DEFAULT_MODEL_PROVIDER`, `DEFAULT_MODEL_NAME`, `DEFAULT_TEMPERATURE`,
|
|
37
|
+
`DEFAULT_MAX_STEPS`, `DEFAULT_TIMEOUT` constants
|
|
38
|
+
|
|
3
39
|
## 0.42.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -685,6 +685,43 @@ declare const resolveStateConfig: (config: PonchoConfig | undefined) => StateCon
|
|
|
685
685
|
declare const resolveMemoryConfig: (config: PonchoConfig | undefined) => MemoryConfig | undefined;
|
|
686
686
|
declare const loadPonchoConfig: (workingDir: string) => Promise<PonchoConfig | undefined>;
|
|
687
687
|
|
|
688
|
+
interface DefaultAgentDefinitionOptions {
|
|
689
|
+
/** Display name for the agent. Default: "agent". */
|
|
690
|
+
name?: string;
|
|
691
|
+
/**
|
|
692
|
+
* Stable identifier embedded in the frontmatter. Default: a fresh
|
|
693
|
+
* `agent_<32hex>`. Note: when an injected `StorageEngine` is also passed
|
|
694
|
+
* to `AgentHarness`, the engine's `agentId` overrides this at runtime, so
|
|
695
|
+
* SDK consumers can leave it default.
|
|
696
|
+
*/
|
|
697
|
+
id?: string;
|
|
698
|
+
/** Frontmatter description. Default: "A helpful Poncho assistant". */
|
|
699
|
+
description?: string;
|
|
700
|
+
/** Model provider. Default: "anthropic". */
|
|
701
|
+
modelProvider?: "anthropic" | "openai" | "openai-codex";
|
|
702
|
+
/** Model name. Default: "claude-opus-4-5". */
|
|
703
|
+
modelName?: string;
|
|
704
|
+
/** Sampling temperature. Default: 0.2. */
|
|
705
|
+
temperature?: number;
|
|
706
|
+
/** Max tool-call steps per run. Default: 20. */
|
|
707
|
+
maxSteps?: number;
|
|
708
|
+
/** Hard timeout in seconds. Default: 300. */
|
|
709
|
+
timeout?: number;
|
|
710
|
+
}
|
|
711
|
+
declare const DEFAULT_AGENT_NAME = "agent";
|
|
712
|
+
declare const DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
713
|
+
declare const DEFAULT_MODEL_PROVIDER: "anthropic";
|
|
714
|
+
declare const DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
715
|
+
declare const DEFAULT_TEMPERATURE = 0.2;
|
|
716
|
+
declare const DEFAULT_MAX_STEPS = 20;
|
|
717
|
+
declare const DEFAULT_TIMEOUT = 300;
|
|
718
|
+
/**
|
|
719
|
+
* Returns the canonical default agent definition as a markdown string,
|
|
720
|
+
* ready to pass to `new AgentHarness({ agentDefinition })`. This is the
|
|
721
|
+
* exact same template `poncho init` writes to `AGENT.md`.
|
|
722
|
+
*/
|
|
723
|
+
declare const defaultAgentDefinition: (opts?: DefaultAgentDefinitionOptions) => string;
|
|
724
|
+
|
|
688
725
|
declare const createDefaultTools: (workingDir: string) => ToolDefinition[];
|
|
689
726
|
declare const createWriteTool: (workingDir: string) => ToolDefinition;
|
|
690
727
|
declare const createEditTool: (workingDir: string) => ToolDefinition;
|
|
@@ -1925,4 +1962,4 @@ interface RunConversationTurnResult {
|
|
|
1925
1962
|
}
|
|
1926
1963
|
declare const runConversationTurn: (opts: RunConversationTurnOpts) => Promise<RunConversationTurnResult>;
|
|
1927
1964
|
|
|
1928
|
-
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 CompactMessagesOptions, type CompactResult, type CompactionConfig, type ContinuationHooks, type Conversation, type ConversationCreateInit, type ConversationState, type ConversationStatusSnapshot, type ConversationStore, type ConversationSummary, type CreateSkillToolsOptions, type CronJobConfig, 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 NetworkConfig, 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 SubagentSpawnResult, type SubagentSummary, 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, 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, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadVfsSkillMetadata, mergeSkills, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };
|
|
1965
|
+
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 CompactMessagesOptions, type CompactResult, type CompactionConfig, type ContinuationHooks, type Conversation, type ConversationCreateInit, 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 NetworkConfig, 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 SubagentSpawnResult, type SubagentSummary, 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, 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, defaultAgentDefinition, deleteOpenAICodexSession, deriveUploadKey, ensureAgentIdentity, estimateTokens, estimateTotalTokens, executeConversationTurn, findSafeSplitPoint, flushTurnDraft, generateAgentId, getAgentStoreDirectory, getModelContextWindow, getOpenAICodexAccessToken, getOpenAICodexAuthFilePath, getOpenAICodexRequiredScopes, getPonchoStoreRoot, isMessageArray, jsonSchemaToZod, loadCanonicalHistory, loadPonchoConfig, loadRunHistory, loadSkillContext, loadSkillInstructions, loadSkillMetadata, loadVfsSkillMetadata, mergeSkills, normalizeApprovalCheckpoint, normalizeOtlp, normalizeScriptPolicyPath, parseAgentFile, parseAgentMarkdown, parseSkillFrontmatter, ponchoDocsTool, readOpenAICodexSession, readSkillResource, recordStandardTurnEvent, renderAgentPrompt, resolveAgentIdentity, resolveCompactionConfig, resolveEnv, resolveMemoryConfig, resolveRunRequest, resolveSkillDirs, resolveStateConfig, runConversationTurn, slugifyStorageComponent, startOpenAICodexDeviceAuth, verifyTenantToken, withToolResultArchiveParam, writeOpenAICodexSession };
|
package/dist/index.js
CHANGED
|
@@ -565,6 +565,53 @@ var loadPonchoConfig = async (workingDir) => {
|
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
567
|
|
|
568
|
+
// src/default-agent.ts
|
|
569
|
+
import { randomBytes } from "crypto";
|
|
570
|
+
var DEFAULT_AGENT_NAME = "agent";
|
|
571
|
+
var DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
572
|
+
var DEFAULT_MODEL_PROVIDER = "anthropic";
|
|
573
|
+
var DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
574
|
+
var DEFAULT_TEMPERATURE = 0.2;
|
|
575
|
+
var DEFAULT_MAX_STEPS = 20;
|
|
576
|
+
var DEFAULT_TIMEOUT = 300;
|
|
577
|
+
var defaultAgentDefinition = (opts = {}) => {
|
|
578
|
+
const name = opts.name ?? DEFAULT_AGENT_NAME;
|
|
579
|
+
const id = opts.id ?? `agent_${randomBytes(16).toString("hex")}`;
|
|
580
|
+
const description = opts.description ?? DEFAULT_AGENT_DESCRIPTION;
|
|
581
|
+
const modelProvider = opts.modelProvider ?? DEFAULT_MODEL_PROVIDER;
|
|
582
|
+
const modelName = opts.modelName ?? DEFAULT_MODEL_NAME;
|
|
583
|
+
const temperature = opts.temperature ?? DEFAULT_TEMPERATURE;
|
|
584
|
+
const maxSteps = opts.maxSteps ?? DEFAULT_MAX_STEPS;
|
|
585
|
+
const timeout = opts.timeout ?? DEFAULT_TIMEOUT;
|
|
586
|
+
return `---
|
|
587
|
+
name: ${name}
|
|
588
|
+
id: ${id}
|
|
589
|
+
description: ${description}
|
|
590
|
+
model:
|
|
591
|
+
provider: ${modelProvider}
|
|
592
|
+
name: ${modelName}
|
|
593
|
+
temperature: ${temperature}
|
|
594
|
+
limits:
|
|
595
|
+
maxSteps: ${maxSteps}
|
|
596
|
+
timeout: ${timeout}
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
# {{name}}
|
|
600
|
+
|
|
601
|
+
You are **{{name}}**, a helpful assistant built with Poncho.
|
|
602
|
+
|
|
603
|
+
Working directory: {{runtime.workingDir}}
|
|
604
|
+
Environment: {{runtime.environment}}
|
|
605
|
+
|
|
606
|
+
## Task Guidance
|
|
607
|
+
|
|
608
|
+
- Use tools when needed
|
|
609
|
+
- Explain your reasoning clearly
|
|
610
|
+
- Ask clarifying questions when requirements are ambiguous
|
|
611
|
+
- Never claim a file/tool change unless the corresponding tool call actually succeeded
|
|
612
|
+
`;
|
|
613
|
+
};
|
|
614
|
+
|
|
568
615
|
// src/default-tools.ts
|
|
569
616
|
import { mkdir, readdir, readFile as readFile3, rm, unlink, writeFile as writeFile2 } from "fs/promises";
|
|
570
617
|
import { dirname, resolve as resolve4, sep } from "path";
|
|
@@ -5562,14 +5609,14 @@ var createTodoTools = (store) => {
|
|
|
5562
5609
|
};
|
|
5563
5610
|
|
|
5564
5611
|
// src/secrets-store.ts
|
|
5565
|
-
import { createCipheriv, createDecipheriv, randomBytes, createHash as createHash3 } from "crypto";
|
|
5612
|
+
import { createCipheriv, createDecipheriv, randomBytes as randomBytes2, createHash as createHash3 } from "crypto";
|
|
5566
5613
|
import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile4 } from "fs/promises";
|
|
5567
5614
|
import { dirname as dirname3, resolve as resolve7 } from "path";
|
|
5568
5615
|
function deriveKey(signingKey) {
|
|
5569
5616
|
return createHash3("sha256").update("poncho-secrets-v1:" + signingKey).digest();
|
|
5570
5617
|
}
|
|
5571
5618
|
function encrypt(plaintext, key) {
|
|
5572
|
-
const iv =
|
|
5619
|
+
const iv = randomBytes2(12);
|
|
5573
5620
|
const cipher = createCipheriv("aes-256-gcm", key, iv);
|
|
5574
5621
|
const ct = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
|
|
5575
5622
|
const tag = cipher.getAuthTag();
|
|
@@ -13307,6 +13354,13 @@ export {
|
|
|
13307
13354
|
AgentOrchestrator,
|
|
13308
13355
|
BashEnvironmentManager,
|
|
13309
13356
|
CALLBACK_LOCK_STALE_MS,
|
|
13357
|
+
DEFAULT_AGENT_DESCRIPTION,
|
|
13358
|
+
DEFAULT_AGENT_NAME,
|
|
13359
|
+
DEFAULT_MAX_STEPS,
|
|
13360
|
+
DEFAULT_MODEL_NAME,
|
|
13361
|
+
DEFAULT_MODEL_PROVIDER,
|
|
13362
|
+
DEFAULT_TEMPERATURE,
|
|
13363
|
+
DEFAULT_TIMEOUT,
|
|
13310
13364
|
InMemoryConversationStore,
|
|
13311
13365
|
InMemoryEngine,
|
|
13312
13366
|
InMemoryStateStore,
|
|
@@ -13363,6 +13417,7 @@ export {
|
|
|
13363
13417
|
createTurnDraftState,
|
|
13364
13418
|
createUploadStore,
|
|
13365
13419
|
createWriteTool,
|
|
13420
|
+
defaultAgentDefinition,
|
|
13366
13421
|
defineTool13 as defineTool,
|
|
13367
13422
|
deleteOpenAICodexSession,
|
|
13368
13423
|
deriveUploadKey,
|
package/package.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Canonical default agent definition.
|
|
3
|
+
//
|
|
4
|
+
// This is the same agent.md a fresh `poncho init` produces. The CLI's
|
|
5
|
+
// AGENT_TEMPLATE in `packages/cli/src/templates.ts` delegates to this helper
|
|
6
|
+
// so there is exactly one source of truth, and SDK consumers (PonchOS, custom
|
|
7
|
+
// servers, etc.) can pass the same default to `new AgentHarness({ agentDefinition: ... })`
|
|
8
|
+
// without hand-copying the template.
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
import { randomBytes } from "node:crypto";
|
|
12
|
+
|
|
13
|
+
export interface DefaultAgentDefinitionOptions {
|
|
14
|
+
/** Display name for the agent. Default: "agent". */
|
|
15
|
+
name?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Stable identifier embedded in the frontmatter. Default: a fresh
|
|
18
|
+
* `agent_<32hex>`. Note: when an injected `StorageEngine` is also passed
|
|
19
|
+
* to `AgentHarness`, the engine's `agentId` overrides this at runtime, so
|
|
20
|
+
* SDK consumers can leave it default.
|
|
21
|
+
*/
|
|
22
|
+
id?: string;
|
|
23
|
+
/** Frontmatter description. Default: "A helpful Poncho assistant". */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Model provider. Default: "anthropic". */
|
|
26
|
+
modelProvider?: "anthropic" | "openai" | "openai-codex";
|
|
27
|
+
/** Model name. Default: "claude-opus-4-5". */
|
|
28
|
+
modelName?: string;
|
|
29
|
+
/** Sampling temperature. Default: 0.2. */
|
|
30
|
+
temperature?: number;
|
|
31
|
+
/** Max tool-call steps per run. Default: 20. */
|
|
32
|
+
maxSteps?: number;
|
|
33
|
+
/** Hard timeout in seconds. Default: 300. */
|
|
34
|
+
timeout?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const DEFAULT_AGENT_NAME = "agent";
|
|
38
|
+
export const DEFAULT_AGENT_DESCRIPTION = "A helpful Poncho assistant";
|
|
39
|
+
export const DEFAULT_MODEL_PROVIDER = "anthropic" as const;
|
|
40
|
+
export const DEFAULT_MODEL_NAME = "claude-opus-4-5";
|
|
41
|
+
export const DEFAULT_TEMPERATURE = 0.2;
|
|
42
|
+
export const DEFAULT_MAX_STEPS = 20;
|
|
43
|
+
export const DEFAULT_TIMEOUT = 300;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns the canonical default agent definition as a markdown string,
|
|
47
|
+
* ready to pass to `new AgentHarness({ agentDefinition })`. This is the
|
|
48
|
+
* exact same template `poncho init` writes to `AGENT.md`.
|
|
49
|
+
*/
|
|
50
|
+
export const defaultAgentDefinition = (
|
|
51
|
+
opts: DefaultAgentDefinitionOptions = {},
|
|
52
|
+
): string => {
|
|
53
|
+
const name = opts.name ?? DEFAULT_AGENT_NAME;
|
|
54
|
+
const id = opts.id ?? `agent_${randomBytes(16).toString("hex")}`;
|
|
55
|
+
const description = opts.description ?? DEFAULT_AGENT_DESCRIPTION;
|
|
56
|
+
const modelProvider = opts.modelProvider ?? DEFAULT_MODEL_PROVIDER;
|
|
57
|
+
const modelName = opts.modelName ?? DEFAULT_MODEL_NAME;
|
|
58
|
+
const temperature = opts.temperature ?? DEFAULT_TEMPERATURE;
|
|
59
|
+
const maxSteps = opts.maxSteps ?? DEFAULT_MAX_STEPS;
|
|
60
|
+
const timeout = opts.timeout ?? DEFAULT_TIMEOUT;
|
|
61
|
+
|
|
62
|
+
return `---
|
|
63
|
+
name: ${name}
|
|
64
|
+
id: ${id}
|
|
65
|
+
description: ${description}
|
|
66
|
+
model:
|
|
67
|
+
provider: ${modelProvider}
|
|
68
|
+
name: ${modelName}
|
|
69
|
+
temperature: ${temperature}
|
|
70
|
+
limits:
|
|
71
|
+
maxSteps: ${maxSteps}
|
|
72
|
+
timeout: ${timeout}
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
# {{name}}
|
|
76
|
+
|
|
77
|
+
You are **{{name}}**, a helpful assistant built with Poncho.
|
|
78
|
+
|
|
79
|
+
Working directory: {{runtime.workingDir}}
|
|
80
|
+
Environment: {{runtime.environment}}
|
|
81
|
+
|
|
82
|
+
## Task Guidance
|
|
83
|
+
|
|
84
|
+
- Use tools when needed
|
|
85
|
+
- Explain your reasoning clearly
|
|
86
|
+
- Ask clarifying questions when requirements are ambiguous
|
|
87
|
+
- Never claim a file/tool change unless the corresponding tool call actually succeeded
|
|
88
|
+
`;
|
|
89
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./agent-parser.js";
|
|
|
2
2
|
export * from "./agent-identity.js";
|
|
3
3
|
export * from "./compaction.js";
|
|
4
4
|
export * from "./config.js";
|
|
5
|
+
export * from "./default-agent.js";
|
|
5
6
|
export * from "./default-tools.js";
|
|
6
7
|
export * from "./harness.js";
|
|
7
8
|
export * from "./memory.js";
|