@sixb/agent 0.2.4 → 0.2.6
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/README.md +2 -2
- package/dist/agent-prompt.d.ts +13 -3
- package/dist/agent-prompt.d.ts.map +1 -1
- package/dist/artifacts/layout-check/layout-check.d.ts +21 -24
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -1
- package/dist/artifacts/publish-tool.d.ts.map +1 -1
- package/dist/background-commands.d.ts +2 -2
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/conversation-messages.d.ts +1 -1
- package/dist/conversation-messages.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11082 -9281
- package/dist/index.js.map +37 -33
- package/dist/login-shell.d.ts +18 -2
- package/dist/login-shell.d.ts.map +1 -1
- package/dist/model-adapters.d.ts +5 -2
- package/dist/model-adapters.d.ts.map +1 -1
- package/dist/model-lines.d.ts +1 -0
- package/dist/model-lines.d.ts.map +1 -1
- package/dist/run-agent-turn.d.ts +3 -14
- package/dist/run-agent-turn.d.ts.map +1 -1
- package/dist/run-conversation-turn.d.ts.map +1 -1
- package/dist/run-environment.d.ts.map +1 -1
- package/dist/run-sandbox.d.ts +11 -1
- package/dist/run-sandbox.d.ts.map +1 -1
- package/dist/run-subagent.d.ts.map +1 -1
- package/dist/sandbox-api-context.d.ts.map +1 -1
- package/dist/search-script.d.ts +7 -0
- package/dist/search-script.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts.map +1 -1
- package/dist/subagent-tools.d.ts +11 -1
- package/dist/subagent-tools.d.ts.map +1 -1
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/glob.d.ts +41 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/grep.d.ts +64 -0
- package/dist/tools/grep.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts.map +1 -1
- package/dist/tools/sandbox-search.d.ts +26 -0
- package/dist/tools/sandbox-search.d.ts.map +1 -0
- package/dist/tools/search/command.d.ts +15 -0
- package/dist/tools/search/command.d.ts.map +1 -0
- package/dist/tools/search/gitignore.d.ts +28 -0
- package/dist/tools/search/gitignore.d.ts.map +1 -0
- package/dist/tools/search/glob.d.ts +15 -0
- package/dist/tools/search/glob.d.ts.map +1 -0
- package/dist/tools/search/main.d.ts +2 -0
- package/dist/tools/search/main.d.ts.map +1 -0
- package/dist/tools/search/match.d.ts +30 -0
- package/dist/tools/search/match.d.ts.map +1 -0
- package/dist/tools/search/pattern.d.ts +19 -0
- package/dist/tools/search/pattern.d.ts.map +1 -0
- package/dist/tools/search/read.d.ts +62 -0
- package/dist/tools/search/read.d.ts.map +1 -0
- package/dist/tools/search/request.d.ts +80 -0
- package/dist/tools/search/request.d.ts.map +1 -0
- package/dist/tools/search/search.d.ts +4 -0
- package/dist/tools/search/search.d.ts.map +1 -0
- package/dist/tools/search/walk.d.ts +43 -0
- package/dist/tools/search/walk.d.ts.map +1 -0
- package/dist/tools/tool-outputs.d.ts.map +1 -1
- package/dist/turn-inbox.d.ts +75 -0
- package/dist/turn-inbox.d.ts.map +1 -0
- package/package.json +7 -5
- package/src/agent-prompt.ts +63 -28
- package/src/agent-runtime/preflight.ts +1 -0
- package/src/artifacts/layout-check/check.cjs +176 -95
- package/src/artifacts/layout-check/layout-check.ts +118 -76
- package/src/artifacts/publish-tool.ts +48 -99
- package/src/background-commands.ts +8 -6
- package/src/context-compaction.ts +1 -0
- package/src/conversation-messages.ts +11 -4
- package/src/generated/search.mjs +985 -0
- package/src/index.ts +0 -1
- package/src/login-shell.ts +30 -3
- package/src/model-adapters.ts +23 -4
- package/src/model-lines.ts +1 -1
- package/src/run-agent-turn.ts +85 -129
- package/src/run-conversation-turn.ts +15 -6
- package/src/run-environment.ts +42 -11
- package/src/run-sandbox.ts +60 -1
- package/src/run-subagent.ts +9 -2
- package/src/sandbox-api-context.ts +10 -1
- package/src/search-script-assets.d.ts +5 -0
- package/src/search-script.ts +9 -0
- package/src/skills/built-in.ts +16 -0
- package/src/skills/sixb-artifacts/SKILL.md +7 -7
- package/src/skills/sixb-artifacts/canvas.md +3 -2
- package/src/skills/sixb-artifacts/document.md +92 -5
- package/src/skills/sixb-artifacts/examples/document/service-proposal/design.css +114 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/document.html +159 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/images/fieldwise.svg +1 -0
- package/src/skills/sixb-artifacts/examples/document/service-proposal/images/harbor-pine.svg +1 -0
- package/src/skills/sixb-artifacts/queries.md +2 -1
- package/src/subagent-tools.ts +23 -5
- package/src/tools/bash.ts +9 -10
- package/src/tools/glob.ts +124 -0
- package/src/tools/grep.ts +190 -0
- package/src/tools/model-spec.ts +4 -0
- package/src/tools/sandbox-search.ts +219 -0
- package/src/tools/search/command.ts +116 -0
- package/src/tools/search/gitignore.ts +101 -0
- package/src/tools/search/glob.ts +90 -0
- package/src/tools/search/main.ts +9 -0
- package/src/tools/search/match.ts +278 -0
- package/src/tools/search/pattern.ts +178 -0
- package/src/tools/search/read.ts +237 -0
- package/src/tools/search/request.ts +101 -0
- package/src/tools/search/search.ts +297 -0
- package/src/tools/search/walk.ts +145 -0
- package/src/tools/tool-outputs.ts +7 -2
- package/src/turn-inbox.ts +283 -0
- package/dist/artifacts/board-previews.d.ts +0 -41
- package/dist/artifacts/board-previews.d.ts.map +0 -1
- package/src/artifacts/board-previews.ts +0 -218
|
@@ -2,7 +2,7 @@ import { randomBytes } from "node:crypto"
|
|
|
2
2
|
import { posix } from "node:path"
|
|
3
3
|
import { AgentToolPublicError, type CommandResult, type Sandbox } from "@sixb/core"
|
|
4
4
|
import { waitForAbort } from "./abort"
|
|
5
|
-
import {
|
|
5
|
+
import { commandDirectory, LOGIN_SHELL_SCRIPT_IN_DIRECTORY } from "./login-shell"
|
|
6
6
|
import { type AgentSandboxHandle, contextPath } from "./sandbox-handle"
|
|
7
7
|
|
|
8
8
|
// A background command runs in the call that starts it, held open until it ends: a provider that
|
|
@@ -116,8 +116,8 @@ export class BackgroundCommands {
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Start `command` in the background and return once it runs, its output going to its file. One
|
|
119
|
-
* the sandbox could not start
|
|
120
|
-
* `signal` that aborts before then stops it.
|
|
119
|
+
* the sandbox could not start throws what it said; a directory that does not exist is not one,
|
|
120
|
+
* as the command's shell changes to it. A `signal` that aborts before then stops it.
|
|
121
121
|
*/
|
|
122
122
|
async start(input: {
|
|
123
123
|
readonly handle: AgentSandboxHandle
|
|
@@ -155,10 +155,10 @@ export class BackgroundCommands {
|
|
|
155
155
|
paths.pid,
|
|
156
156
|
paths.exit,
|
|
157
157
|
nonce,
|
|
158
|
+
commandDirectory(sandbox.workingDirectory, input.cwd) ?? sandbox.workingDirectory,
|
|
158
159
|
input.command,
|
|
159
160
|
],
|
|
160
161
|
{
|
|
161
|
-
...(input.cwd === undefined ? {} : { cwd: input.cwd }),
|
|
162
162
|
...(handle.env === undefined ? {} : { env: handle.env }),
|
|
163
163
|
timeout: HELD_TIMEOUT_MS,
|
|
164
164
|
signal: abort.signal,
|
|
@@ -483,12 +483,14 @@ const SIGNAL_SCRIPT = 'kill -s "$1" -- "-$2" 2>/dev/null'
|
|
|
483
483
|
/**
|
|
484
484
|
* Started detached from the held call's own output, in a process group of its own (`set -m`: no
|
|
485
485
|
* `setsid` binary on macOS), its pid written first with the start's nonce, then its exit code once
|
|
486
|
-
* it ended. Its exit is the wrapper's.
|
|
486
|
+
* it ended. Its exit is the wrapper's. Its shell changes to the directory itself: one that does not
|
|
487
|
+
* exist ends it with code 1 and bash's message in its output. Arguments: output, pid and exit
|
|
488
|
+
* files, nonce, directory, command.
|
|
487
489
|
*/
|
|
488
490
|
const START_SCRIPT = `mkdir -p -- "$(dirname -- "$1")" || exit 1
|
|
489
491
|
: > "$1" && rm -f -- "$3" || exit 1
|
|
490
492
|
set -m
|
|
491
|
-
bash -lc '${
|
|
493
|
+
bash -lc '${LOGIN_SHELL_SCRIPT_IN_DIRECTORY}' bash "$5" "$6" < /dev/null >> "$1" 2>&1 &
|
|
492
494
|
pid=$!
|
|
493
495
|
set +m
|
|
494
496
|
echo "$4 $pid" > "$2.tmp" && mv -f -- "$2.tmp" "$2"
|
|
@@ -374,6 +374,7 @@ function conversationEstimateShape(
|
|
|
374
374
|
...(authors?.section === undefined ? {} : { conversation: authors.section }),
|
|
375
375
|
...(plan.sandboxModels ? { sandboxModels: plan.sandboxModels } : {}),
|
|
376
376
|
...(memory ? { memory: memory.prompt } : {}),
|
|
377
|
+
runningModel: plan.model,
|
|
377
378
|
}),
|
|
378
379
|
authors ? conversationAuthorsText(authors) : "",
|
|
379
380
|
].join("\n"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toModelMessages } from "@sixb/core/internal/agents"
|
|
2
2
|
import type { ModelCachingIntent, ModelMessage, ModelReasoning } from "@sixb/core/models"
|
|
3
|
-
import type
|
|
3
|
+
import { renderWorkspaceMovedTag, type SentSettings } from "./agent-prompt"
|
|
4
4
|
import {
|
|
5
5
|
attachmentKey,
|
|
6
6
|
type PreparedAgentAttachmentContext,
|
|
@@ -28,6 +28,9 @@ export function conversationModelMessages(input: {
|
|
|
28
28
|
}): ModelMessage[] {
|
|
29
29
|
const { threadContext, attachmentContext } = input
|
|
30
30
|
const sentTimes = userMessageTimes(threadContext.history, input.project)
|
|
31
|
+
const movedIds = threadContext.history.movedMessageIds
|
|
32
|
+
? new Set(threadContext.history.movedMessageIds)
|
|
33
|
+
: undefined
|
|
31
34
|
const authors = input.conversation
|
|
32
35
|
? conversationAuthors({
|
|
33
36
|
conversation: input.conversation,
|
|
@@ -36,12 +39,16 @@ export function conversationModelMessages(input: {
|
|
|
36
39
|
: undefined
|
|
37
40
|
|
|
38
41
|
return toModelMessages(threadContext.modelMessages, {
|
|
39
|
-
//
|
|
40
|
-
//
|
|
42
|
+
// Workspace transition, then when, then who wrote it: `<sixb_author>` stays the message's last
|
|
43
|
+
// tag, and every piece comes from stored data so cached prefixes stay byte-exact across moves.
|
|
41
44
|
userMessageSuffix: (message) => {
|
|
42
45
|
if (!message.id) return undefined
|
|
43
46
|
|
|
44
|
-
const closing = [
|
|
47
|
+
const closing = [
|
|
48
|
+
movedIds?.has(message.id) ? renderWorkspaceMovedTag() : undefined,
|
|
49
|
+
sentTimes.get(message.id),
|
|
50
|
+
authors?.byMessageId.get(message.id),
|
|
51
|
+
]
|
|
45
52
|
return closing.filter(Boolean).join("\n") || undefined
|
|
46
53
|
},
|
|
47
54
|
fileText: ({ message, partIndex }) =>
|