@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.
Files changed (117) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-prompt.d.ts +13 -3
  3. package/dist/agent-prompt.d.ts.map +1 -1
  4. package/dist/artifacts/layout-check/layout-check.d.ts +21 -24
  5. package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -1
  6. package/dist/artifacts/publish-tool.d.ts.map +1 -1
  7. package/dist/background-commands.d.ts +2 -2
  8. package/dist/context-compaction.d.ts.map +1 -1
  9. package/dist/conversation-messages.d.ts +1 -1
  10. package/dist/conversation-messages.d.ts.map +1 -1
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +11082 -9281
  14. package/dist/index.js.map +37 -33
  15. package/dist/login-shell.d.ts +18 -2
  16. package/dist/login-shell.d.ts.map +1 -1
  17. package/dist/model-adapters.d.ts +5 -2
  18. package/dist/model-adapters.d.ts.map +1 -1
  19. package/dist/model-lines.d.ts +1 -0
  20. package/dist/model-lines.d.ts.map +1 -1
  21. package/dist/run-agent-turn.d.ts +3 -14
  22. package/dist/run-agent-turn.d.ts.map +1 -1
  23. package/dist/run-conversation-turn.d.ts.map +1 -1
  24. package/dist/run-environment.d.ts.map +1 -1
  25. package/dist/run-sandbox.d.ts +11 -1
  26. package/dist/run-sandbox.d.ts.map +1 -1
  27. package/dist/run-subagent.d.ts.map +1 -1
  28. package/dist/sandbox-api-context.d.ts.map +1 -1
  29. package/dist/search-script.d.ts +7 -0
  30. package/dist/search-script.d.ts.map +1 -0
  31. package/dist/skills/built-in.d.ts.map +1 -1
  32. package/dist/subagent-tools.d.ts +11 -1
  33. package/dist/subagent-tools.d.ts.map +1 -1
  34. package/dist/tools/bash.d.ts +1 -1
  35. package/dist/tools/bash.d.ts.map +1 -1
  36. package/dist/tools/glob.d.ts +41 -0
  37. package/dist/tools/glob.d.ts.map +1 -0
  38. package/dist/tools/grep.d.ts +64 -0
  39. package/dist/tools/grep.d.ts.map +1 -0
  40. package/dist/tools/model-spec.d.ts.map +1 -1
  41. package/dist/tools/sandbox-search.d.ts +26 -0
  42. package/dist/tools/sandbox-search.d.ts.map +1 -0
  43. package/dist/tools/search/command.d.ts +15 -0
  44. package/dist/tools/search/command.d.ts.map +1 -0
  45. package/dist/tools/search/gitignore.d.ts +28 -0
  46. package/dist/tools/search/gitignore.d.ts.map +1 -0
  47. package/dist/tools/search/glob.d.ts +15 -0
  48. package/dist/tools/search/glob.d.ts.map +1 -0
  49. package/dist/tools/search/main.d.ts +2 -0
  50. package/dist/tools/search/main.d.ts.map +1 -0
  51. package/dist/tools/search/match.d.ts +30 -0
  52. package/dist/tools/search/match.d.ts.map +1 -0
  53. package/dist/tools/search/pattern.d.ts +19 -0
  54. package/dist/tools/search/pattern.d.ts.map +1 -0
  55. package/dist/tools/search/read.d.ts +62 -0
  56. package/dist/tools/search/read.d.ts.map +1 -0
  57. package/dist/tools/search/request.d.ts +80 -0
  58. package/dist/tools/search/request.d.ts.map +1 -0
  59. package/dist/tools/search/search.d.ts +4 -0
  60. package/dist/tools/search/search.d.ts.map +1 -0
  61. package/dist/tools/search/walk.d.ts +43 -0
  62. package/dist/tools/search/walk.d.ts.map +1 -0
  63. package/dist/tools/tool-outputs.d.ts.map +1 -1
  64. package/dist/turn-inbox.d.ts +75 -0
  65. package/dist/turn-inbox.d.ts.map +1 -0
  66. package/package.json +7 -5
  67. package/src/agent-prompt.ts +63 -28
  68. package/src/agent-runtime/preflight.ts +1 -0
  69. package/src/artifacts/layout-check/check.cjs +176 -95
  70. package/src/artifacts/layout-check/layout-check.ts +118 -76
  71. package/src/artifacts/publish-tool.ts +48 -99
  72. package/src/background-commands.ts +8 -6
  73. package/src/context-compaction.ts +1 -0
  74. package/src/conversation-messages.ts +11 -4
  75. package/src/generated/search.mjs +985 -0
  76. package/src/index.ts +0 -1
  77. package/src/login-shell.ts +30 -3
  78. package/src/model-adapters.ts +23 -4
  79. package/src/model-lines.ts +1 -1
  80. package/src/run-agent-turn.ts +85 -129
  81. package/src/run-conversation-turn.ts +15 -6
  82. package/src/run-environment.ts +42 -11
  83. package/src/run-sandbox.ts +60 -1
  84. package/src/run-subagent.ts +9 -2
  85. package/src/sandbox-api-context.ts +10 -1
  86. package/src/search-script-assets.d.ts +5 -0
  87. package/src/search-script.ts +9 -0
  88. package/src/skills/built-in.ts +16 -0
  89. package/src/skills/sixb-artifacts/SKILL.md +7 -7
  90. package/src/skills/sixb-artifacts/canvas.md +3 -2
  91. package/src/skills/sixb-artifacts/document.md +92 -5
  92. package/src/skills/sixb-artifacts/examples/document/service-proposal/design.css +114 -0
  93. package/src/skills/sixb-artifacts/examples/document/service-proposal/document.html +159 -0
  94. package/src/skills/sixb-artifacts/examples/document/service-proposal/images/fieldwise.svg +1 -0
  95. package/src/skills/sixb-artifacts/examples/document/service-proposal/images/harbor-pine.svg +1 -0
  96. package/src/skills/sixb-artifacts/queries.md +2 -1
  97. package/src/subagent-tools.ts +23 -5
  98. package/src/tools/bash.ts +9 -10
  99. package/src/tools/glob.ts +124 -0
  100. package/src/tools/grep.ts +190 -0
  101. package/src/tools/model-spec.ts +4 -0
  102. package/src/tools/sandbox-search.ts +219 -0
  103. package/src/tools/search/command.ts +116 -0
  104. package/src/tools/search/gitignore.ts +101 -0
  105. package/src/tools/search/glob.ts +90 -0
  106. package/src/tools/search/main.ts +9 -0
  107. package/src/tools/search/match.ts +278 -0
  108. package/src/tools/search/pattern.ts +178 -0
  109. package/src/tools/search/read.ts +237 -0
  110. package/src/tools/search/request.ts +101 -0
  111. package/src/tools/search/search.ts +297 -0
  112. package/src/tools/search/walk.ts +145 -0
  113. package/src/tools/tool-outputs.ts +7 -2
  114. package/src/turn-inbox.ts +283 -0
  115. package/dist/artifacts/board-previews.d.ts +0 -41
  116. package/dist/artifacts/board-previews.d.ts.map +0 -1
  117. 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 { LOGIN_SHELL_SCRIPT } from "./login-shell"
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, as in a directory that does not exist, throws what it said. A
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. Arguments: output, pid and exit files, nonce, command.
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 '${LOGIN_SHELL_SCRIPT}' bash "$5" < /dev/null >> "$1" 2>&1 &
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 { SentSettings } from "./agent-prompt"
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
- // When, then who wrote it: `<sixb_author>` stays the message's last tag. Who takes part is in
40
- // the system prompt, so no message changes when the next one comes.
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 = [sentTimes.get(message.id), authors?.byMessageId.get(message.id)]
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 }) =>