typeclaw 0.48.12 → 0.49.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 +6 -3
- package/scripts/dump-system-prompt.ts +52 -110
- package/src/agent/attention-escalation.ts +8 -5
- package/src/agent/auth-reloadable.ts +2 -3
- package/src/agent/auth.ts +59 -79
- package/src/agent/compaction.ts +2 -2
- package/src/agent/index.ts +173 -85
- package/src/agent/live-sessions.ts +2 -2
- package/src/agent/live-subagents.ts +1 -0
- package/src/agent/llm-replay-sanitizer.ts +1 -1
- package/src/agent/model-overrides.ts +1 -1
- package/src/agent/multimodal/look-at.ts +3 -3
- package/src/agent/multimodal/read-redirect.ts +1 -1
- package/src/agent/plugin-tools.ts +76 -39
- package/src/agent/prompt-cache-key.ts +42 -0
- package/src/agent/provider-error.ts +179 -10
- package/src/agent/reload-tool.ts +1 -1
- package/src/agent/restart-handoff/index.ts +7 -14
- package/src/agent/reviewer-activity.ts +68 -0
- package/src/agent/session-origin.ts +33 -0
- package/src/agent/subagents.ts +14 -2
- package/src/agent/system-prompt.ts +68 -202
- package/src/agent/todo/continuation-policy.ts +12 -4
- package/src/agent/tool-error-remediation.ts +1 -1
- package/src/agent/tool-file-safety.ts +113 -14
- package/src/agent/tool-not-found-nudge.ts +1 -1
- package/src/agent/tool-result-budget.ts +2 -2
- package/src/agent/tools/channel-disengage.ts +2 -2
- package/src/agent/tools/channel-edit.ts +2 -2
- package/src/agent/tools/channel-fetch-attachment.ts +2 -2
- package/src/agent/tools/channel-history-render.ts +2 -1
- package/src/agent/tools/channel-history.ts +2 -2
- package/src/agent/tools/channel-react.ts +2 -2
- package/src/agent/tools/channel-read.ts +2 -2
- package/src/agent/tools/channel-reply.ts +25 -7
- package/src/agent/tools/channel-send.ts +51 -9
- package/src/agent/tools/curl-impersonate.ts +11 -2
- package/src/agent/tools/grant-role.ts +2 -2
- package/src/agent/tools/post-github-review.ts +79 -17
- package/src/agent/tools/restart.ts +2 -2
- package/src/agent/tools/skip-response.ts +4 -4
- package/src/agent/tools/spawn-subagent.ts +165 -14
- package/src/agent/tools/stream-snapshot.ts +2 -2
- package/src/agent/tools/subagent-cancel.ts +2 -2
- package/src/agent/tools/subagent-output.ts +10 -2
- package/src/agent/tools/todo/index.ts +2 -2
- package/src/agent/tools/webfetch/tool.ts +2 -2
- package/src/agent/tools/websearch.ts +2 -2
- package/src/bundled-plugins/backup/README.md +10 -9
- package/src/bundled-plugins/backup/runner.ts +140 -58
- package/src/bundled-plugins/backup/subagents.ts +58 -26
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +34 -2
- package/src/bundled-plugins/github-cli-auth/granted-push.ts +135 -0
- package/src/bundled-plugins/github-cli-auth/index.ts +83 -11
- package/src/bundled-plugins/github-cli-auth/review-account.ts +23 -0
- package/src/bundled-plugins/github-cli-auth/review-checkout.ts +9 -2
- package/src/bundled-plugins/github-cli-auth/review-recorder.ts +45 -7
- package/src/bundled-plugins/operator/operator.ts +15 -4
- package/src/bundled-plugins/reviewer/skills/code-review.ts +1 -1
- package/src/bundled-plugins/security/index.ts +50 -2
- package/src/bundled-plugins/security/policies/git-exfil.ts +24 -12
- package/src/channels/adapters/discord-bot-reactions.ts +18 -0
- package/src/channels/adapters/discord-bot.ts +122 -67
- package/src/channels/adapters/discord-reactions.ts +18 -0
- package/src/channels/adapters/discord.ts +114 -8
- package/src/channels/adapters/github/inbound.ts +103 -8
- package/src/channels/adapters/github/index.ts +251 -19
- package/src/channels/adapters/github/last-alive.ts +27 -0
- package/src/channels/adapters/github/outbound.ts +54 -18
- package/src/channels/adapters/github/pending-review-store.ts +141 -0
- package/src/channels/adapters/github/permission-guidance.ts +1 -0
- package/src/channels/adapters/github/reactions.ts +100 -0
- package/src/channels/adapters/github/reconcile-cooldown-store.ts +197 -67
- package/src/channels/adapters/github/reconcile-open-prs.ts +418 -33
- package/src/channels/adapters/github/recovery.ts +106 -0
- package/src/channels/adapters/github/review-check.ts +510 -0
- package/src/channels/adapters/github/review-submitter.ts +34 -2
- package/src/channels/adapters/instagram.ts +32 -14
- package/src/channels/adapters/kakaotalk.ts +22 -7
- package/src/channels/adapters/line.ts +18 -3
- package/src/channels/adapters/outbound-account.ts +20 -0
- package/src/channels/adapters/own-reactions.ts +66 -0
- package/src/channels/adapters/recovery-correlation.ts +214 -0
- package/src/channels/adapters/slack-bot-classify.ts +18 -11
- package/src/channels/adapters/slack-bot-dedupe.ts +111 -28
- package/src/channels/adapters/slack-bot-reactions.ts +18 -0
- package/src/channels/adapters/slack-bot.ts +125 -57
- package/src/channels/adapters/slack-classify.ts +25 -4
- package/src/channels/adapters/slack-inbound-revision.ts +96 -0
- package/src/channels/adapters/slack-reactions.ts +18 -0
- package/src/channels/adapters/slack-thread-ts.ts +6 -0
- package/src/channels/adapters/slack.ts +48 -3
- package/src/channels/adapters/teams.ts +14 -4
- package/src/channels/adapters/telegram-bot.ts +56 -10
- package/src/channels/adapters/webex-bot.ts +12 -2
- package/src/channels/adapters/webex.ts +12 -2
- package/src/channels/background-handoff.ts +434 -0
- package/src/channels/background-obligations.ts +893 -0
- package/src/channels/continuity-types.ts +271 -0
- package/src/channels/github-review-check.ts +598 -0
- package/src/channels/github-review-turn-ledger.ts +102 -28
- package/src/channels/github-review-verdict-coordinator.ts +96 -13
- package/src/channels/github-token-bridge.ts +11 -5
- package/src/channels/inbound-journal.ts +1738 -0
- package/src/channels/index.ts +6 -1
- package/src/channels/manager.ts +17 -7
- package/src/channels/recovery-dispatcher.ts +264 -0
- package/src/channels/recovery-notice.ts +94 -0
- package/src/channels/recovery-outbox.ts +459 -0
- package/src/channels/router.ts +2582 -633
- package/src/channels/schema.ts +8 -1
- package/src/channels/subagent-completion-bridge.ts +17 -14
- package/src/channels/types.ts +121 -16
- package/src/channels/waiting-reactions.ts +664 -0
- package/src/cli/compose.ts +7 -4
- package/src/cli/hostd.ts +49 -3
- package/src/cli/inspect.ts +11 -14
- package/src/cli/model.ts +7 -5
- package/src/cli/oauth-callbacks.ts +38 -23
- package/src/coding-agent/broker-body.ts +38 -0
- package/src/coding-agent/broker.ts +290 -0
- package/src/coding-agent/claude.ts +95 -0
- package/src/coding-agent/codex.ts +104 -0
- package/src/coding-agent/index.ts +506 -0
- package/src/coding-agent/omo-state.ts +69 -0
- package/src/coding-agent/omo-stream.ts +98 -0
- package/src/coding-agent/omo.ts +192 -0
- package/src/coding-agent/runner.ts +263 -0
- package/src/coding-agent/tool.ts +62 -0
- package/src/coding-agent/worktree.ts +355 -0
- package/src/compose/restart.ts +10 -3
- package/src/compose/start.ts +20 -3
- package/src/config/config.ts +70 -26
- package/src/config/providers.ts +278 -50
- package/src/container/exit-reason.ts +44 -0
- package/src/container/index.ts +5 -0
- package/src/container/log-archive.ts +51 -13
- package/src/container/memory-limit.ts +1 -1
- package/src/container/memory-oversubscription.ts +36 -6
- package/src/container/oom-events.ts +86 -0
- package/src/container/restart.ts +2 -0
- package/src/container/shared.ts +8 -1
- package/src/container/start.ts +25 -13
- package/src/container/stop.ts +6 -2
- package/src/container/tool-oom-priority.ts +32 -0
- package/src/cron/consumer.ts +10 -4
- package/src/cron/reloadable.ts +23 -2
- package/src/doctor/checks.ts +14 -2
- package/src/hostd/daemon.ts +20 -10
- package/src/hostd/spawn.ts +106 -5
- package/src/hostd/version.ts +20 -0
- package/src/hostd/watchdog.ts +241 -0
- package/src/init/dockerfile.ts +57 -592
- package/src/init/index.ts +6 -7
- package/src/init/oauth-login.ts +57 -17
- package/src/inspect/transcript-view.ts +6 -3
- package/src/mcp/client.ts +3 -1
- package/src/operations/classify-tool-outcome.ts +45 -1
- package/src/operations/incidents.ts +10 -5
- package/src/plugin/core-tool-names.ts +1 -1
- package/src/plugin/define.ts +1 -0
- package/src/plugin/index.ts +1 -0
- package/src/plugin/types.ts +6 -1
- package/src/run/background-handoff-boot.ts +86 -0
- package/src/run/channel-session-factory.ts +5 -4
- package/src/run/index.ts +93 -93
- package/src/run/resource-sample.ts +19 -0
- package/src/sandbox/build.ts +4 -0
- package/src/sandbox/coding-agent.ts +214 -0
- package/src/sandbox/policy.ts +1 -0
- package/src/sandbox/runtime-private.ts +4 -1
- package/src/secrets/coding-agent-auth.ts +97 -0
- package/src/secrets/index.ts +0 -16
- package/src/secrets/refresh-provider-oauth.ts +30 -76
- package/src/secrets/schema.ts +3 -4
- package/src/secrets/storage.ts +133 -234
- package/src/server/command-runner.ts +6 -2
- package/src/server/index.ts +102 -41
- package/src/sessions/index.ts +1 -1
- package/src/skills/typeclaw-channel-github/SKILL.md +7 -5
- package/src/skills/typeclaw-claude-code/SKILL.md +25 -260
- package/src/skills/typeclaw-claude-code/references/auth-flow.md +7 -23
- package/src/skills/typeclaw-claude-code/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-claude-code/references/results-and-worktrees.md +13 -0
- package/src/skills/typeclaw-codex-cli/SKILL.md +35 -270
- package/src/skills/typeclaw-codex-cli/references/auth-flow.md +13 -20
- package/src/skills/typeclaw-codex-cli/references/headless-sessions.md +26 -0
- package/src/skills/typeclaw-codex-cli/references/results-and-worktrees.md +28 -0
- package/src/skills/typeclaw-config/SKILL.md +24 -24
- package/src/skills/typeclaw-config/references/dockerfile.md +14 -13
- package/src/skills/typeclaw-cron/SKILL.md +1 -1
- package/src/skills/typeclaw-github-contributing/SKILL.md +2 -2
- package/src/skills/typeclaw-memory/SKILL.md +3 -3
- package/src/skills/typeclaw-omo-cli/SKILL.md +52 -0
- package/src/skills/typeclaw-omo-cli/references/auth-flow.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/headless-sessions.md +11 -0
- package/src/skills/typeclaw-omo-cli/references/results-and-worktrees.md +23 -0
- package/src/skills/typeclaw-plugins/SKILL.md +20 -20
- package/src/skills/typeclaw-skills/SKILL.md +19 -2
- package/src/skills/typeclaw-troubleshooting/SKILL.md +15 -2
- package/src/tui/index.ts +5 -3
- package/src/tui/theme.ts +1 -1
- package/typeclaw.schema.json +44 -2
- package/src/agent/adaptive-thinking-compat.ts +0 -79
- package/src/secrets/claude-credentials-json.ts +0 -129
- package/src/secrets/codex-auth-json.ts +0 -102
- package/src/secrets/export-claude-credentials-file.ts +0 -270
- package/src/secrets/export-codex-auth-file.ts +0 -250
- package/src/secrets/oauth-xai.ts +0 -348
- package/src/skills/typeclaw-claude-code/references/stop-hook.md +0 -101
- package/src/skills/typeclaw-claude-code/references/tmux-driving.md +0 -243
- package/src/skills/typeclaw-codex-cli/references/stop-hook.md +0 -92
- package/src/skills/typeclaw-codex-cli/references/tmux-driving.md +0 -239
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { constants, createWriteStream, lstatSync, type Stats } from 'node:fs'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
chmod,
|
|
4
|
+
mkdir,
|
|
5
|
+
mkdtemp,
|
|
6
|
+
open,
|
|
7
|
+
readdir,
|
|
8
|
+
realpath,
|
|
9
|
+
rm,
|
|
10
|
+
stat,
|
|
11
|
+
unlink,
|
|
12
|
+
writeFile,
|
|
13
|
+
type FileHandle,
|
|
14
|
+
} from 'node:fs/promises'
|
|
3
15
|
import { tmpdir } from 'node:os'
|
|
4
16
|
import path from 'node:path'
|
|
5
17
|
import { Transform } from 'node:stream'
|
|
@@ -52,7 +64,16 @@ export const PINNED_SNAPSHOT_GLOBAL_MAX_BYTES = TOOL_INPUT_MAX_BYTES.channel_upl
|
|
|
52
64
|
export const PINNED_SNAPSHOT_GLOBAL_MAX_COUNT = TOOL_INPUT_MAX_COUNT.channel_upload
|
|
53
65
|
export const PINNED_SNAPSHOT_MAX_WAITERS = 32
|
|
54
66
|
const TOOL_OUTPUT_MAX_COUNT = 32
|
|
55
|
-
const TREE_SNAPSHOT_MAX_ENTRIES = 4096
|
|
67
|
+
export const TREE_SNAPSHOT_MAX_ENTRIES = 4096
|
|
68
|
+
// Names-only snapshots (ls/find) write empty placeholders, so an entry costs an
|
|
69
|
+
// inode, not a copy; a long-lived agent's workspace easily outgrows 4096.
|
|
70
|
+
const TREE_NAMES_SNAPSHOT_MAX_ENTRIES = 65_536
|
|
71
|
+
// fd reads these to honor ignore rules, so find needs their real contents.
|
|
72
|
+
const FIND_IGNORE_FILE_NAMES = new Set(['.gitignore', '.ignore', '.fdignore'])
|
|
73
|
+
// ripgrep's own binary heuristic: a NUL in the leading block. rg skips such
|
|
74
|
+
// files during recursive search, so grep snapshots them as empty placeholders.
|
|
75
|
+
// rg transcodes BOM-prefixed UTF-16 before that check, so those stay searchable.
|
|
76
|
+
const BINARY_SNIFF_BYTES = 8192
|
|
56
77
|
const AGENT_ROOT_SNAPSHOT_EXCLUDED_DIRS = new Set(['.git', '.gitstore', 'node_modules'])
|
|
57
78
|
|
|
58
79
|
export const TOOL_INPUT_TEMP_PREFIX = 'typeclaw-tool-input-'
|
|
@@ -107,6 +128,7 @@ export async function enforceAndPinToolFiles(
|
|
|
107
128
|
|
|
108
129
|
let dir: string | undefined
|
|
109
130
|
const rewrites: Rewrite[] = []
|
|
131
|
+
const omittedLinks: { root: string; count: number; names: string[] }[] = []
|
|
110
132
|
const verified: VerifiedInput[] = []
|
|
111
133
|
const maxBytes = maxInputBytes(options.tool)
|
|
112
134
|
const identityOptions = {
|
|
@@ -180,7 +202,7 @@ export async function enforceAndPinToolFiles(
|
|
|
180
202
|
await source.close()
|
|
181
203
|
}
|
|
182
204
|
} else {
|
|
183
|
-
|
|
205
|
+
const snapshot = await snapshotDirectoryTree({
|
|
184
206
|
source: input,
|
|
185
207
|
destination: pinned,
|
|
186
208
|
agentDir: options.agentDir,
|
|
@@ -192,6 +214,10 @@ export async function enforceAndPinToolFiles(
|
|
|
192
214
|
hidden: options.hidden,
|
|
193
215
|
signal: options.signal,
|
|
194
216
|
})
|
|
217
|
+
copiedBytes += snapshot.copied
|
|
218
|
+
if (snapshot.omittedLinks.count > 0) {
|
|
219
|
+
omittedLinks.push({ root: input.original, ...snapshot.omittedLinks })
|
|
220
|
+
}
|
|
195
221
|
}
|
|
196
222
|
const executionValue = input.target.uri ? pathToFileURL(pinned).href : pinned
|
|
197
223
|
input.target.set(executionValue)
|
|
@@ -215,7 +241,7 @@ export async function enforceAndPinToolFiles(
|
|
|
215
241
|
restoreResult(result) {
|
|
216
242
|
let restored = result
|
|
217
243
|
for (const rewrite of rewrites) restored = replaceResultPath(restored, rewrite)
|
|
218
|
-
return restored
|
|
244
|
+
return appendSnapshotOmissions(restored, omittedLinks)
|
|
219
245
|
},
|
|
220
246
|
async cleanup() {
|
|
221
247
|
if (cleaned) return
|
|
@@ -285,6 +311,9 @@ function fileTargets(
|
|
|
285
311
|
toolProvenance: ToolProvenance | undefined,
|
|
286
312
|
): FileTarget[] {
|
|
287
313
|
if (isOutputTool(tool)) return []
|
|
314
|
+
// This domain operation authorizes and snapshots the selected Git root inside
|
|
315
|
+
// its own credential-free sandbox. Generic file pinning cannot copy a repo.
|
|
316
|
+
if (tool === 'coding_agent' && toolProvenance === 'first-party') return []
|
|
288
317
|
if (toolProvenance === 'first-party' && TOOLS_WITHOUT_LOCAL_FILE_OPERANDS.has(tool)) return []
|
|
289
318
|
if (tool === 'read' && typeof args.path === 'string') return [propertyTarget(args, 'path')]
|
|
290
319
|
if (isTreeInputTool(tool)) {
|
|
@@ -824,7 +853,7 @@ export async function writeToolOutputNoFollow(targetPath: string, content: strin
|
|
|
824
853
|
}
|
|
825
854
|
}
|
|
826
855
|
|
|
827
|
-
async function createAndOpenAnchoredDirectory(absolute: string): Promise<FileHandle> {
|
|
856
|
+
export async function createAndOpenAnchoredDirectory(absolute: string, createMissing = true): Promise<FileHandle> {
|
|
828
857
|
if (!path.isAbsolute(absolute)) throw new Error(`anchored directory must be absolute: ${absolute}`)
|
|
829
858
|
const components = absolute.split(path.sep).filter(Boolean)
|
|
830
859
|
let current = await open(path.parse(absolute).root, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW)
|
|
@@ -835,7 +864,7 @@ async function createAndOpenAnchoredDirectory(absolute: string): Promise<FileHan
|
|
|
835
864
|
try {
|
|
836
865
|
next = await open(anchored, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW)
|
|
837
866
|
} catch (error) {
|
|
838
|
-
if (!isNotFoundError(error)) throw error
|
|
867
|
+
if (!isNotFoundError(error) || !createMissing) throw error
|
|
839
868
|
await mkdir(anchored, { mode: 0o700 })
|
|
840
869
|
next = await open(anchored, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW)
|
|
841
870
|
}
|
|
@@ -914,7 +943,7 @@ async function snapshotDirectoryTree(options: {
|
|
|
914
943
|
operandCount: number
|
|
915
944
|
hidden?: HiddenPaths
|
|
916
945
|
signal?: AbortSignal
|
|
917
|
-
}): Promise<number> {
|
|
946
|
+
}): Promise<{ copied: number; omittedLinks: { count: number; names: string[] } }> {
|
|
918
947
|
if (process.platform !== 'linux') {
|
|
919
948
|
throw new Error('directory tool inputs require Linux inode anchoring; refusing an unanchored traversal')
|
|
920
949
|
}
|
|
@@ -925,7 +954,12 @@ async function snapshotDirectoryTree(options: {
|
|
|
925
954
|
throw new Error(`tool input changed while waiting for snapshot capacity: ${options.source.original}`)
|
|
926
955
|
}
|
|
927
956
|
await mkdir(options.destination, { mode: 0o700 })
|
|
928
|
-
const state = {
|
|
957
|
+
const state = {
|
|
958
|
+
copied: 0,
|
|
959
|
+
entries: 0,
|
|
960
|
+
omittedLinks: { count: 0, names: [] as string[] },
|
|
961
|
+
mode: treeSnapshotMode(options.tool),
|
|
962
|
+
}
|
|
929
963
|
const identityVerifier = createPrivateSurfaceReadIdentityVerifier({
|
|
930
964
|
tool: options.tool,
|
|
931
965
|
agentDir: options.agentDir,
|
|
@@ -942,7 +976,7 @@ async function snapshotDirectoryTree(options: {
|
|
|
942
976
|
openedRoot === realAgentDir,
|
|
943
977
|
)
|
|
944
978
|
await chmod(options.destination, 0o500)
|
|
945
|
-
return state.copied
|
|
979
|
+
return { copied: state.copied, omittedLinks: state.omittedLinks }
|
|
946
980
|
} finally {
|
|
947
981
|
await root.close()
|
|
948
982
|
}
|
|
@@ -952,7 +986,12 @@ async function snapshotOpenedDirectory(
|
|
|
952
986
|
directory: FileHandle,
|
|
953
987
|
destination: string,
|
|
954
988
|
options: Parameters<typeof snapshotDirectoryTree>[0],
|
|
955
|
-
state: {
|
|
989
|
+
state: {
|
|
990
|
+
copied: number
|
|
991
|
+
entries: number
|
|
992
|
+
omittedLinks: { count: number; names: string[] }
|
|
993
|
+
mode: TreeSnapshotMode
|
|
994
|
+
},
|
|
956
995
|
identityVerifier: PrivateSurfaceIdentityVerifier,
|
|
957
996
|
isAgentRoot: boolean,
|
|
958
997
|
): Promise<void> {
|
|
@@ -963,15 +1002,22 @@ async function snapshotOpenedDirectory(
|
|
|
963
1002
|
if (options.signal?.aborted === true) throw abortError(options.signal)
|
|
964
1003
|
if (isAgentRoot && AGENT_ROOT_SNAPSHOT_EXCLUDED_DIRS.has(entry.name)) continue
|
|
965
1004
|
state.entries += 1
|
|
966
|
-
|
|
967
|
-
|
|
1005
|
+
const maxEntries = state.mode === 'contents' ? TREE_SNAPSHOT_MAX_ENTRIES : TREE_NAMES_SNAPSHOT_MAX_ENTRIES
|
|
1006
|
+
if (state.entries > maxEntries) {
|
|
1007
|
+
throw new Error(
|
|
1008
|
+
`directory snapshot exceeds entry limit (${state.entries} > ${maxEntries}); retry with a narrower path`,
|
|
1009
|
+
)
|
|
968
1010
|
}
|
|
969
1011
|
const anchored = `${sourceRoot}/${entry.name}`
|
|
970
1012
|
const target = path.join(destination, entry.name)
|
|
971
1013
|
const candidate = path.join(sourcePath, entry.name)
|
|
972
1014
|
if (entry.isSymbolicLink()) {
|
|
973
1015
|
if (isDeniedSnapshotPath(candidate, options)) continue
|
|
974
|
-
|
|
1016
|
+
state.omittedLinks.count += 1
|
|
1017
|
+
if (state.omittedLinks.names.length < 12) {
|
|
1018
|
+
state.omittedLinks.names.push(path.relative(options.source.resolved, candidate))
|
|
1019
|
+
}
|
|
1020
|
+
continue
|
|
975
1021
|
}
|
|
976
1022
|
if (entry.isDirectory()) {
|
|
977
1023
|
if (isDeniedSnapshotPath(candidate, options)) continue
|
|
@@ -980,7 +1026,10 @@ async function snapshotOpenedDirectory(
|
|
|
980
1026
|
const resolved = await realpath(`/proc/self/fd/${child.fd}`)
|
|
981
1027
|
if (isDeniedSnapshotPath(resolved, options)) continue
|
|
982
1028
|
await mkdir(target, { mode: 0o700 })
|
|
983
|
-
|
|
1029
|
+
// ls lists one level and only asks whether each entry is a directory.
|
|
1030
|
+
if (state.mode !== 'listing') {
|
|
1031
|
+
await snapshotOpenedDirectory(child, target, options, state, identityVerifier, false)
|
|
1032
|
+
}
|
|
984
1033
|
await chmod(target, 0o500)
|
|
985
1034
|
} finally {
|
|
986
1035
|
await child.close()
|
|
@@ -998,6 +1047,10 @@ async function snapshotOpenedDirectory(
|
|
|
998
1047
|
enforceInputIdentityDenial(identityVerifier, opened)
|
|
999
1048
|
const resolved = await realpath(`/proc/self/fd/${source.fd}`)
|
|
1000
1049
|
if (isDeniedSnapshotPath(resolved, options)) continue
|
|
1050
|
+
if (await snapshotsAsPlaceholder(source, candidate, state.mode)) {
|
|
1051
|
+
await writeFile(target, '', { flag: 'wx', mode: 0o400 })
|
|
1052
|
+
continue
|
|
1053
|
+
}
|
|
1001
1054
|
state.copied += await streamSnapshot(
|
|
1002
1055
|
source,
|
|
1003
1056
|
target,
|
|
@@ -1015,6 +1068,40 @@ async function snapshotOpenedDirectory(
|
|
|
1015
1068
|
}
|
|
1016
1069
|
}
|
|
1017
1070
|
|
|
1071
|
+
// contents: grep reads file bodies. names: find needs the tree plus ignore
|
|
1072
|
+
// files. listing: ls needs one level of names and directory-ness.
|
|
1073
|
+
type TreeSnapshotMode = 'contents' | 'names' | 'listing'
|
|
1074
|
+
|
|
1075
|
+
function treeSnapshotMode(tool: string): TreeSnapshotMode {
|
|
1076
|
+
if (tool === 'ls') return 'listing'
|
|
1077
|
+
if (tool === 'find') return 'names'
|
|
1078
|
+
return 'contents'
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
async function snapshotsAsPlaceholder(source: FileHandle, candidate: string, mode: TreeSnapshotMode): Promise<boolean> {
|
|
1082
|
+
if (mode === 'listing') return true
|
|
1083
|
+
if (mode === 'names') return !isFindIgnoreFile(candidate)
|
|
1084
|
+
const head = Buffer.alloc(BINARY_SNIFF_BYTES)
|
|
1085
|
+
const { bytesRead } = await source.read(head, 0, BINARY_SNIFF_BYTES, 0)
|
|
1086
|
+
const sniffed = head.subarray(0, bytesRead)
|
|
1087
|
+
if (hasUtf16Bom(sniffed)) return false
|
|
1088
|
+
return sniffed.includes(0)
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
function isFindIgnoreFile(candidate: string): boolean {
|
|
1092
|
+
if (FIND_IGNORE_FILE_NAMES.has(path.basename(candidate))) return true
|
|
1093
|
+
const parent = path.dirname(candidate)
|
|
1094
|
+
return (
|
|
1095
|
+
path.basename(candidate) === 'exclude' &&
|
|
1096
|
+
path.basename(parent) === 'info' &&
|
|
1097
|
+
path.basename(path.dirname(parent)) === '.git'
|
|
1098
|
+
)
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function hasUtf16Bom(head: Buffer): boolean {
|
|
1102
|
+
return head.length >= 2 && ((head[0] === 0xff && head[1] === 0xfe) || (head[0] === 0xfe && head[1] === 0xff))
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1018
1105
|
function assertRegularInputFile(stats: Stats, original: string): void {
|
|
1019
1106
|
if (!stats.isFile()) throw new Error(`tool input changed to a non-regular file before snapshot: ${original}`)
|
|
1020
1107
|
}
|
|
@@ -1222,6 +1309,18 @@ function outputCountTooLarge(count: number, maxCount: number): Error {
|
|
|
1222
1309
|
return new Error(`tool output count exceeds the per-invocation limit (${count} > ${maxCount})`)
|
|
1223
1310
|
}
|
|
1224
1311
|
|
|
1312
|
+
function appendSnapshotOmissions(
|
|
1313
|
+
result: ToolResult,
|
|
1314
|
+
omissions: readonly { root: string; count: number; names: string[] }[],
|
|
1315
|
+
): ToolResult {
|
|
1316
|
+
if (omissions.length === 0) return result
|
|
1317
|
+
const notes = omissions.map(({ root, count, names }) => {
|
|
1318
|
+
const remainder = count - names.length
|
|
1319
|
+
return `Directory snapshot omitted ${count} symbolic link${count === 1 ? '' : 's'} under ${JSON.stringify(root)} (not followed): ${names.map((name) => JSON.stringify(name)).join(', ')}${remainder > 0 ? `, and ${remainder} more` : ''}.`
|
|
1320
|
+
})
|
|
1321
|
+
return { ...result, content: [...result.content, { type: 'text', text: notes.join('\n') }] }
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1225
1324
|
function replaceResultPath(result: ToolResult, rewrite: Rewrite): ToolResult {
|
|
1226
1325
|
const content = result.content.map((part) =>
|
|
1227
1326
|
part.type === 'text' ? { ...part, text: part.text.split(rewrite.pinned).join(rewrite.original) } : part,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// testable with a hand-rolled fake and does not drag in the full session type.
|
|
4
4
|
export type NudgeableSession = {
|
|
5
5
|
subscribe: (listener: (event: unknown) => void) => () => void
|
|
6
|
-
steer: (text: string) => Promise<
|
|
6
|
+
steer: (text: string) => Promise<unknown>
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const NOT_FOUND_RE = /^Tool (.+?) not found$/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentTool } from '@
|
|
2
|
-
import type { ToolDefinition } from '@
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core'
|
|
2
|
+
import type { ToolDefinition } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
import type { TSchema } from 'typebox'
|
|
4
4
|
|
|
5
5
|
// Subagents that read large files (memory-logger and dreaming each read parent
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
4
|
import type { ChannelRouter } from '@/channels/router'
|
|
5
5
|
import type { AdapterId } from '@/channels/schema'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, sep } from 'node:path'
|
|
2
2
|
|
|
3
|
-
import { Type } from '@
|
|
4
|
-
import { defineTool } from '@
|
|
3
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
4
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
5
5
|
|
|
6
6
|
import type { SessionOrigin } from '@/agent/session-origin'
|
|
7
7
|
import { TOOL_INPUT_MAX_BYTES, writeFileAnchored } from '@/agent/tool-file-safety'
|
|
@@ -17,5 +17,6 @@ export function renderHistoryMessages(messages: readonly ChannelHistoryMessage[]
|
|
|
17
17
|
export function renderHistoryMessage(m: ChannelHistoryMessage): string {
|
|
18
18
|
const iso = m.ts > 0 ? new Date(m.ts).toISOString() : 'unknown-time'
|
|
19
19
|
const who = m.isBot ? `BOT (${m.authorName})` : `${m.authorName} (<@${m.authorId}>)`
|
|
20
|
-
|
|
20
|
+
const messageId = m.externalMessageId ? ` [message_id=${m.externalMessageId}]` : ''
|
|
21
|
+
return `[${iso}]${messageId} ${who}: ${m.text}`
|
|
21
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
4
|
import type { ChannelRouter } from '@/channels/router'
|
|
5
5
|
import type { AdapterId } from '@/channels/schema'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
4
|
import type { ChannelRouter } from '@/channels/router'
|
|
5
5
|
import type { AdapterId } from '@/channels/schema'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
4
|
import type { ChannelRouter } from '@/channels/router'
|
|
5
5
|
import { ADAPTER_IDS, type AdapterId } from '@/channels/schema'
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
|
+
import type { BackgroundObligationRef } from '@/channels/background-obligations'
|
|
4
5
|
import { checkCompletionClaim } from '@/channels/completion-claim'
|
|
5
6
|
import { checkFalseReceipt } from '@/channels/github-false-receipt'
|
|
6
7
|
import { evaluateRereviewGuard } from '@/channels/github-rereview-guard'
|
|
8
|
+
import type { InboundRef } from '@/channels/inbound-journal'
|
|
7
9
|
import {
|
|
8
10
|
containsKimiToolDelimiter,
|
|
9
11
|
isNoReplySignal,
|
|
@@ -58,10 +60,10 @@ export function createChannelReplyTool({
|
|
|
58
60
|
'addressing fields (adapter, workspace, chat, thread) are filled in from the session origin, so ' +
|
|
59
61
|
'you only supply the text. To post somewhere else (different chat, break out of the current ' +
|
|
60
62
|
'thread, etc.), use `channel_send` instead. ' +
|
|
61
|
-
'On success the result carries
|
|
62
|
-
'
|
|
63
|
-
'`channel_send`
|
|
64
|
-
'
|
|
63
|
+
'On success the result carries adapter-reported posted-message ids (`messageId` and `messageIds` ' +
|
|
64
|
+
'in send order) when available. For follow-ups, reuse `channel_reply` or the existing ' +
|
|
65
|
+
'`channel_send` thread/root coordinates; a returned id starts a thread only where the adapter ' +
|
|
66
|
+
'accepts a message id as `thread` (e.g. a new top-level Slack post).',
|
|
65
67
|
parameters: Type.Object({
|
|
66
68
|
text: Type.Optional(
|
|
67
69
|
Type.String({
|
|
@@ -70,6 +72,12 @@ export function createChannelReplyTool({
|
|
|
70
72
|
minLength: 1,
|
|
71
73
|
}),
|
|
72
74
|
),
|
|
75
|
+
link_previews: Type.Optional(
|
|
76
|
+
Type.Boolean({
|
|
77
|
+
description:
|
|
78
|
+
'Set false to suppress link/media previews on Slack bot and Telegram bot text replies. True or omitted preserves platform defaults. Ignored on other adapters. Slack file-upload captions are not covered.',
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
73
81
|
attachments: Type.Optional(
|
|
74
82
|
Type.Array(
|
|
75
83
|
Type.Object({
|
|
@@ -291,12 +299,15 @@ export function createChannelReplyTool({
|
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
|
|
302
|
+
const backgroundCoverage = (await router.captureBackgroundResultCoverage?.(sessionId)) ?? []
|
|
303
|
+
const inboundCoverage = (await router.captureInboundResultCoverage?.(sessionId)) ?? []
|
|
294
304
|
const result = await router.send({
|
|
295
305
|
adapter: origin.adapter,
|
|
296
306
|
workspace: origin.workspace,
|
|
297
307
|
chat: origin.chat,
|
|
298
308
|
thread: origin.thread,
|
|
299
309
|
...(text !== undefined ? { text } : {}),
|
|
310
|
+
...(params.link_previews !== undefined ? { link_previews: params.link_previews } : {}),
|
|
300
311
|
...(attachments !== undefined ? { attachments } : {}),
|
|
301
312
|
})
|
|
302
313
|
|
|
@@ -332,9 +343,13 @@ export function createChannelReplyTool({
|
|
|
332
343
|
more_work_this_turn?: boolean
|
|
333
344
|
messageId?: string
|
|
334
345
|
messageIds?: readonly string[]
|
|
346
|
+
backgroundCoverage?: BackgroundObligationRef[]
|
|
347
|
+
inboundCoverage?: InboundRef[]
|
|
335
348
|
} = result.ok
|
|
336
349
|
? {
|
|
337
350
|
ok: true,
|
|
351
|
+
backgroundCoverage,
|
|
352
|
+
inboundCoverage,
|
|
338
353
|
...(keepTurnAlive ? { more_work_this_turn: true } : {}),
|
|
339
354
|
...(result.messageId !== undefined ? { messageId: result.messageId } : {}),
|
|
340
355
|
...(result.messageIds !== undefined ? { messageIds: result.messageIds } : {}),
|
|
@@ -358,7 +373,10 @@ export function createChannelReplyTool({
|
|
|
358
373
|
// prose (just machine error text), so they keep the lighter prefix.
|
|
359
374
|
if (result.ok) {
|
|
360
375
|
const echo = renderOutboundEcho(text, attachments)
|
|
361
|
-
const receipt =
|
|
376
|
+
const receipt =
|
|
377
|
+
`posted to ${origin.adapter}:${origin.workspace}/${origin.chat}: ${echo}` +
|
|
378
|
+
(result.messageId !== undefined ? `\nmessage_id=${JSON.stringify(result.messageId)}` : '') +
|
|
379
|
+
(result.messageIds !== undefined ? `\nmessage_ids=${JSON.stringify(result.messageIds)}` : '')
|
|
362
380
|
const hint = consecutiveSendHint(
|
|
363
381
|
router.getConsecutiveSendCount({
|
|
364
382
|
adapter: origin.adapter,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
|
+
import type { BackgroundObligationRef } from '@/channels/background-obligations'
|
|
4
5
|
import { checkFalseReceipt } from '@/channels/github-false-receipt'
|
|
5
6
|
import { evaluateRereviewGuard } from '@/channels/github-rereview-guard'
|
|
6
7
|
import { recordResolvedThread } from '@/channels/github-review-turn-ledger'
|
|
8
|
+
import type { InboundRef } from '@/channels/inbound-journal'
|
|
7
9
|
import {
|
|
8
10
|
containsKimiToolDelimiter,
|
|
9
11
|
isNoReplySignal,
|
|
@@ -55,11 +57,12 @@ export function createChannelSendTool({
|
|
|
55
57
|
'For Discord guild channels, workspace is the guild id; for Slack team channels, workspace is ' +
|
|
56
58
|
'the team id (e.g. "T0ACME"). For DMs on either platform, workspace is the literal "@dm". ' +
|
|
57
59
|
'On failure (no adapter registered, or the adapter-level send failed), the call returns ' +
|
|
58
|
-
'{ ok: false, error }. On success it returns { ok: true } and, when
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
60
|
+
'{ ok: false, error }. On success it returns { ok: true } and, when reported, `messageId` ' +
|
|
61
|
+
'(an adapter-reported id of a posted message) and `messageIds` (reported posted-message ids in ' +
|
|
62
|
+
'send order). To continue the same conversation, reuse its existing `thread`/root coordinates ' +
|
|
63
|
+
'or use `channel_reply`. A returned id starts a thread only where the adapter accepts a message ' +
|
|
64
|
+
'id as `thread` (e.g. a new top-level Slack post); other adapters use different thread ids. ' +
|
|
65
|
+
'Some adapters do not report ids. ' +
|
|
63
66
|
'There is no auto-reply: the only way for an agent to post is via this tool.',
|
|
64
67
|
parameters: Type.Object({
|
|
65
68
|
adapter: Type.Union(
|
|
@@ -90,6 +93,12 @@ export function createChannelSendTool({
|
|
|
90
93
|
minLength: 1,
|
|
91
94
|
}),
|
|
92
95
|
),
|
|
96
|
+
link_previews: Type.Optional(
|
|
97
|
+
Type.Boolean({
|
|
98
|
+
description:
|
|
99
|
+
'Set false to suppress link/media previews on Slack bot and Telegram bot text posts. True or omitted preserves platform defaults. Ignored on other adapters. Slack file-upload captions are not covered.',
|
|
100
|
+
}),
|
|
101
|
+
),
|
|
93
102
|
attachments: Type.Optional(
|
|
94
103
|
Type.Array(
|
|
95
104
|
Type.Object({
|
|
@@ -304,12 +313,31 @@ export function createChannelSendTool({
|
|
|
304
313
|
}
|
|
305
314
|
}
|
|
306
315
|
|
|
316
|
+
// An answer posted to this session's exact origin conversation fulfills the
|
|
317
|
+
// same debt channel_reply would, so capture the invoking session's owned
|
|
318
|
+
// coverage before the send (mirrors channel_reply). Any other destination —
|
|
319
|
+
// a different thread, the root instead of the origin thread, another chat,
|
|
320
|
+
// workspace or adapter — and sessions without a channel origin capture
|
|
321
|
+
// nothing: posting elsewhere must never settle, or borrow, an inbound's debt.
|
|
322
|
+
const thread = params.thread ?? null
|
|
323
|
+
const settlesOrigin =
|
|
324
|
+
origin !== undefined &&
|
|
325
|
+
sessionId !== '' &&
|
|
326
|
+
origin.adapter === adapter &&
|
|
327
|
+
origin.workspace === params.workspace &&
|
|
328
|
+
origin.chat === params.chat &&
|
|
329
|
+
origin.thread === thread
|
|
330
|
+
const backgroundCoverage = settlesOrigin
|
|
331
|
+
? ((await router.captureBackgroundResultCoverage?.(sessionId)) ?? [])
|
|
332
|
+
: []
|
|
333
|
+
const inboundCoverage = settlesOrigin ? ((await router.captureInboundResultCoverage?.(sessionId)) ?? []) : []
|
|
307
334
|
const result = await router.send({
|
|
308
335
|
adapter,
|
|
309
336
|
workspace: params.workspace,
|
|
310
337
|
chat: params.chat,
|
|
311
338
|
...(params.thread !== undefined ? { thread: params.thread } : {}),
|
|
312
339
|
...(bodyText !== undefined ? { text: bodyText } : {}),
|
|
340
|
+
...(params.link_previews !== undefined ? { link_previews: params.link_previews } : {}),
|
|
313
341
|
...(attachments !== undefined ? { attachments } : {}),
|
|
314
342
|
})
|
|
315
343
|
|
|
@@ -336,9 +364,20 @@ export function createChannelSendTool({
|
|
|
336
364
|
decision: 'left-open',
|
|
337
365
|
})
|
|
338
366
|
}
|
|
339
|
-
|
|
367
|
+
// Captured refs travel only with an actual landed send; the router's
|
|
368
|
+
// after-tool hook settles exactly these generations. A status/progress body
|
|
369
|
+
// is still returned here and left owed by that hook.
|
|
370
|
+
const details: {
|
|
371
|
+
ok: boolean
|
|
372
|
+
error?: string
|
|
373
|
+
messageId?: string
|
|
374
|
+
messageIds?: readonly string[]
|
|
375
|
+
backgroundCoverage?: BackgroundObligationRef[]
|
|
376
|
+
inboundCoverage?: InboundRef[]
|
|
377
|
+
} = result.ok
|
|
340
378
|
? {
|
|
341
379
|
ok: true,
|
|
380
|
+
...(settlesOrigin ? { backgroundCoverage, inboundCoverage } : {}),
|
|
342
381
|
...(result.messageId !== undefined ? { messageId: result.messageId } : {}),
|
|
343
382
|
...(result.messageIds !== undefined ? { messageIds: result.messageIds } : {}),
|
|
344
383
|
}
|
|
@@ -348,7 +387,10 @@ export function createChannelSendTool({
|
|
|
348
387
|
// rationale (PR #481 self-reply loop).
|
|
349
388
|
if (result.ok) {
|
|
350
389
|
const echo = renderOutboundEcho(bodyText, attachments)
|
|
351
|
-
const receipt =
|
|
390
|
+
const receipt =
|
|
391
|
+
`posted to ${params.adapter}:${params.workspace}/${params.chat}: ${echo}` +
|
|
392
|
+
(result.messageId !== undefined ? `\nmessage_id=${JSON.stringify(result.messageId)}` : '') +
|
|
393
|
+
(result.messageIds !== undefined ? `\nmessage_ids=${JSON.stringify(result.messageIds)}` : '')
|
|
352
394
|
const hints: string[] = []
|
|
353
395
|
const consecutive = consecutiveSendHint(
|
|
354
396
|
router.getConsecutiveSendCount({
|
|
@@ -22,6 +22,9 @@ import { randomBytes } from 'node:crypto'
|
|
|
22
22
|
|
|
23
23
|
import { spawn } from 'bun'
|
|
24
24
|
|
|
25
|
+
import { readOomEvents, toolOomNote } from '@/container/oom-events'
|
|
26
|
+
import { withToolOomPriorityArgv } from '@/container/tool-oom-priority'
|
|
27
|
+
|
|
25
28
|
export const CURL_IMPERSONATE_BINARY = 'curl_chrome136'
|
|
26
29
|
export const DEFAULT_TIMEOUT_SECONDS = 30
|
|
27
30
|
|
|
@@ -192,8 +195,9 @@ export async function curlImpersonate(req: CurlImpersonateRequest): Promise<Curl
|
|
|
192
195
|
// a 30s hang. process.kill(-pid) addresses the negative PID, which signals
|
|
193
196
|
// the entire process group, killing both atomically. detached: true makes
|
|
194
197
|
// the child the pgid leader so -pid is well-defined.
|
|
198
|
+
const oomBefore = readOomEvents()
|
|
195
199
|
const proc = spawn({
|
|
196
|
-
cmd,
|
|
200
|
+
cmd: withToolOomPriorityArgv(cmd),
|
|
197
201
|
stdout: 'pipe',
|
|
198
202
|
stderr: 'pipe',
|
|
199
203
|
detached: true,
|
|
@@ -219,9 +223,14 @@ export async function curlImpersonate(req: CurlImpersonateRequest): Promise<Curl
|
|
|
219
223
|
throw new CurlImpersonateError('aborted', exitCode, stderr)
|
|
220
224
|
}
|
|
221
225
|
|
|
226
|
+
const oomNote = toolOomNote(oomBefore, exitCode, 'web search', { log: (line) => console.warn(line) })
|
|
222
227
|
if (exitCode !== 0) {
|
|
223
228
|
const detail = stderr.trim() || 'no stderr'
|
|
224
|
-
throw new CurlImpersonateError(
|
|
229
|
+
throw new CurlImpersonateError(
|
|
230
|
+
`curl-impersonate exited ${exitCode}: ${detail}${oomNote === null ? '' : `\n${oomNote}`}`,
|
|
231
|
+
exitCode,
|
|
232
|
+
stderr,
|
|
233
|
+
)
|
|
225
234
|
}
|
|
226
235
|
|
|
227
236
|
return parseCurlOutput(stdoutBuf, sentinel, stderr)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from '@
|
|
2
|
-
import { defineTool } from '@
|
|
1
|
+
import { Type } from '@earendil-works/pi-ai'
|
|
2
|
+
import { defineTool } from '@earendil-works/pi-coding-agent'
|
|
3
3
|
|
|
4
4
|
import { MEMBERSHIP_FRESHNESS_MS, type MembershipCount } from '@/channels/membership'
|
|
5
5
|
import {
|