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
48 changes: 48 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"devDependencies": {
"@types/bun": "1.3.11",
"typescript": "~6.0.3"
},
"dependencies": {
"@t3tools/runtime-client": "https://github.com/EtanHey/t3code/releases/download/runtime-client-v0.0.31-rpc.2/t3tools-runtime-client-0.0.31-rpc.2.tgz",
"effect": "4.0.0-beta.102"
}
}
11 changes: 11 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ConfigInput {
readonly effort?: unknown;
readonly contextWindow?: unknown;
readonly runtimeMode?: unknown;
readonly interactionMode?: unknown;
readonly [key: string]: unknown;
}

Expand All @@ -15,6 +16,7 @@ export interface ExperimentConfig {
readonly effort: "high";
readonly contextWindow: "1m";
readonly runtimeMode: "full-access";
readonly interactionMode: "default";
}

export function createConfig(input: ConfigInput): ExperimentConfig {
Expand All @@ -25,6 +27,7 @@ export function createConfig(input: ConfigInput): ExperimentConfig {
"effort",
"contextWindow",
"runtimeMode",
"interactionMode",
]);

for (const field of Object.keys(input)) {
Expand Down Expand Up @@ -75,12 +78,20 @@ export function createConfig(input: ConfigInput): ExperimentConfig {
throw new TypeError("runtimeMode must be full-access");
}

if (input.interactionMode === undefined) {
throw new TypeError("interactionMode is required");
}
if (input.interactionMode !== "default") {
throw new TypeError("interactionMode must be default");
}

return Object.freeze({
baseUrl: input.baseUrl,
provider: input.provider,
model: input.model,
effort: input.effort,
contextWindow: input.contextWindow,
runtimeMode: input.runtimeMode,
interactionMode: input.interactionMode,
});
}
35 changes: 23 additions & 12 deletions src/facade.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import type { ExperimentConfig } from "./config";

type RuntimeMode = ExperimentConfig["runtimeMode"];
type InteractionMode = ExperimentConfig["interactionMode"];

export interface NativeProject {
readonly projectId: string;
readonly workspaceRoot: string;
Expand Down Expand Up @@ -32,8 +37,8 @@ export interface NativeStartThreadInput {
readonly title: string;
readonly message: string;
readonly modelSelection: ModelSelection;
readonly runtimeMode: string;
readonly interactionMode: string;
readonly runtimeMode: RuntimeMode;
readonly interactionMode: InteractionMode;
readonly branch: string | null;
readonly worktreePath: string | null;
readonly createdAt: string;
Expand All @@ -55,6 +60,8 @@ export interface NativeStartTurnInput {
readonly threadId: string;
readonly messageId: string;
readonly message: string;
readonly runtimeMode: RuntimeMode;
readonly interactionMode: InteractionMode;
readonly createdAt: string;
readonly attachments: readonly [];
}
Expand Down Expand Up @@ -87,9 +94,9 @@ export interface NativeThreadObservation {
export interface ModelSelection {
readonly instanceId: string;
readonly model: string;
readonly options: ReadonlyArray<{
readonly options?: ReadonlyArray<{
readonly id: string;
readonly value: string;
readonly value: string | boolean;
Comment on lines +97 to +99

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Locate the model selection option value schema in `@t3tools/runtime-client` typings.
set -uo pipefail

fd -t f -e d.ts . node_modules/@t3tools/runtime-client 2>/dev/null | head -50

# Search declaration files for the option value type and the command schema.
rg -n -C 6 'modelSelection|ModelSelection' --iglob '*.d.ts' node_modules/@t3tools/runtime-client 2>/dev/null | head -120
rg -n -C 10 'ClientOrchestrationCommand' --iglob '*.d.ts' node_modules/@t3tools/runtime-client 2>/dev/null | head -80

Repository: EtanHey/t3layer

Length of output: 153


🏁 Script executed:

#!/bin/bash
set -uo pipefail

# Locate relevant source files and inspect package dependency/version declarations.
printf 'Candidate files:\n'
git ls-files | rg '(^src/(facade|nativeRuntime)\.ts$|test/facade\.contract\.test\.ts$|package\.json$|pnpm-lock\.yaml$|package-lock\.json$|yarn\.lock$)' || true

printf '\nFacade excerpt:\n'
if [ -f src/facade.ts ]; then sed -n '80,115p' src/facade.ts | cat -n; fi

printf '\nnativeRuntime spawnCommand excerpt:\n'
if [ -f src/nativeRuntime.ts ]; then sed -n '830,895p' src/nativeRuntime.ts | cat -n; fi

printf '\nRuntime-client dependency references:\n'
rg -n '"`@t3tools/runtime-client`"|`@t3tools/runtime-client`' package.json pnpm-lock.yaml package-lock.json yarn.lock 2>/dev/null || true

Repository: EtanHey/t3layer

Length of output: 4071


🌐 Web query:

EtanHey t3code runtime-client v0.0.31-rpc.2 ModelSelection options value bool

💡 Result:

The query appears to reference components or configuration options within a software project, likely related to the pingdotgg/t3code ecosystem or similar TypeScript-based agent/runtime tooling [1][2][3]. While v0.0.31 of the t3code project exists [4][5], and there are various "runtime-client" packages and "ModelSelection" patterns across different developer tools (such as honeycomb, sipp, or lmstudio) [6][7][8], there is no public, authoritative documentation confirming a specific configuration option for "ModelSelection" that takes a boolean value in a package named runtime-client version v0.0.31-rpc.2 [1][4][5]. It is highly likely that the term "ModelSelection" refers to a custom interface or an internal configuration object used within a specific, perhaps private or highly specialized, implementation [3][6]. If you are working with a specific codebase, you should check the type definitions (e.g.,.d.ts files) within your local node_modules or the specific source repository for that package, as it may be an undocumented or internal-only API change introduced in that specific version [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -uo pipefail

printf 'Package manager / dependency availability:\n'
ls -la | rg '(^node_modules$|^pnpm-lock\.yaml$|^package-lock\.json$|^yarn\.lock$|package\.json$)' || true
node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).dependencies?{}:{})" 2>/dev/null || true

printf '\nLocate runtime-client files anywhere in checked-in fs:\n'
git ls-files | rg 'runtime-client|t3tools' || true

printf '\nInspect relevant tests around boolean option:\n'

Repository: EtanHey/t3layer

Length of output: 365


🌐 Web query:

github.com EtanHey t3code package.json "@t3tools/runtime-client" "0.0.31-rpc.2"

💡 Result:

The repository github.com/EtanHey/t3code does not exist. The main repository for the "T3 Code" project—a web GUI for coding agents—is maintained under the organization pingdotgg as github.com/pingdotgg/t3code [1][2]. Etan Heyman (GitHub profile: github.com/EtanHey) is a contributor to the pingdotgg/t3code repository [3][4][5]. Regarding the specific package version mentioned, @t3tools/runtime-client 0.0.31-rpc.2, there is no evidence of this package name or version in the pingdotgg/t3code codebase. The project uses a monorepo structure where client-side runtime logic is located in the packages/client-runtime directory [6][7], and dependencies are typically managed via workspace protocols or internal catalogs rather than external npm-style versioning like 0.0.31-rpc.2 [8][9][10]. The project relies heavily on the Effect-TS ecosystem [11][12][8].

Citations:


Validate boolean model options against the runtime-client schema before decoding.

spawnCommand passes input.modelSelection unchanged to Schema.decodeUnknownSync(ClientOrchestrationCommand). If ClientOrchestrationCommand still accepts only string option values, a boolean option from ModelSelection can throw and bypass the facade boundary. Align the decoded schema with ModelSelection.options[].value: string | boolean, or add a pre-decode projection that converts/supports booleans.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/facade.ts` around lines 97 - 99, Update the ClientOrchestrationCommand
validation used by spawnCommand so model option values accept the same string |
boolean contract as ModelSelection.options[].value before
Schema.decodeUnknownSync runs. Prefer aligning the decoded schema; otherwise
project boolean values before decoding while preserving string values and the
existing facade boundary behavior.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAIVED — verified false positive against the pinned rpc.2 artifact. @t3tools/runtime-client ModelSelection.options[].value is Schema.Union(string, boolean) in dist/index.d.mts, and the boolean dispatch contract test passes.

}>;
}

Expand All @@ -98,8 +105,8 @@ export interface SpawnInput {
readonly title: string;
readonly message: string;
readonly modelSelection: ModelSelection;
readonly runtimeMode: string;
readonly interactionMode: string;
readonly runtimeMode: RuntimeMode;
readonly interactionMode: InteractionMode;
readonly branch: string | null;
readonly worktreePath: string | null;
}
Expand Down Expand Up @@ -201,7 +208,10 @@ export class FacadeError extends Error {
}
}

export interface FacadeOptions {
export interface FacadeOptions extends Pick<
ExperimentConfig,
"runtimeMode" | "interactionMode"
> {
readonly id?: () => string;
readonly now?: () => string;
readonly evidence?: (record: Readonly<Record<string, unknown>>) => void;
Expand Down Expand Up @@ -384,10 +394,7 @@ function assertNonEmptyTerminal(snapshot: NativeThreadSnapshot): void {
}
}

export function createT3Facade(
runtime: NativeRuntime,
options: FacadeOptions = {},
) {
export function createT3Facade(runtime: NativeRuntime, options: FacadeOptions) {
const id = options.id ?? defaultId;
const now = options.now ?? (() => new Date().toISOString());
const evidence = options.evidence ?? (() => undefined);
Expand Down Expand Up @@ -483,7 +490,7 @@ export function createT3Facade(
modelSelection: {
instanceId: input.modelSelection.instanceId,
model: input.modelSelection.model,
optionCount: input.modelSelection.options.length,
optionCount: input.modelSelection.options?.length ?? 0,
},
runtimeMode: input.runtimeMode,
interactionMode: input.interactionMode,
Expand Down Expand Up @@ -570,6 +577,8 @@ export function createT3Facade(
threadId: agentId,
messageId,
message,
runtimeMode: options.runtimeMode,
interactionMode: options.interactionMode,
createdAt,
attachments: [],
};
Expand All @@ -578,6 +587,8 @@ export function createT3Facade(
commandId,
threadId: agentId,
messageId,
runtimeMode: options.runtimeMode,
interactionMode: options.interactionMode,
createdAt,
attachments: 0,
messageBytes: new TextEncoder().encode(message).byteLength,
Expand Down
Loading