Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is a fork of T3 Code that integrates a few additional features, including:
- **Compact when idle for Claude threads:** a choice in Settings → Providers → Advanced → Compact idle threads. Besides compacting before the prompt cache expires, it compacts a large idle Claude thread (default 400K tokens or more) a set time (default 15 minutes) after the last message or answer from a user or a bot, so the compaction runs while no one waits for a reply. The token counts and the wait are set right under the choice.
- **Prune idle worker threads:** `t3 prune-worker-threads` deletes the messages, turn items, nodes, plans and runtime requests of idle worker threads. A worker thread is idle when it has no open run and, in the last 7 days, was not created, had no run requested or ended, and had no turn item or message updated. A worker thread is a subagent thread that an agent started. Subagent threads that a bot starts are workers too. Threads a person opens, bot threads themselves and a person's forks are never workers. An idle worker keeps its rows while recovery still needs the worker, or while a thread that keeps its own rows names the worker as parent or fork source. Pruned threads keep their thread row, runs, parent link and pull request links, so they still show up and open with no messages. The command runs only when you call it, so run it daily to keep worker transcripts from piling up. Other threads still grow the database. With `--dry-run`, the command only prints how many threads it would empty and how many rows it would delete. You can run the command while the server runs.
- **One way to start subagents in Claude and Codex threads:** T3 Code starts Claude and Codex sessions without the provider's own subagent tools: Claude's `Agent`, `Workflow`, `SendMessage` and `ListAgents`, and Codex's `spawn_agent` with its other collaboration tools. The agent starts every subagent, same provider and model included, with T3 Code's `delegate_task` tool, so each child is a T3 Code thread that you can open and follow.
- **Files remember where you stopped reading:** a file in the right panel opens where you left it when you switch back to its tab, close and reopen it, or reload the app. This covers code, Markdown, PDFs, large text files, CSV and TSV tables, HTML pages, Word and PowerPoint files, the first sheet of an Excel or ODS spreadsheet, notebooks, Mermaid diagrams and chat attachments; video and audio come back paused at the time you left. If the file changed, it opens at the same place, or at its start or end when that place is gone. Places stay in this browser for 30 days. A link to a line still jumps to that line once. PDFs in the right panel open in T3 Code's own PDF viewer, also in Chrome and Edge on the desktop. Image zoom, fonts, archives, SQLite files, ODT, ODP, RTF and EPUB files, HTML attachments and the other sheets of a spreadsheet still open at the top. A place in a notebook cell after the first 20 opens at the end of cell 20.
- **Files remember where you stopped reading:** a file in the right panel opens where you left it when you switch back to its tab, close and reopen it, or reload the app. This covers code, Markdown source, PDFs, large text files, CSV and TSV tables, HTML pages, Word and PowerPoint files, the first sheet of an Excel or ODS spreadsheet, notebooks, Mermaid diagrams and chat attachments; video and audio come back paused at the time you left. If the file changed, it opens at the same place, or at its start or end when that place is gone. Places stay in this browser for 30 days. A link to a line still jumps to that line once. PDFs in the right panel open in T3 Code's own PDF viewer, also in Chrome and Edge on the desktop. Image zoom, fonts, archives, SQLite files, ODT, ODP, RTF and EPUB files, HTML attachments, the other sheets of a spreadsheet and rendered workspace Markdown still open at the top. Text files of 1 MB to 64 MB open in source view in parts after the first megabyte, so past 1 MB a saved place may not be restored and a line link may stop at the end of the text loaded so far. [Issue #264](https://github.com/orbitingflea/t3code/issues/264) tracks support for rendered workspace Markdown and these 1 MB to 64 MB text files. A place in a notebook cell after the first 20 opens at the end of cell 20.
- **Reflink worktrees on Linux:** Settings → Worktrees → Reflink worktrees (on by default) clones new worktrees copy-on-write from a cache of recent checkouts on the worktree location's drive, so worktrees share disk space until files change. Drives that cannot clone, such as ext4, use Git's normal checkout.
- **FYI messages between agents:** an agent can send another thread an FYI, a note of at most 16,000 characters that needs no action and starts no turn. The receiving agent gets it with its next turn; a running Claude Code thread gets it at its next tool call. An FYI counts as delivered only when the turn that carries it finishes: a turn that fails, is stopped, restarts or is reverted gives it back, so the agent may see it twice. When a thread has an FYI waiting and has been idle for 6 hours, T3 Code wakes it to deliver its FYIs, unless the thread is settled, archived, waiting for your answer or holds queued messages; a snoozed thread waits until its snooze ends. The 6 hours count from the thread's last turn, or from the reset of a usage limit that stopped it on the provider it still uses (or from the end of a snooze that ends after that reset), so an FYI to a thread that has been idle longer wakes it within minutes. A thread whose usage limit has no known reset time, or whose provider fails every turn, gets a failed wake every 6 hours while an FYI waits. A wake carries up to 16,000 characters of FYIs. The rest, and any that a wake gives back because it failed or you stopped it, get another wake after 6 more idle hours. A wake is a new turn, so **Resume** no longer continues a turn that ended before it. Settle or archive a thread to stop its wakes. The timeline marks these messages "FYI · waiting", "FYI · sent" while the turn that carries them runs, and "FYI" once it finished.
- **Open server files by their path:** in a browser signed in to T3 Code at its own address, open `<T3 address>/<absolute path>` (such as `https://t3.example.com/home/ana/work/report.html`) to see that file read-only, for files under the server user's home folder and temp folder. A session needs the `filesystem:read` permission, and a signed-out browser gets a sign-in page. Text and code of any type show as plain text, and images, PDFs, audio and video show as themselves. A folder shows its `index.html`, or else a list of its files. Links ending in `:line` or `:line:col` open the file. Names that start with `.`, and T3 Code's own data folder, are not served. An HTML page runs in a sandboxed frame at the same address: its scripts run but cannot act as you in T3, and it loads files from its own folder and below for an hour, though its scripts cannot fetch them. A page directly in the home or temp folder loads no other files. An HTML page linked from another site, or any HTML page over plain HTTP, first shows an Open link.
Expand Down
4 changes: 0 additions & 4 deletions apps/server/src/cli/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,11 @@ export type ThreadTools = ReturnType<typeof makeThreadTools>;
* outside agent does, and revokes that session when the command ends.
*/
export const withThreadTools = Effect.fn("cli.thread.withThreadTools")(function* <A, E, R>(
<<<<<<< origin/main
flags: { readonly baseDir: Option.Option<string>; readonly json: boolean },
=======
flags: {
readonly baseDir: Option.Option<string>;
readonly json: boolean;
readonly clientLabel?: string;
},
>>>>>>> upstream/main
run: (tools: ThreadTools) => Effect.Effect<A, E, R>,
) {
const logLevel = yield* GlobalFlag.LogLevel;
Expand Down
5 changes: 1 addition & 4 deletions apps/server/src/environment/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,8 @@ export const make = Effect.gen(function* () {
mcpHostedApproval: true,
shellThreadFamilies: true,
shellOlderSettled: true,
<<<<<<< origin/main
...(yield* whiteboardPanelCapabilities()),
=======
agentFeedback: true,
>>>>>>> upstream/main
...(yield* whiteboardPanelCapabilities()),
},
};

Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/feedback/FeedbackReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ export const T3_CLI_COMMANDS: ReadonlyArray<string> = [
"t3 thread start",
"t3 thread send",
"t3 thread show",
"t3 thread user-view",
"t3 prune-worker-threads",
"t3 feedback",
"t3 feedback list",
"t3 workflow",
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/fork/fyi/Fyi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ describe("turnCarriesFyi", () => {
["a prose message", "Fix the flaky test", [], false, true],
["/compact", "/compact", [], false, false],
["a slash command after spaces", " /review", [], false, false],
["a slash message with an image", "/look at this", [{}], false, true],
["a slash message with an image", "/look at this", [{}], false, false],
["a path", "/srv/app/notes.md has the plan", [], false, true],
["a goal command", "/goal ship it", [], true, false],
["a skill mention", "$deploy ship it", [], false, false],
["a skill mention with another sigil after spaces", " €review the plan", [], false, false],
Expand Down
5 changes: 4 additions & 1 deletion apps/server/src/fork/fyi/Fyi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
type TurnItemId,
} from "@t3tools/contracts";
import { SKILL_MENTION_PATTERN } from "@t3tools/shared/composerInlineTokens";

import { isSlashCommandMessage } from "../../orchestration-v2/ContextHandoffDelivery.ts";
import {
latestExecutedRun,
latestRootProviderFailure,
Expand Down Expand Up @@ -79,7 +81,8 @@ export function turnCarriesFyi(input: {
!input.goalCommand &&
!input.resumesNatively &&
!(message.createdBy === "agent" && message.creationSource === "provider") &&
!(message.attachments.length === 0 && message.text.trimStart().startsWith("/")) &&
// A slash command reaches the provider verbatim, attachments or not, so it carries none.
!isSlashCommandMessage({ role: "user", text: message.text }) &&
!LEADING_SKILL_MENTION.test(message.text)
);
}
Expand Down
4 changes: 4 additions & 0 deletions apps/server/src/fork/generalRoleParity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { ThreadDashboard } from "./threadDashboard/ThreadDashboard.ts";
import { UserView } from "./userView/UserView.ts";
import { ServerEnvironment } from "../environment/ServerEnvironment.ts";
import * as EnvironmentTheme from "../environmentTheme.ts";
import { FeedbackStore } from "../feedback/FeedbackStore.ts";
import { GitManager } from "../git/GitManager.ts";
import { GitWorkflowService } from "../git/GitWorkflowService.ts";
import { IssueService } from "../issue/IssueService.ts";
Expand Down Expand Up @@ -91,6 +92,7 @@ import * as ServerSettings from "../serverSettings.ts";
import { SourceControlRepositoryService } from "../sourceControl/SourceControlRepositoryService.ts";
import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
import { VcsStatusBroadcaster } from "../vcs/VcsStatusBroadcaster.ts";
import { Workflows } from "../workflows/Workflows.ts";
import { TaskFolders } from "../workspace/TaskFolders.ts";

const projectId = ProjectId.make("project:general-role-parity");
Expand Down Expand Up @@ -693,6 +695,7 @@ const toolHandlerServices = Layer.mergeAll(
Layer.mock(UserView)({}),
Layer.mock(DisplayModeWrap)({ forgetNotesAfterCompaction: () => (ingest) => ingest }),
Layer.mock(DocumentText)({}),
Layer.mock(FeedbackStore)({}),
Layer.mock(EnvironmentTheme.EnvironmentThemeService)({}),
Layer.mock(GitVcsDriver.GitVcsDriver)({}),
Layer.mock(GitManager)({}),
Expand Down Expand Up @@ -730,6 +733,7 @@ const toolHandlerServices = Layer.mergeAll(
Layer.mock(TaskFolders)({}),
Layer.mock(ThreadSearch)({}),
Layer.mock(VcsStatusBroadcaster)({}),
Layer.mock(Workflows)({}),
).pipe(Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)));

const decodeToolsList = Schema.decodeUnknownEffect(
Expand Down
7 changes: 0 additions & 7 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1696,14 +1696,10 @@ export const layerQueryRunner: Layer.Layer<
...(resumeSessionAt === undefined ? {} : { resumeSessionAt }),
env: {
...(sdkOptions.env ?? hostEnvironment),
<<<<<<< origin/main
...claudeTerminalToolEnvironment,
...DELEGATE_ONLY_PROVIDERS.claudeAgent.hide.environment,
...(input.resume
=======
// The CLI would re-run a failed request by itself, then run the resume prompt as a second turn.
...(input.resume && !endsOnFailedRequest
>>>>>>> upstream/main
? {
CLAUDE_CODE_RESUME_INTERRUPTED_TURN: "1",
CLAUDE_CODE_RESUME_REASON: "user_resume",
Expand Down Expand Up @@ -2559,15 +2555,12 @@ export function makeClaudeQueryOptions(input: {
},
} as ClaudeSdkSettings);
const deviceInstructions = input.mcpServers !== undefined && input.deviceToolsAvailable === true;
<<<<<<< origin/main
const hooks = {
...input.hooks,
...(deviceInstructions ? { SubagentStart: [{ hooks: [subagentDeviceInstructions] }] } : {}),
...(input.onStop === undefined ? {} : { Stop: [{ hooks: [input.onStop] }] }),
};
=======
const agentFeedback = input.mcpServers === undefined ? "off" : (input.agentFeedback ?? "off");
>>>>>>> upstream/main
const options: ClaudeAgentSdkQueryOptions = {
model: compiledSelection.apiModelId,
// T3 names threads; a supplied title skips Claude's redundant naming request.
Expand Down
30 changes: 0 additions & 30 deletions apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2105,9 +2105,6 @@ describe("CodexAdapterV2 post-settle continuation", () => {
),
);

<<<<<<< origin/main
it.effect("accepts dangerous-command approvals in full-access without asking", () =>
=======
it.effect.each([
{ name: "dangerous command", networkApprovalContext: undefined, asks: false },
{
Expand All @@ -2116,7 +2113,6 @@ describe("CodexAdapterV2 post-settle continuation", () => {
asks: true,
},
] as const)("full access asks about a $name: $asks", ({ networkApprovalContext, asks }) =>
>>>>>>> upstream/main
Effect.gen(function* () {
const nativeThreadId = "command-approval-thread";
const nativeTurnId = "command-approval-turn";
Expand All @@ -2138,22 +2134,6 @@ describe("CodexAdapterV2 post-settle continuation", () => {
itemId: "exec-rm",
command: "/bin/bash -lc 'rm -rf ./node_modules'",
startedAtMs: 0,
<<<<<<< origin/main
},
},
},
{ type: "expect_outbound", frame: { id: 0, result: { decision: "accept" } } },
{
type: "emit_inbound",
frame: {
method: "turn/completed",
params: {
threadId: nativeThreadId,
turn: makeCodexReplayTurn({ id: nativeTurnId, status: "completed" }),
},
},
},
=======
...(networkApprovalContext === undefined ? {} : { networkApprovalContext }),
},
},
Expand All @@ -2173,7 +2153,6 @@ describe("CodexAdapterV2 post-settle continuation", () => {
},
},
] as const)),
>>>>>>> upstream/main
],
}),
(event) =>
Expand All @@ -2196,22 +2175,13 @@ describe("CodexAdapterV2 post-settle continuation", () => {
harness.firstTerminal.pipe(Effect.as(undefined)),
Queue.take(pending),
);
<<<<<<< origin/main
assert.isUndefined(request, "Full access must not wait for a command approval");
assert.equal(yield* Queue.size(pending), 0, "Full access must not show a command approval");
assert.deepEqual(
harness.terminalEvents().map((event) => event.status),
["completed"],
);
=======
assert.equal(request?.kind, asks ? "command" : undefined);
if (!asks) {
assert.deepEqual(
harness.terminalEvents().map((event) => event.status),
["completed"],
);
}
>>>>>>> upstream/main
}).pipe(
Effect.scoped,
Effect.provide(
Expand Down
21 changes: 5 additions & 16 deletions apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6128,12 +6128,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
payload,
);
}
<<<<<<< origin/main
// Codex still asks for commands it deems dangerous under the granular full-access policy.
if (
context.input.runtimePolicy.runtimeMode === "full-access" &&
context.input.runtimePolicy.approvalPolicy === undefined
=======
// T3's Full access policy is granular, under which Codex still asks before commands it
// deems dangerous. Managed-network asks enforce the user's allowlist, so they still ask.
if (
Expand All @@ -6142,7 +6136,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
context.input.runtimePolicy.sandboxPolicy === undefined &&
payload.networkApprovalContext == null &&
(payload.proposedNetworkPolicyAmendments ?? []).length === 0
>>>>>>> upstream/main
) {
return {
decision: "accept",
Expand Down Expand Up @@ -7873,17 +7866,13 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
...(yield* Ref.get(settledTurns)),
...(yield* Ref.get(activeTurns)),
]);
<<<<<<< origin/main
const started = yield* client.request(
"turn/start",
withCodexCommandNote(turnStartParams, turnInput.message.messageId, commandNote),
);
if (commandNote !== undefined) yield* commandNote.delivered;
=======
const started = yield* client
.request("turn/start", turnStartParams)
.request(
"turn/start",
withCodexCommandNote(turnStartParams, turnInput.message.messageId, commandNote),
)
.pipe(withAppServerDeadline("turn/start"));
>>>>>>> upstream/main
if (commandNote !== undefined) yield* commandNote.delivered;
const previousTurn =
previousTurns.get(started.turn.id) ??
(yield* Ref.get(activeTurns)).get(started.turn.id);
Expand Down
8 changes: 0 additions & 8 deletions apps/server/src/orchestration-v2/CheckpointCaptureService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,7 @@ export const layer: Layer.Layer<
],
{ concurrency: 2 },
);
<<<<<<< origin/main
// Omit delegatedCompletion to preserve cohort writes made after capture loaded the run.
const { delegatedCompletion: _delegatedCompletion, ...runWithoutDelegatedCompletion } = run;
const commandId = CommandId.make(
`command:effect:checkpoint.capture:${run.activeAttemptId ?? run.id}`,
);
=======
const commandId = CommandId.make(`command:effect:checkpoint.capture:${run.id}`);
>>>>>>> upstream/main
const checkpointEvent = (payload: OrchestrationV2Checkpoint) =>
Effect.map(ids.allocate.event({ threadId: input.threadId, commandId }), (id) => ({
id,
Expand Down
3 changes: 0 additions & 3 deletions apps/server/src/orchestration-v2/ProjectionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,8 @@ import * as SqlClient from "effect/sql/SqlClient";
import type * as Statement from "effect/sql/Statement";

import { MCP_APP_OUTPUT_KEY } from "@t3tools/shared/mcpApp";
<<<<<<< origin/main
import { SEND_TO_USER_PAYLOAD_LIKE } from "@t3tools/shared/displayModes";
=======
import { normalizeProjectPathForComparison } from "@t3tools/shared/path";
>>>>>>> upstream/main
import { threadHtmlRenderAttachmentIds } from "../attachmentStore.ts";
import * as ShownHistory from "../fork/shownHistory/ShownHistory.ts";
import { DELEGATED_TASK_MESSAGE_CONDITION } from "./delegatedTaskMessage.ts";
Expand Down
Loading
Loading