Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["server/packages/*", "gigacode"]
exclude = ["factory/packages/desktop/src-tauri", "foundry/packages/desktop/src-tauri"]

[workspace.package]
version = "0.4.2"
version = "0.5.0-rc.3"
edition = "2021"
authors = [ "Rivet Gaming, LLC <developer@rivet.gg>" ]
license = "Apache-2.0"
Expand All @@ -13,13 +13,13 @@ description = "Universal API for automatic coding agents in sandboxes. Supports

[workspace.dependencies]
# Internal crates
sandbox-agent = { version = "0.4.2", path = "server/packages/sandbox-agent" }
sandbox-agent-error = { version = "0.4.2", path = "server/packages/error" }
sandbox-agent-agent-management = { version = "0.4.2", path = "server/packages/agent-management" }
sandbox-agent-agent-credentials = { version = "0.4.2", path = "server/packages/agent-credentials" }
sandbox-agent-opencode-adapter = { version = "0.4.2", path = "server/packages/opencode-adapter" }
sandbox-agent-opencode-server-manager = { version = "0.4.2", path = "server/packages/opencode-server-manager" }
acp-http-adapter = { version = "0.4.2", path = "server/packages/acp-http-adapter" }
sandbox-agent = { version = "0.5.0-rc.3", path = "server/packages/sandbox-agent" }
sandbox-agent-error = { version = "0.5.0-rc.3", path = "server/packages/error" }
sandbox-agent-agent-management = { version = "0.5.0-rc.3", path = "server/packages/agent-management" }
sandbox-agent-agent-credentials = { version = "0.5.0-rc.3", path = "server/packages/agent-credentials" }
sandbox-agent-opencode-adapter = { version = "0.5.0-rc.3", path = "server/packages/opencode-adapter" }
sandbox-agent-opencode-server-manager = { version = "0.5.0-rc.3", path = "server/packages/opencode-server-manager" }
acp-http-adapter = { version = "0.5.0-rc.3", path = "server/packages/acp-http-adapter" }

# Serialization
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion sdks/acp-http-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acp-http-client",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "Protocol-faithful ACP JSON-RPC over streamable HTTP client.",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli-shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-shared",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "Shared helpers for sandbox-agent CLI and SDK",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "CLI for sandbox-agent - run AI coding agents in sandboxes",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/platforms/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-darwin-arm64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "sandbox-agent CLI binary for macOS ARM64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/platforms/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-darwin-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "sandbox-agent CLI binary for macOS x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/platforms/linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-linux-arm64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "sandbox-agent CLI binary for Linux arm64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/platforms/linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-linux-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "sandbox-agent CLI binary for Linux x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/cli/platforms/win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/cli-win32-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "sandbox-agent CLI binary for Windows x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "Gigacode CLI (sandbox-agent with OpenCode attach by default)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/platforms/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode-darwin-arm64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "gigacode CLI binary for macOS arm64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/platforms/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode-darwin-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "gigacode CLI binary for macOS x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/platforms/linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode-linux-arm64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "gigacode CLI binary for Linux arm64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/platforms/linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode-linux-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "gigacode CLI binary for Linux x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/gigacode/platforms/win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/gigacode-win32-x64",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "gigacode CLI binary for Windows x64",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/persist-indexeddb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/persist-indexeddb",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "IndexedDB persistence driver for the Sandbox Agent TypeScript SDK (DEPRECATED)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/persist-postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/persist-postgres",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "PostgreSQL persistence driver for the Sandbox Agent TypeScript SDK (DEPRECATED)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/persist-rivet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/persist-rivet",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "Rivet Actor persistence driver for the Sandbox Agent TypeScript SDK (DEPRECATED)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/persist-sqlite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/persist-sqlite",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "SQLite persistence driver for the Sandbox Agent TypeScript SDK (DEPRECATED)",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sandbox-agent/react",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "React components for Sandbox Agent frontend integrations",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sandbox-agent",
"version": "0.4.2",
"version": "0.5.0-rc.3",
"description": "Universal API for automatic coding agents in sandboxes. Supports Claude Code, Codex, OpenCode, and Amp.",
"license": "Apache-2.0",
"repository": {
Expand Down
54 changes: 32 additions & 22 deletions sdks/typescript/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@ export class LiveAcpConnection {
if (replayText) {
// TODO: Replace this synthesized replay text with ACP-native restore once standardized.
this.pendingReplayByLocalSessionId.delete(localSessionId);
injectReplayPrompt(mappedParams, replayText);
prefixPromptText(mappedParams, replayText);
} else {
prefixPromptText(mappedParams, "msg:");
}

if (options.notification) {
Expand Down Expand Up @@ -2686,12 +2688,29 @@ function mapSessionParams(params: Record<string, unknown>, agentSessionId: strin
};
}

function injectReplayPrompt(params: Record<string, unknown>, replayText: string): void {
function prefixPromptText(params: Record<string, unknown>, prefix: string): void {
const prompt = Array.isArray(params.prompt) ? [...params.prompt] : [];
prompt.unshift({
type: "text",
text: replayText,
});
let prefixed = false;

for (let i = 0; i < prompt.length; i += 1) {
const part = prompt[i];
if (isRecord(part) && part.type === "text" && typeof part.text === "string") {
prompt[i] = {
...part,
text: `${prefix}${part.text}`,
};
prefixed = true;
break;
}
}

if (!prefixed) {
prompt.unshift({
type: "text",
text: prefix,
});
}

params.prompt = prompt;
}

Expand All @@ -2700,25 +2719,16 @@ function buildReplayText(events: SessionEvent[], maxChars: number): string | nul
return null;
}

const prefix = "Previous session history is replayed below as JSON-RPC envelopes. Use it as context before responding to the latest user prompt.\n";
let text = prefix;

for (const event of events) {
const line = JSON.stringify({
createdAt: event.createdAt,
sender: event.sender,
payload: event.payload,
});

if (text.length + line.length + 1 > maxChars) {
text += "\n[history truncated]";
break;
let start = 0;
while (start < events.length) {
const json = JSON.stringify(events.slice(start));
if (json.length <= maxChars) {
return `restore-history:${json.length}:${json}`;
}

text += `${line}\n`;
start += 1;
}

return text;
return null;
}

function envelopeMethod(message: AnyMessage): string | null {
Expand Down
2 changes: 1 addition & 1 deletion sdks/typescript/tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ describe("Integration: TypeScript SDK flat session API", () => {
const params = payload.params as Record<string, unknown> | undefined;
const prompt = Array.isArray(params?.prompt) ? params?.prompt : [];
const firstBlock = prompt[0] as Record<string, unknown> | undefined;
return method === "session/prompt" && typeof firstBlock?.text === "string" && firstBlock.text.includes("Previous session history is replayed below");
return method === "session/prompt" && typeof firstBlock?.text === "string" && firstBlock.text.startsWith("restore-history:");
});

expect(replayInjected).toBeTruthy();
Expand Down
Loading
Loading