@poncho-ai/harness 0.20.13 → 0.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/harness",
3
- "version": "0.20.13",
3
+ "version": "0.21.0",
4
4
  "description": "Agent execution runtime - conversation loop, tool dispatch, streaming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,8 +46,8 @@
46
46
  ],
47
47
  "license": "MIT",
48
48
  "scripts": {
49
- "build": "tsup src/index.ts --format esm --dts",
50
- "dev": "tsup src/index.ts --format esm --dts --watch",
49
+ "build": "node scripts/embed-docs.js && tsup src/index.ts --format esm --dts",
50
+ "dev": "node scripts/embed-docs.js && tsup src/index.ts --format esm --dts --watch",
51
51
  "test": "vitest",
52
52
  "lint": "eslint src/"
53
53
  }
@@ -0,0 +1,26 @@
1
+ import { readFileSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { resolve, dirname } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const repoRoot = resolve(__dirname, "..", "..", "..");
7
+ const outDir = resolve(__dirname, "..", "src", "generated");
8
+
9
+ const TOPICS = ["api", "features", "configuration", "troubleshooting"];
10
+
11
+ const entries = TOPICS.map((topic) => {
12
+ const filePath = resolve(repoRoot, "docs", `${topic}.md`);
13
+ const content = readFileSync(filePath, "utf8");
14
+ const escaped = content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
15
+ return ` ${JSON.stringify(topic)}: \`${escaped}\``;
16
+ });
17
+
18
+ const output = `// Auto-generated by scripts/embed-docs.js — do not edit manually.
19
+ export const PONCHO_DOCS: Record<string, string> = {
20
+ ${entries.join(",\n")},
21
+ };
22
+ `;
23
+
24
+ mkdirSync(outDir, { recursive: true });
25
+ writeFileSync(resolve(outDir, "poncho-docs.ts"), output, "utf8");
26
+ console.log(`[embed-docs] Generated poncho-docs.ts with ${TOPICS.length} topics`);
package/src/config.ts CHANGED
@@ -130,6 +130,11 @@ export interface PonchoConfig extends McpConfig {
130
130
  sessionName?: string;
131
131
  executablePath?: string;
132
132
  headless?: boolean;
133
+ /** Custom user-agent string. When stealth is enabled (default) a
134
+ * realistic Chrome UA is used automatically. */
135
+ userAgent?: string;
136
+ /** Reduce bot-detection fingerprints. Defaults to `true`. */
137
+ stealth?: boolean;
133
138
  };
134
139
  }
135
140
 
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readdir, readFile, rm, unlink, writeFile } from "node:fs/promises";
2
2
  import { dirname, resolve, sep } from "node:path";
3
3
  import { defineTool, type ToolDefinition } from "@poncho-ai/sdk";
4
+ import { PONCHO_DOCS } from "./generated/poncho-docs.js";
4
5
 
5
6
  const resolveSafePath = (workingDir: string, inputPath: string): string => {
6
7
  const base = resolve(workingDir);
@@ -136,4 +137,33 @@ export const createDeleteDirectoryTool = (workingDir: string): ToolDefinition =>
136
137
  await rm(resolved, { recursive: true });
137
138
  return { path, deleted: true };
138
139
  },
139
- });
140
+ });
141
+
142
+ const PONCHO_DOCS_TOPICS = Object.keys(PONCHO_DOCS);
143
+
144
+ export const ponchoDocsTool: ToolDefinition = defineTool({
145
+ name: "poncho_docs",
146
+ description:
147
+ "Read detailed Poncho framework documentation by topic. " +
148
+ `Available topics: ${PONCHO_DOCS_TOPICS.join(", ")}.`,
149
+ inputSchema: {
150
+ type: "object",
151
+ properties: {
152
+ topic: {
153
+ type: "string",
154
+ enum: PONCHO_DOCS_TOPICS,
155
+ description: "Documentation topic to read",
156
+ },
157
+ },
158
+ required: ["topic"],
159
+ additionalProperties: false,
160
+ },
161
+ handler: async (input) => {
162
+ const topic = typeof input.topic === "string" ? input.topic : "";
163
+ const content = PONCHO_DOCS[topic];
164
+ if (!content) {
165
+ return { error: `Unknown topic "${topic}". Available: ${PONCHO_DOCS_TOPICS.join(", ")}` };
166
+ }
167
+ return { topic, content };
168
+ },
169
+ });
package/src/harness.ts CHANGED
@@ -15,7 +15,7 @@ import type { UploadStore } from "./upload-store.js";
15
15
  import { PONCHO_UPLOAD_SCHEME, deriveUploadKey } from "./upload-store.js";
16
16
  import { parseAgentFile, renderAgentPrompt, type ParsedAgent, type AgentFrontmatter } from "./agent-parser.js";
17
17
  import { loadPonchoConfig, resolveMemoryConfig, type PonchoConfig, type ToolAccess, type BuiltInToolToggles } from "./config.js";
18
- import { createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createWriteTool } from "./default-tools.js";
18
+ import { createDefaultTools, createDeleteDirectoryTool, createDeleteTool, createWriteTool, ponchoDocsTool } from "./default-tools.js";
19
19
  import {
20
20
  createMemoryStore,
21
21
  createMemoryTools,
@@ -479,7 +479,15 @@ Since all fields have defaults, you only need to specify \`*Env\` when your env
479
479
  - If shell/CLI access is unavailable, ask the user to run needed commands and provide exact copy-paste commands.
480
480
  - For setup, skills, MCP, auth, storage, telemetry, or "how do I..." questions, proactively read \`README.md\` with \`read_file\` before answering.
481
481
  - Prefer quoting concrete commands and examples from \`README.md\` over guessing.
482
- - Keep edits minimal, preserve unrelated settings/code, and summarize what changed.`;
482
+ - Keep edits minimal, preserve unrelated settings/code, and summarize what changed.
483
+
484
+ ## Detailed Documentation
485
+
486
+ For topics not covered above, use the \`poncho_docs\` tool to load full documentation on demand:
487
+ - \`api\` — HTTP API endpoints, SSE events, TypeScript client SDK, file attachments, upload providers
488
+ - \`features\` — Web UI details, browser automation, subagents, persistent memory, custom messaging adapters
489
+ - \`configuration\` — Full config reference, env vars, auth types, storage, telemetry, tool approval
490
+ - \`troubleshooting\` — Error codes, recoverable vs fatal errors, common issues and fixes`;
483
491
 
484
492
  /**
485
493
  * Detect FileContentPart objects ({ type:"file", data, mediaType }) in a tool
@@ -624,6 +632,9 @@ export class AgentHarness {
624
632
  if (this.isToolEnabled("delete_directory")) {
625
633
  this.registerIfMissing(createDeleteDirectoryTool(this.workingDir));
626
634
  }
635
+ if (this.environment === "development" && this.isToolEnabled("poncho_docs")) {
636
+ this.registerIfMissing(ponchoDocsTool);
637
+ }
627
638
  }
628
639
 
629
640
  private shouldEnableWriteTool(): boolean {
@@ -1,6 +0,0 @@
1
-
2
- > @poncho-ai/harness@0.11.2 lint /Users/cesar/Dev/latitude/poncho-ai/packages/harness
3
- > eslint src/
4
-
5
- sh: eslint: command not found
6
-  ELIFECYCLE  Command failed.
@@ -1,135 +0,0 @@
1
-
2
- > @poncho-ai/harness@0.16.1 test /Users/cesar/Dev/latitude/poncho-ai/packages/harness
3
- > vitest
4
-
5
-
6
-  RUN  v1.6.1 /Users/cesar/Dev/latitude/poncho-ai/packages/harness
7
-
8
- ✓ test/telemetry.test.ts  (3 tests) 2ms
9
- [event] step:completed {"type":"step:completed","step":1,"duration":1}
10
- [event] step:started {"type":"step:started","step":2}
11
- ✓ test/schema-converter.test.ts  (27 tests) 19ms
12
- stdout | test/mcp.test.ts > mcp bridge protocol transports > discovers and calls tools over streamable HTTP
13
- [poncho][mcp] {"event":"catalog.loaded","server":"remote","discoveredCount":1}
14
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":0}
15
-
16
- stdout | test/mcp.test.ts > mcp bridge protocol transports > selects discovered tools by requested patterns
17
- [poncho][mcp] {"event":"catalog.loaded","server":"remote","discoveredCount":2}
18
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":1}
19
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":2,"filteredByPolicyCount":0,"filteredByIntentCount":0}
20
-
21
- ✓ test/agent-parser.test.ts  (10 tests) 24ms
22
- stdout | test/mcp.test.ts > mcp bridge protocol transports > skips discovery when bearer token env value is missing
23
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":0,"filteredByPolicyCount":0,"filteredByIntentCount":0}
24
-
25
- stderr | test/mcp.test.ts > mcp bridge protocol transports > skips discovery when bearer token env value is missing
26
- [poncho][mcp] {"event":"auth.token_missing","server":"remote","tokenEnv":"MISSING_TOKEN_ENV"}
27
-
28
- stdout | test/mcp.test.ts > mcp bridge protocol transports > returns actionable errors for 403 permission failures
29
- [poncho][mcp] {"event":"catalog.loaded","server":"remote","discoveredCount":1}
30
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":0}
31
-
32
- ✓ test/mcp.test.ts  (6 tests) 81ms
33
- ✓ test/memory.test.ts  (4 tests) 56ms
34
- ✓ test/state.test.ts  (5 tests) 237ms
35
- ✓ test/model-factory.test.ts  (4 tests) 2ms
36
- ✓ test/agent-identity.test.ts  (2 tests) 43ms
37
- stdout | test/harness.test.ts > agent harness > registers default filesystem tools
38
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
39
-
40
- stdout | test/harness.test.ts > agent harness > disables write_file by default in production environment
41
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
42
-
43
- stdout | test/harness.test.ts > agent harness > allows disabling built-in tools via poncho.config.js
44
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
45
-
46
- stdout | test/harness.test.ts > agent harness > supports per-environment tool overrides
47
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
48
-
49
- stdout | test/harness.test.ts > agent harness > supports per-environment tool overrides
50
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
51
-
52
- stdout | test/harness.test.ts > agent harness > does not auto-register exported tool objects from skill scripts
53
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
54
-
55
- stdout | test/harness.test.ts > agent harness > refreshes skill metadata and tools in development mode
56
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
57
-
58
- stdout | test/harness.test.ts > agent harness > refreshes skill metadata and tools in development mode
59
- [poncho][mcp] {"event":"tools.cleared","reason":"skills:changed","requestedPatterns":[]}
60
- [poncho][mcp] {"event":"tools.cleared","reason":"activate:beta","requestedPatterns":[]}
61
-
62
- stdout | test/harness.test.ts > agent harness > prunes removed active skills after refresh in development mode
63
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
64
- [poncho][mcp] {"event":"tools.cleared","reason":"activate:obsolete","requestedPatterns":[]}
65
-
66
- stdout | test/harness.test.ts > agent harness > prunes removed active skills after refresh in development mode
67
- [poncho][mcp] {"event":"tools.cleared","reason":"skills:changed","requestedPatterns":[]}
68
-
69
- stdout | test/harness.test.ts > agent harness > does not refresh skills outside development mode
70
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
71
-
72
- stdout | test/harness.test.ts > agent harness > clears active skills when skill metadata changes in development mode
73
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
74
- [poncho][mcp] {"event":"tools.cleared","reason":"activate:alpha","requestedPatterns":[]}
75
-
76
- stdout | test/harness.test.ts > agent harness > clears active skills when skill metadata changes in development mode
77
- [poncho][mcp] {"event":"tools.cleared","reason":"skills:changed","requestedPatterns":[]}
78
-
79
- stdout | test/harness.test.ts > agent harness > lists skill scripts through list_skill_scripts
80
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
81
-
82
- stdout | test/harness.test.ts > agent harness > runs JavaScript/TypeScript skill scripts through run_skill_script
83
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
84
-
85
- stdout | test/harness.test.ts > agent harness > runs AGENT-scope scripts from root scripts directory
86
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
87
-
88
- stdout | test/harness.test.ts > agent harness > blocks path traversal in run_skill_script
89
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
90
-
91
- stdout | test/harness.test.ts > agent harness > requires allowed-tools entries for non-standard script directories
92
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
93
-
94
- stdout | test/harness.test.ts > agent harness > registers MCP tools dynamically for stacked active skills and supports deactivation
95
- [poncho][mcp] {"event":"catalog.loaded","server":"remote","discoveredCount":2}
96
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
97
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":1}
98
- [poncho][mcp] {"event":"tools.refreshed","reason":"activate:skill-a","requestedPatterns":["remote/a"],"registeredCount":1,"activeSkills":["skill-a"]}
99
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":2,"registeredCount":2,"filteredByPolicyCount":0,"filteredByIntentCount":0}
100
- [poncho][mcp] {"event":"tools.refreshed","reason":"activate:skill-b","requestedPatterns":["remote/a","remote/b"],"registeredCount":2,"activeSkills":["skill-a","skill-b"]}
101
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":1}
102
- [poncho][mcp] {"event":"tools.refreshed","reason":"deactivate:skill-a","requestedPatterns":["remote/b"],"registeredCount":1,"activeSkills":["skill-b"]}
103
-
104
- stdout | test/harness.test.ts > agent harness > supports flat tool access config format
105
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
106
-
107
- stdout | test/harness.test.ts > agent harness > flat tool access takes priority over legacy defaults
108
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
109
-
110
- stdout | test/harness.test.ts > agent harness > byEnvironment overrides flat tool access
111
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
112
-
113
- stdout | test/harness.test.ts > agent harness > registerTools skips tools disabled via config
114
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
115
-
116
- stdout | test/harness.test.ts > agent harness > approval access level registers the tool but marks it for approval
117
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
118
-
119
- stdout | test/harness.test.ts > agent harness > tools without approval config do not require approval
120
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
121
-
122
- stdout | test/harness.test.ts > agent harness > allows in-flight MCP calls to finish after skill deactivation
123
- [poncho][mcp] {"event":"catalog.loaded","server":"remote","discoveredCount":1}
124
- [poncho][mcp] {"event":"tools.cleared","reason":"initialize","requestedPatterns":[]}
125
- [poncho][mcp] {"event":"tools.selected","requestedPatternCount":1,"registeredCount":1,"filteredByPolicyCount":0,"filteredByIntentCount":0}
126
- [poncho][mcp] {"event":"tools.refreshed","reason":"activate:skill-slow","requestedPatterns":["remote/slow"],"registeredCount":1,"activeSkills":["skill-slow"]}
127
- [poncho][mcp] {"event":"tools.cleared","reason":"deactivate:skill-slow","requestedPatterns":[]}
128
-
129
- ✓ test/harness.test.ts  (25 tests) 291ms
130
-
131
-  Test Files  9 passed (9)
132
-  Tests  86 passed (86)
133
-  Start at  17:47:43
134
-  Duration  1.88s (transform 684ms, setup 1ms, collect 2.34s, tests 755ms, environment 2ms, prepare 1.27s)
135
-