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
1 change: 1 addition & 0 deletions bun.lock

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

141 changes: 117 additions & 24 deletions docs/VENDORING.md

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/provider/inference-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {
createDependencies,
type Dependencies,
type AdapterManifest,
} from "@intx/inference";
import { createDependencies, type Dependencies } from "@intx/inference";
import { loadAdapterRegistry } from "@intx/inference/providers";
// AdapterManifest moved from the @intx/inference barrel to @intx/types at
// upstream 4cc6972 (the inference barrel no longer re-exports it).
import type { AdapterManifest } from "@intx/types";
import * as openaiCompatible from "./openai-compatible-adapter.js";
import * as opencodeGo from "./opencode-go-adapter.js";
import * as codexResponses from "./codex-responses.js";
Expand Down
4 changes: 2 additions & 2 deletions src/session/runtime-assembly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ describe("buildCompactionContinuationMessage", () => {
expect(message.ref).toEqual({ uid: 0, mailbox: "system" });
expect(message.headers.from).toBe("user@local");
expect(message.headers.to).toEqual(["agent@local"]);
expect(message.headers.messageId.startsWith("compact-continue-")).toBe(
expect(message.headers.messageId?.startsWith("compact-continue-")).toBe(
true,
);
});
Expand Down Expand Up @@ -1251,6 +1251,6 @@ describe("buildMailboxMailMessage", () => {
expect(message.ref).toEqual({ uid: 0, mailbox: "system" });
expect(message.headers.from).toBe("user@local");
expect(message.headers.to).toEqual(["agent@local"]);
expect(message.headers.messageId.startsWith("mailbox-mail-")).toBe(true);
expect(message.headers.messageId?.startsWith("mailbox-mail-")).toBe(true);
});
});
2 changes: 2 additions & 0 deletions src/tui/queued-input-chrome.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ test("mid-run steer paints QUEUED INPUT until the real director reads it", async
deliver: (text, pending, settle) => {
const message = userInboundMessage(text, pending);
const messageId = message.headers.messageId;
if (messageId === undefined)
throw new Error("userInboundMessage set no messageId");
steerMessageId.current = messageId;
bridge.beginQueuedInputDelivery(messageId);
void deliverAgentMessage({
Expand Down
2 changes: 1 addition & 1 deletion src/tui/runner/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ export function createDeliverRouting(
() => targetAgent.deliver(message),
(result) => {
if (result.status === "accepted" && isOperatorMessage) {
state.acceptedInputObserver?.(message.headers.messageId);
state.acceptedInputObserver?.(messageId);
} else if (isOperatorMessage) {
state.discardAcceptedInputObserver?.(messageId);
}
Expand Down
14 changes: 14 additions & 0 deletions vendor/intx-agent/PATCHES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ test files into the new `testing/reactor-waiters.ts` (exported from
`loadErrors` hooks and the FORBIDDEN_DEPS credential-failure companion
suite re-carried onto the new shapes.

### 2026-10-14 re-sync to `4cc6972` (CL-10656, HEAD drift 0.4.0 → base)

All three entries re-carried; none dropped (`loadErrors` and error-seq
resumption still absent upstream in this range). Upstream touched
`agent.ts` (`d1835b` per-send `deliver` options adopted upstream, `660ef8`
signature reflow); `agent.ts` three-way merged cleanly with zero
adaptation — no upstream change intersects the two patch sites. New
upstream files `authoring.ts` (authoring-only subpath barrel) and the
`canonicalize.ts` helpers carried verbatim, with the `./authoring` and
`./canonicalize` subpath exports wired into the vendored `package.json`
(the inert `vendor/intx-workflow-host/workflow-definition-loader.ts` copy
imports `./authoring` at its new pin). Upstream also deleted no vendored
files and changed `testing/` not at all.

## agent-ts-resume-error-seq

`agent.ts` — `createAgent` resumes `errorSeq` from `auditStore.loadErrors`
Expand Down
8 changes: 8 additions & 0 deletions vendor/intx-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ In-process agent runtime built on `createReactorAssembly` from
`@intx/inference`. Construct an agent, `send()` it a message,
get a reply.

Workflow packages can import `defineAgent`, tool and director declarations,
and director registries from `@intx/agent/authoring`. That entry point keeps
the reactor and agent execution runtime out of definition loading.

`@intx/agent/canonicalize` exports `canonicalizeForHash` and
`CanonicalizationError` for deterministic serialization of deploy-hash inputs
without loading the agent execution runtime.

Use this package when you want an agent you can drive from inside
your own program — a CLI, a worker, a test, an embedded assistant.
If you want an agent that lives behind a mailbox instead, see
Expand Down
8 changes: 8 additions & 0 deletions vendor/intx-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"./testing": {
"types": "./src/testing/index.ts",
"default": "./src/testing/index.ts"
},
"./authoring": {
"types": "./src/authoring.ts",
"default": "./src/authoring.ts"
},
"./canonicalize": {
"types": "./src/canonicalize.ts",
"default": "./src/canonicalize.ts"
}
},
"dependencies": {
Expand Down
24 changes: 19 additions & 5 deletions vendor/intx-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import type {
ConversationTurn,
InboundMessage,
InferenceSource,
PerCallInferenceOptions,
ReactorDirector,
ToolCall,
ToolDefinition,
Expand Down Expand Up @@ -114,6 +115,16 @@ export type SendOptions = {
signal?: AbortSignal;
/** Override the default "from" header on the synthetic inbound message. */
from?: string;
/**
* Inference options for the model calls this send drives. Applies to this
* send alone; a key the director names outright still wins.
*/
inference?: PerCallInferenceOptions;
};

type QueuedSend = {
message: InboundMessage;
inference: PerCallInferenceOptions | undefined;
};

export type SendResult =
Expand Down Expand Up @@ -477,7 +488,7 @@ export async function createAgent<EnvReq extends BaseEnv>(
// the language allows; the comment block above is what makes
// the "assigned before any reachable read" invariant explicit.
// eslint-disable-next-line prefer-const -- forward declaration; const cannot express this ordering
let sendQueue: SendQueue<InboundMessage, SendResult>;
let sendQueue: SendQueue<QueuedSend, SendResult>;

// shutdownComplete resolves from the assembly's onShutdown hook
// (composed after audit flush by the assembly) or, as a fallback, from
Expand Down Expand Up @@ -770,11 +781,11 @@ export async function createAgent<EnvReq extends BaseEnv>(
...(env.compactors !== undefined ? { compactors: env.compactors } : {}),
});

sendQueue = createSendQueue<InboundMessage, SendResult>({
sendQueue = createSendQueue<QueuedSend, SendResult>({
maxDepth: env.sendQueueMax ?? DEFAULT_SEND_QUEUE_MAX,
start: (message) => {
start: ({ message, inference }) => {
activeCycle = { lastAssistantTurn: undefined };
reactor.deliver(message);
reactor.deliver(message, inference !== undefined ? { inference } : {});
},
});

Expand Down Expand Up @@ -813,7 +824,10 @@ export async function createAgent<EnvReq extends BaseEnv>(
// and per the design must fail loud.
if (closed) return Promise.reject(new AgentClosedError());
const message = buildInboundMessage(content, opts);
return sendQueue.enqueue(message, opts?.signal);
return sendQueue.enqueue(
{ message, inference: opts?.inference },
opts?.signal,
);
}

function stream(): AsyncIterable<ReactorEmittedEvent> {
Expand Down
40 changes: 40 additions & 0 deletions vendor/intx-agent/src/authoring.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/** Agent definitions and declarations, without the agent execution runtime. */
export {
defineAgent,
type AgentDefinition,
type DefineAgentConfig,
type EnvRequiredByAll,
type InferencePreference,
} from "./definition";
export {
defineTool,
definePlugin,
isAnnotatedPluginFactory,
toolApprovalEffect,
type AnnotatedPluginFactory,
type AnnotatedToolFactory,
type ToolDeclaration,
} from "./tool";
export {
defineDirector,
isAnnotatedDirectorFactory,
type DefinedDirector,
} from "./director";
export {
createDefaultDirectorRegistry,
createDirectorRegistry,
createWorkflowDirectorRegistry,
UnknownDirectorIdError,
} from "./director-registry";
export {
buildDefaultDirectorRef,
defaultDirectorFactory,
type DefaultDirectorConfig,
} from "./default-director";
export { effectiveDirectorRef } from "./env-validation";
export type {
AnnotatedDirectorFactory,
DirectorRef,
DirectorRegistry,
} from "./director-types";
export type { BaseEnv } from "./env";
2 changes: 1 addition & 1 deletion vendor/intx-agent/src/default-director.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { type } from "arktype";
import {
createDefaultDirector,
type DefaultDirectorPolicy,
} from "@intx/inference";
} from "@intx/inference/default-director";

import { defineDirector } from "./director";

Expand Down
11 changes: 10 additions & 1 deletion vendor/intx-agent/src/send-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// queue ordered against actual reactor cycles — two send() promises
// cannot interleave at the reactor level.
//
// A `start` that throws synchronously rejects that item and pumps the
// next, so a rejected item never occupies the active slot.
//
// Queue depth (active + pending) is bounded by `maxDepth`; exceeding it
// throws `SendQueueFullError` synchronously from enqueue() so a buggy
// caller flooding sends fails loud instead of silently buffering.
Expand Down Expand Up @@ -106,7 +109,13 @@ export function createSendQueue<T, R>(
continue;
}
active = next;
opts.start(next.item);
try {
opts.start(next.item);
} catch (cause) {
active = null;
settle(next, "reject", cause);
continue;
}
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/intx-agent/src/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
InferenceSource as InferenceSourceValidator,
applyInferenceSourceFields,
type InferenceSource,
} from "@intx/types/runtime";
} from "@intx/types/runtime-core";

export class InvalidInferenceSourceError extends Error {
constructor(message: string) {
Expand Down
2 changes: 1 addition & 1 deletion vendor/intx-agent/src/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// handler throws.
//
// `createToolRunner(tools)` builds a `ToolRunner` that dispatches by tool
// name. Per the ToolRunner contract (packages/types/src/runtime.ts), `run`
// name. Per the ToolRunner contract (packages/types/src/runtime-core.ts), `run`
// must not throw -- unknown tool names and handler exceptions are surfaced
// as `ToolResult` with `isError: true` so the model sees them and can
// recover.
Expand Down
Loading
Loading