claude-use 9.5.0 → 9.5.1
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.
- package/dist/cli.cjs +7425 -4941
- package/dist/index.cjs +40 -36
- package/dist/index.mjs +41 -37
- package/dist/types/index.d.ts +121 -121
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2649,7 +2649,7 @@ var init_package = __esm({
|
|
|
2649
2649
|
"package.json"() {
|
|
2650
2650
|
package_default = {
|
|
2651
2651
|
name: "claude-use",
|
|
2652
|
-
version: "9.5.
|
|
2652
|
+
version: "9.5.1",
|
|
2653
2653
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2654
2654
|
license: "MIT",
|
|
2655
2655
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2700,9 +2700,9 @@ var init_package = __esm({
|
|
|
2700
2700
|
dependencies: {
|
|
2701
2701
|
"@anthropic-ai/claude-agent-sdk": "0.3.292",
|
|
2702
2702
|
"@clack/prompts": "^1.8.0",
|
|
2703
|
-
"@orpc/client": "
|
|
2704
|
-
"@orpc/openapi": "
|
|
2705
|
-
"@orpc/server": "
|
|
2703
|
+
"@orpc/client": "2.0.0-beta.41",
|
|
2704
|
+
"@orpc/openapi": "2.0.0-beta.41",
|
|
2705
|
+
"@orpc/server": "2.0.0-beta.41",
|
|
2706
2706
|
commander: "^15.0.0",
|
|
2707
2707
|
cosmiconfig: "^10.0.1",
|
|
2708
2708
|
picomatch: "^4.0.7",
|
|
@@ -10926,41 +10926,41 @@ function createRcApiRouter(deps) {
|
|
|
10926
10926
|
};
|
|
10927
10927
|
return {
|
|
10928
10928
|
rc: {
|
|
10929
|
-
list: authed.
|
|
10930
|
-
status: authed.
|
|
10929
|
+
list: authed.meta((0, import_openapi.openapi)({ method: "GET", path: "/rest/rc/sessions", summary: "List the observed Remote Control sessions", tags: [RC_API_TAG] })).output(RcListOutputSchema).handler(() => ({ sessions: deps.list() })),
|
|
10930
|
+
status: authed.meta((0, import_openapi.openapi)({ method: "GET", path: "/rest/rc/status", summary: "Read session status, one session's when named", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcStatusOutputSchema).handler(({ input }) => {
|
|
10931
10931
|
const statuses = deps.statusOf(input.session);
|
|
10932
10932
|
if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
|
|
10933
10933
|
throw new import_client.ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
10934
10934
|
}
|
|
10935
10935
|
return { statuses };
|
|
10936
10936
|
}),
|
|
10937
|
-
pending: authed.
|
|
10937
|
+
pending: authed.meta((0, import_openapi.openapi)({ method: "GET", path: "/rest/rc/pending", summary: "Read the control requests awaiting an answer", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcPendingOutputSchema).handler(({ input }) => {
|
|
10938
10938
|
const pending = deps.pendingOf(input.session);
|
|
10939
10939
|
if (input.session !== void 0 && deps.statusOf(input.session).length === 0) {
|
|
10940
10940
|
throw new import_client.ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
10941
10941
|
}
|
|
10942
10942
|
return { pending };
|
|
10943
10943
|
}),
|
|
10944
|
-
send: authed.
|
|
10945
|
-
answer: authed.
|
|
10944
|
+
send: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/send", summary: "Send one message into a session", tags: [RC_API_TAG] })).input(RcSendInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.inject(input.session, input.text)) })),
|
|
10945
|
+
answer: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/answer", summary: "Answer one pending control request", tags: [RC_API_TAG] })).input(RcAnswerInputSchema).output(RcAnswerOutputSchema).handler(async ({ input }) => {
|
|
10946
10946
|
const decision = { approve: input.approve, message: input.approve || input.text === void 0 ? void 0 : input.text };
|
|
10947
10947
|
return { session: input.session, request: input.request, sequenceNums: delivered(input.session, await deps.answer(input.session, input.request, decision)) };
|
|
10948
10948
|
}),
|
|
10949
|
-
interrupt: authed.
|
|
10950
|
-
setModel: authed.
|
|
10951
|
-
setPermissionMode: authed.
|
|
10952
|
-
endSession: authed.
|
|
10953
|
-
getUsage: authed.
|
|
10954
|
-
getContextUsage: authed.
|
|
10955
|
-
readFile: authed.
|
|
10956
|
-
fileSuggestions: authed.
|
|
10957
|
-
keepAlive: authed.
|
|
10958
|
-
mcpStatus: authed.
|
|
10959
|
-
mcpReconnect: authed.
|
|
10960
|
-
mcpAuthenticate: authed.
|
|
10961
|
-
mcpOAuthCallbackUrl: authed.
|
|
10962
|
-
teleport: authed.
|
|
10963
|
-
subscribe: authed.
|
|
10949
|
+
interrupt: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/interrupt", summary: "Interrupt a session's running turn", tags: [RC_API_TAG] })).input(RcInterruptInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.interrupt(input.session)) })),
|
|
10950
|
+
setModel: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/set-model", summary: "Switch a session's model", tags: [RC_API_TAG] })).input(RcSetModelInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.setModel(input.session, input.model)) })),
|
|
10951
|
+
setPermissionMode: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/set-permission-mode", summary: "Switch a session's permission mode", tags: [RC_API_TAG] })).input(RcSetPermissionModeInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.setPermissionMode(input.session, input.mode)) })),
|
|
10952
|
+
endSession: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/end-session", summary: "End a session", tags: [RC_API_TAG] })).input(RcEndSessionInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.endSession(input.session, input.reason)) })),
|
|
10953
|
+
getUsage: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/get-usage", summary: "Ask a session for its usage snapshot", tags: [RC_API_TAG] })).input(RcGetUsageInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.getUsage(input.session, input.skipBehaviors)) })),
|
|
10954
|
+
getContextUsage: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/get-context-usage", summary: "Ask a session for its context usage", tags: [RC_API_TAG] })).input(RcGetContextUsageInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.getContextUsage(input.session, input.detail)) })),
|
|
10955
|
+
readFile: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/read-file", summary: "Ask a session to read one file", tags: [RC_API_TAG] })).input(RcReadFileInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.readFile(input.session, input.path, { ...input.maxBytes === void 0 ? {} : { maxBytes: input.maxBytes }, ...input.encoding === void 0 ? {} : { encoding: input.encoding } })) })),
|
|
10956
|
+
fileSuggestions: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/file-suggestions", summary: "Ask a session for file-path suggestions", tags: [RC_API_TAG] })).input(RcFileSuggestionsInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.fileSuggestions(input.session, input.query)) })),
|
|
10957
|
+
keepAlive: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/keep-alive", summary: "Keep a session's bridge alive", tags: [RC_API_TAG] })).input(RcKeepAliveInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.keepAlive(input.session)) })),
|
|
10958
|
+
mcpStatus: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/mcp-status", summary: "Ask a session for its MCP servers' status", tags: [RC_API_TAG] })).input(RcMcpStatusInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpStatus(input.session)) })),
|
|
10959
|
+
mcpReconnect: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/mcp-reconnect", summary: "Ask a session to reconnect one MCP server", tags: [RC_API_TAG] })).input(RcMcpReconnectInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpReconnect(input.session, input.serverName)) })),
|
|
10960
|
+
mcpAuthenticate: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/mcp-authenticate", summary: "Start OAuth for one MCP server on a session", tags: [RC_API_TAG] })).input(RcMcpAuthenticateInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpAuthenticate(input.session, input.serverName, input.redirectUri)) })),
|
|
10961
|
+
mcpOAuthCallbackUrl: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/mcp-oauth-callback-url", summary: "Hand a completed MCP OAuth callback to a session", tags: [RC_API_TAG] })).input(RcMcpOAuthCallbackUrlInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpOAuthCallbackUrl(input.session, input.serverName, input.callbackUrl)) })),
|
|
10962
|
+
teleport: authed.meta((0, import_openapi.openapi)({ method: "POST", path: "/rest/rc/teleport", summary: "Teleport a session to a conversation marker", tags: [RC_API_TAG] })).input(RcTeleportInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.teleport(input.session, input.marker)) })),
|
|
10963
|
+
subscribe: authed.meta((0, import_openapi.openapi)({ method: "GET", path: "/rest/rc/events", summary: "Stream a session's Remote Control events (SSE)", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output((0, import_server2.eventIterator)(RcStreamEventSchema)).handler(async function* ({ input, signal }) {
|
|
10964
10964
|
const queue = [];
|
|
10965
10965
|
let wake;
|
|
10966
10966
|
const detach = deps.fanout.subscribe(input.session, (event) => {
|
|
@@ -11002,7 +11002,7 @@ function doorApiNodeHandlerOf(router, expectedToken) {
|
|
|
11002
11002
|
const rpcHandler = new import_node2.RPCHandler(router, { plugins });
|
|
11003
11003
|
const restHandler = new import_node.OpenAPIHandler(router, { plugins });
|
|
11004
11004
|
let document;
|
|
11005
|
-
const documentOf = async () => document ??= new import_openapi.OpenAPIGenerator().generate(router, { info: { title: "agent-shim front door API", version: package_default.version } });
|
|
11005
|
+
const documentOf = async () => document ??= new import_openapi.OpenAPIGenerator().generate(router, { base: { info: { title: "agent-shim front door API", version: package_default.version } } });
|
|
11006
11006
|
return {
|
|
11007
11007
|
pathPrefix: RC_ORPC_PATH_PREFIX,
|
|
11008
11008
|
handle: async (request4, response) => {
|
|
@@ -11039,10 +11039,12 @@ function createRcApiNodeHandler(deps) {
|
|
|
11039
11039
|
function frontDoorApiLink(port, ca, token) {
|
|
11040
11040
|
const dispatcher = new import_undici.Agent({ connect: { ca } });
|
|
11041
11041
|
return new import_fetch.RPCLink({
|
|
11042
|
-
|
|
11042
|
+
origin: `https://127.0.0.1:${String(port)}`,
|
|
11043
|
+
url: RC_ORPC_PATH_PREFIX,
|
|
11043
11044
|
headers: { authorization: `Bearer ${token}` },
|
|
11044
11045
|
// undici's own Request and Response types and the global ones are distinct declarations of the same standard shapes (the package's bundled types sit beside @types/node's own), and its fetch refuses the global Request instance outright, so the call is rebuilt from the request's parts and the answer re-wrapped through the global constructors, never cast between the two. The request body is one bounded JSON object (the same protocol cap the handler enforces), so reading it whole costs nothing; it is the answer that streams.
|
|
11045
|
-
fetch: async (
|
|
11046
|
+
fetch: async (url, init, options) => {
|
|
11047
|
+
const request4 = new Request(url, init);
|
|
11046
11048
|
const body = request4.body === null ? void 0 : Buffer.from(await request4.arrayBuffer());
|
|
11047
11049
|
const answered = await (0, import_undici.fetch)(request4.url, {
|
|
11048
11050
|
method: request4.method,
|
|
@@ -11065,6 +11067,7 @@ init_realPorts();
|
|
|
11065
11067
|
|
|
11066
11068
|
// src/frontdoor/controlApi.ts
|
|
11067
11069
|
var import_client3 = require("@orpc/client");
|
|
11070
|
+
var import_openapi3 = require("@orpc/openapi");
|
|
11068
11071
|
|
|
11069
11072
|
// src/checkReport.ts
|
|
11070
11073
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
@@ -12877,6 +12880,7 @@ var DoctorRunOutputSchema = import_zod19.z.strictObject({
|
|
|
12877
12880
|
|
|
12878
12881
|
// src/frontdoor/eventsApi.ts
|
|
12879
12882
|
var import_client2 = require("@orpc/client");
|
|
12883
|
+
var import_openapi2 = require("@orpc/openapi");
|
|
12880
12884
|
var import_server3 = require("@orpc/server");
|
|
12881
12885
|
|
|
12882
12886
|
// src/frontdoor/eventSchemas.ts
|
|
@@ -12923,7 +12927,7 @@ function createEventsApiRouter(deps) {
|
|
|
12923
12927
|
const authed = doorApiAuth(deps.expectedToken);
|
|
12924
12928
|
return {
|
|
12925
12929
|
events: {
|
|
12926
|
-
subscribe: authed.
|
|
12930
|
+
subscribe: authed.meta((0, import_openapi2.openapi)({ method: "GET", path: "/rest/events", summary: "Stream the door's every event source (SSE)", tags: [EVENTS_API_TAG] })).input(DoorEventSourceQuerySchema).output((0, import_server3.eventIterator)(DoorEventSchema)).handler(async function* ({ input, signal }) {
|
|
12927
12931
|
if (input.sources !== void 0) {
|
|
12928
12932
|
const live = deps.events.sources();
|
|
12929
12933
|
const unknown = input.sources.filter((source) => !live.includes(source));
|
|
@@ -12965,8 +12969,8 @@ function createControlApiRouter(deps) {
|
|
|
12965
12969
|
const authed = doorApiAuth(deps.expectedToken);
|
|
12966
12970
|
return {
|
|
12967
12971
|
usage: {
|
|
12968
|
-
list: authed.
|
|
12969
|
-
effectiveWindow: authed.
|
|
12972
|
+
list: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/usage/snapshots", summary: "List every identity's usage snapshot", tags: [USAGE_API_TAG] })).output(UsageListOutputSchema).handler(() => ({ snapshots: deps.usageSnapshots() })),
|
|
12973
|
+
effectiveWindow: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/usage/windows", summary: "Read one identity's effective quota windows", tags: [USAGE_API_TAG] })).input(UsageWindowsInputSchema).output(UsageWindowsOutputSchema).handler(({ input }) => {
|
|
12970
12974
|
const snapshot = deps.usageSnapshotOf(input.identity);
|
|
12971
12975
|
if (snapshot === void 0) {
|
|
12972
12976
|
throw new import_client3.ORPCError("NOT_FOUND", { message: `identity ${input.identity} has no usage snapshot yet, so no quota window has been observed for it` });
|
|
@@ -12983,7 +12987,7 @@ function createControlApiRouter(deps) {
|
|
|
12983
12987
|
...unified?.sevenDay === void 0 ? {} : { sevenDay: effectiveWindow(unified.sevenDay, now) }
|
|
12984
12988
|
};
|
|
12985
12989
|
}),
|
|
12986
|
-
live: authed.
|
|
12990
|
+
live: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/usage/live", summary: "Read the live rate-limit observations the event backbone files", tags: [USAGE_API_TAG] })).input(RcSessionQuerySchema).output(UsageLiveOutputSchema).handler(({ input }) => {
|
|
12987
12991
|
const sessions = deps.liveRateLimits(input.session);
|
|
12988
12992
|
if (input.session !== void 0 && sessions.length === 0) {
|
|
12989
12993
|
if (deps.list().some((session) => session.id === input.session)) {
|
|
@@ -12995,18 +12999,18 @@ function createControlApiRouter(deps) {
|
|
|
12995
12999
|
})
|
|
12996
13000
|
},
|
|
12997
13001
|
frontdoor: {
|
|
12998
|
-
status: authed.
|
|
12999
|
-
sessions: authed.
|
|
13002
|
+
status: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/frontdoor/status", summary: "Read the front door's status", tags: [FRONTDOOR_API_TAG] })).output(FrontDoorStatusOutputSchema).handler(() => deps.frontDoorStatus()),
|
|
13003
|
+
sessions: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/frontdoor/sessions", summary: "Read the front door's session registry", tags: [FRONTDOOR_API_TAG] })).output(FrontDoorSessionsOutputSchema).handler(() => ({ sessions: deps.frontDoorStatus().sessions }))
|
|
13000
13004
|
},
|
|
13001
13005
|
check: {
|
|
13002
13006
|
// The report's own JSON shape is the contract (the same one `check --json` prints and `checkReportSchema.ts` defines), so the procedure returns exactly that conversion.
|
|
13003
|
-
run: authed.
|
|
13007
|
+
run: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/check", summary: "Run the check report for one directory", tags: [CHECK_API_TAG] })).input(CheckRunInputSchema).output(CheckReportJsonSchema).handler(({ input }) => checkReportToJson(deps.checkReport(input.path, input.identity)))
|
|
13004
13008
|
},
|
|
13005
13009
|
doctor: {
|
|
13006
|
-
run: authed.
|
|
13010
|
+
run: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] })).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
|
|
13007
13011
|
},
|
|
13008
13012
|
pool: {
|
|
13009
|
-
pick: authed.
|
|
13013
|
+
pick: authed.meta((0, import_openapi3.openapi)({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] })).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input }) => {
|
|
13010
13014
|
const report = deps.poolPick(input.pool, input.path);
|
|
13011
13015
|
if (report === void 0) {
|
|
13012
13016
|
const live = deps.poolNames();
|
package/dist/index.mjs
CHANGED
|
@@ -2625,7 +2625,7 @@ var init_package = __esm({
|
|
|
2625
2625
|
"package.json"() {
|
|
2626
2626
|
package_default = {
|
|
2627
2627
|
name: "claude-use",
|
|
2628
|
-
version: "9.5.
|
|
2628
|
+
version: "9.5.1",
|
|
2629
2629
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2630
2630
|
license: "MIT",
|
|
2631
2631
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -2676,9 +2676,9 @@ var init_package = __esm({
|
|
|
2676
2676
|
dependencies: {
|
|
2677
2677
|
"@anthropic-ai/claude-agent-sdk": "0.3.292",
|
|
2678
2678
|
"@clack/prompts": "^1.8.0",
|
|
2679
|
-
"@orpc/client": "
|
|
2680
|
-
"@orpc/openapi": "
|
|
2681
|
-
"@orpc/server": "
|
|
2679
|
+
"@orpc/client": "2.0.0-beta.41",
|
|
2680
|
+
"@orpc/openapi": "2.0.0-beta.41",
|
|
2681
|
+
"@orpc/server": "2.0.0-beta.41",
|
|
2682
2682
|
commander: "^15.0.0",
|
|
2683
2683
|
cosmiconfig: "^10.0.1",
|
|
2684
2684
|
picomatch: "^4.0.7",
|
|
@@ -10397,7 +10397,7 @@ function createRcCredentialStore(fs12, dir) {
|
|
|
10397
10397
|
init_package();
|
|
10398
10398
|
import { createORPCClient, ORPCError } from "@orpc/client";
|
|
10399
10399
|
import { RPCLink } from "@orpc/client/fetch";
|
|
10400
|
-
import { OpenAPIGenerator } from "@orpc/openapi";
|
|
10400
|
+
import { openapi, OpenAPIGenerator } from "@orpc/openapi";
|
|
10401
10401
|
import { OpenAPIHandler } from "@orpc/openapi/node";
|
|
10402
10402
|
import { eventIterator, os as os2, withEventMeta } from "@orpc/server";
|
|
10403
10403
|
import { BodyLimitPlugin, RPCHandler } from "@orpc/server/node";
|
|
@@ -10601,41 +10601,41 @@ function createRcApiRouter(deps) {
|
|
|
10601
10601
|
};
|
|
10602
10602
|
return {
|
|
10603
10603
|
rc: {
|
|
10604
|
-
list: authed.
|
|
10605
|
-
status: authed.
|
|
10604
|
+
list: authed.meta(openapi({ method: "GET", path: "/rest/rc/sessions", summary: "List the observed Remote Control sessions", tags: [RC_API_TAG] })).output(RcListOutputSchema).handler(() => ({ sessions: deps.list() })),
|
|
10605
|
+
status: authed.meta(openapi({ method: "GET", path: "/rest/rc/status", summary: "Read session status, one session's when named", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcStatusOutputSchema).handler(({ input }) => {
|
|
10606
10606
|
const statuses = deps.statusOf(input.session);
|
|
10607
10607
|
if (input.session !== void 0 && !statuses.some((entry) => entry.id === input.session)) {
|
|
10608
10608
|
throw new ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
10609
10609
|
}
|
|
10610
10610
|
return { statuses };
|
|
10611
10611
|
}),
|
|
10612
|
-
pending: authed.
|
|
10612
|
+
pending: authed.meta(openapi({ method: "GET", path: "/rest/rc/pending", summary: "Read the control requests awaiting an answer", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(RcPendingOutputSchema).handler(({ input }) => {
|
|
10613
10613
|
const pending = deps.pendingOf(input.session);
|
|
10614
10614
|
if (input.session !== void 0 && deps.statusOf(input.session).length === 0) {
|
|
10615
10615
|
throw new ORPCError("NOT_FOUND", { message: rcSessionNotObservedMessage(input.session) });
|
|
10616
10616
|
}
|
|
10617
10617
|
return { pending };
|
|
10618
10618
|
}),
|
|
10619
|
-
send: authed.
|
|
10620
|
-
answer: authed.
|
|
10619
|
+
send: authed.meta(openapi({ method: "POST", path: "/rest/rc/send", summary: "Send one message into a session", tags: [RC_API_TAG] })).input(RcSendInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.inject(input.session, input.text)) })),
|
|
10620
|
+
answer: authed.meta(openapi({ method: "POST", path: "/rest/rc/answer", summary: "Answer one pending control request", tags: [RC_API_TAG] })).input(RcAnswerInputSchema).output(RcAnswerOutputSchema).handler(async ({ input }) => {
|
|
10621
10621
|
const decision = { approve: input.approve, message: input.approve || input.text === void 0 ? void 0 : input.text };
|
|
10622
10622
|
return { session: input.session, request: input.request, sequenceNums: delivered(input.session, await deps.answer(input.session, input.request, decision)) };
|
|
10623
10623
|
}),
|
|
10624
|
-
interrupt: authed.
|
|
10625
|
-
setModel: authed.
|
|
10626
|
-
setPermissionMode: authed.
|
|
10627
|
-
endSession: authed.
|
|
10628
|
-
getUsage: authed.
|
|
10629
|
-
getContextUsage: authed.
|
|
10630
|
-
readFile: authed.
|
|
10631
|
-
fileSuggestions: authed.
|
|
10632
|
-
keepAlive: authed.
|
|
10633
|
-
mcpStatus: authed.
|
|
10634
|
-
mcpReconnect: authed.
|
|
10635
|
-
mcpAuthenticate: authed.
|
|
10636
|
-
mcpOAuthCallbackUrl: authed.
|
|
10637
|
-
teleport: authed.
|
|
10638
|
-
subscribe: authed.
|
|
10624
|
+
interrupt: authed.meta(openapi({ method: "POST", path: "/rest/rc/interrupt", summary: "Interrupt a session's running turn", tags: [RC_API_TAG] })).input(RcInterruptInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.interrupt(input.session)) })),
|
|
10625
|
+
setModel: authed.meta(openapi({ method: "POST", path: "/rest/rc/set-model", summary: "Switch a session's model", tags: [RC_API_TAG] })).input(RcSetModelInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.setModel(input.session, input.model)) })),
|
|
10626
|
+
setPermissionMode: authed.meta(openapi({ method: "POST", path: "/rest/rc/set-permission-mode", summary: "Switch a session's permission mode", tags: [RC_API_TAG] })).input(RcSetPermissionModeInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.setPermissionMode(input.session, input.mode)) })),
|
|
10627
|
+
endSession: authed.meta(openapi({ method: "POST", path: "/rest/rc/end-session", summary: "End a session", tags: [RC_API_TAG] })).input(RcEndSessionInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.endSession(input.session, input.reason)) })),
|
|
10628
|
+
getUsage: authed.meta(openapi({ method: "POST", path: "/rest/rc/get-usage", summary: "Ask a session for its usage snapshot", tags: [RC_API_TAG] })).input(RcGetUsageInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.getUsage(input.session, input.skipBehaviors)) })),
|
|
10629
|
+
getContextUsage: authed.meta(openapi({ method: "POST", path: "/rest/rc/get-context-usage", summary: "Ask a session for its context usage", tags: [RC_API_TAG] })).input(RcGetContextUsageInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.getContextUsage(input.session, input.detail)) })),
|
|
10630
|
+
readFile: authed.meta(openapi({ method: "POST", path: "/rest/rc/read-file", summary: "Ask a session to read one file", tags: [RC_API_TAG] })).input(RcReadFileInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.readFile(input.session, input.path, { ...input.maxBytes === void 0 ? {} : { maxBytes: input.maxBytes }, ...input.encoding === void 0 ? {} : { encoding: input.encoding } })) })),
|
|
10631
|
+
fileSuggestions: authed.meta(openapi({ method: "POST", path: "/rest/rc/file-suggestions", summary: "Ask a session for file-path suggestions", tags: [RC_API_TAG] })).input(RcFileSuggestionsInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.fileSuggestions(input.session, input.query)) })),
|
|
10632
|
+
keepAlive: authed.meta(openapi({ method: "POST", path: "/rest/rc/keep-alive", summary: "Keep a session's bridge alive", tags: [RC_API_TAG] })).input(RcKeepAliveInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.keepAlive(input.session)) })),
|
|
10633
|
+
mcpStatus: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-status", summary: "Ask a session for its MCP servers' status", tags: [RC_API_TAG] })).input(RcMcpStatusInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpStatus(input.session)) })),
|
|
10634
|
+
mcpReconnect: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-reconnect", summary: "Ask a session to reconnect one MCP server", tags: [RC_API_TAG] })).input(RcMcpReconnectInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpReconnect(input.session, input.serverName)) })),
|
|
10635
|
+
mcpAuthenticate: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-authenticate", summary: "Start OAuth for one MCP server on a session", tags: [RC_API_TAG] })).input(RcMcpAuthenticateInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpAuthenticate(input.session, input.serverName, input.redirectUri)) })),
|
|
10636
|
+
mcpOAuthCallbackUrl: authed.meta(openapi({ method: "POST", path: "/rest/rc/mcp-oauth-callback-url", summary: "Hand a completed MCP OAuth callback to a session", tags: [RC_API_TAG] })).input(RcMcpOAuthCallbackUrlInputSchema).output(RcControlWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, ...deliveredControl(input.session, await deps.mcpOAuthCallbackUrl(input.session, input.serverName, input.callbackUrl)) })),
|
|
10637
|
+
teleport: authed.meta(openapi({ method: "POST", path: "/rest/rc/teleport", summary: "Teleport a session to a conversation marker", tags: [RC_API_TAG] })).input(RcTeleportInputSchema).output(RcWriteOutputSchema).handler(async ({ input }) => ({ session: input.session, sequenceNums: delivered(input.session, await deps.teleport(input.session, input.marker)) })),
|
|
10638
|
+
subscribe: authed.meta(openapi({ method: "GET", path: "/rest/rc/events", summary: "Stream a session's Remote Control events (SSE)", tags: [RC_API_TAG] })).input(RcSessionQuerySchema).output(eventIterator(RcStreamEventSchema)).handler(async function* ({ input, signal }) {
|
|
10639
10639
|
const queue = [];
|
|
10640
10640
|
let wake;
|
|
10641
10641
|
const detach = deps.fanout.subscribe(input.session, (event) => {
|
|
@@ -10677,7 +10677,7 @@ function doorApiNodeHandlerOf(router, expectedToken) {
|
|
|
10677
10677
|
const rpcHandler = new RPCHandler(router, { plugins });
|
|
10678
10678
|
const restHandler = new OpenAPIHandler(router, { plugins });
|
|
10679
10679
|
let document;
|
|
10680
|
-
const documentOf = async () => document ??= new OpenAPIGenerator().generate(router, { info: { title: "agent-shim front door API", version: package_default.version } });
|
|
10680
|
+
const documentOf = async () => document ??= new OpenAPIGenerator().generate(router, { base: { info: { title: "agent-shim front door API", version: package_default.version } } });
|
|
10681
10681
|
return {
|
|
10682
10682
|
pathPrefix: RC_ORPC_PATH_PREFIX,
|
|
10683
10683
|
handle: async (request4, response) => {
|
|
@@ -10714,10 +10714,12 @@ function createRcApiNodeHandler(deps) {
|
|
|
10714
10714
|
function frontDoorApiLink(port, ca, token) {
|
|
10715
10715
|
const dispatcher = new Agent3({ connect: { ca } });
|
|
10716
10716
|
return new RPCLink({
|
|
10717
|
-
|
|
10717
|
+
origin: `https://127.0.0.1:${String(port)}`,
|
|
10718
|
+
url: RC_ORPC_PATH_PREFIX,
|
|
10718
10719
|
headers: { authorization: `Bearer ${token}` },
|
|
10719
10720
|
// undici's own Request and Response types and the global ones are distinct declarations of the same standard shapes (the package's bundled types sit beside @types/node's own), and its fetch refuses the global Request instance outright, so the call is rebuilt from the request's parts and the answer re-wrapped through the global constructors, never cast between the two. The request body is one bounded JSON object (the same protocol cap the handler enforces), so reading it whole costs nothing; it is the answer that streams.
|
|
10720
|
-
fetch: async (
|
|
10721
|
+
fetch: async (url, init, options) => {
|
|
10722
|
+
const request4 = new Request(url, init);
|
|
10721
10723
|
const body = request4.body === null ? void 0 : Buffer.from(await request4.arrayBuffer());
|
|
10722
10724
|
const answered = await undiciFetch(request4.url, {
|
|
10723
10725
|
method: request4.method,
|
|
@@ -10740,6 +10742,7 @@ init_realPorts();
|
|
|
10740
10742
|
|
|
10741
10743
|
// src/frontdoor/controlApi.ts
|
|
10742
10744
|
import { createORPCClient as createORPCClient2, ORPCError as ORPCError3 } from "@orpc/client";
|
|
10745
|
+
import { openapi as openapi3 } from "@orpc/openapi";
|
|
10743
10746
|
|
|
10744
10747
|
// src/checkReport.ts
|
|
10745
10748
|
init_classify();
|
|
@@ -12552,6 +12555,7 @@ var DoctorRunOutputSchema = z19.strictObject({
|
|
|
12552
12555
|
|
|
12553
12556
|
// src/frontdoor/eventsApi.ts
|
|
12554
12557
|
import { ORPCError as ORPCError2 } from "@orpc/client";
|
|
12558
|
+
import { openapi as openapi2 } from "@orpc/openapi";
|
|
12555
12559
|
import { eventIterator as eventIterator2, withEventMeta as withEventMeta2 } from "@orpc/server";
|
|
12556
12560
|
|
|
12557
12561
|
// src/frontdoor/eventSchemas.ts
|
|
@@ -12598,7 +12602,7 @@ function createEventsApiRouter(deps) {
|
|
|
12598
12602
|
const authed = doorApiAuth(deps.expectedToken);
|
|
12599
12603
|
return {
|
|
12600
12604
|
events: {
|
|
12601
|
-
subscribe: authed.
|
|
12605
|
+
subscribe: authed.meta(openapi2({ method: "GET", path: "/rest/events", summary: "Stream the door's every event source (SSE)", tags: [EVENTS_API_TAG] })).input(DoorEventSourceQuerySchema).output(eventIterator2(DoorEventSchema)).handler(async function* ({ input, signal }) {
|
|
12602
12606
|
if (input.sources !== void 0) {
|
|
12603
12607
|
const live = deps.events.sources();
|
|
12604
12608
|
const unknown = input.sources.filter((source) => !live.includes(source));
|
|
@@ -12640,8 +12644,8 @@ function createControlApiRouter(deps) {
|
|
|
12640
12644
|
const authed = doorApiAuth(deps.expectedToken);
|
|
12641
12645
|
return {
|
|
12642
12646
|
usage: {
|
|
12643
|
-
list: authed.
|
|
12644
|
-
effectiveWindow: authed.
|
|
12647
|
+
list: authed.meta(openapi3({ method: "GET", path: "/rest/usage/snapshots", summary: "List every identity's usage snapshot", tags: [USAGE_API_TAG] })).output(UsageListOutputSchema).handler(() => ({ snapshots: deps.usageSnapshots() })),
|
|
12648
|
+
effectiveWindow: authed.meta(openapi3({ method: "GET", path: "/rest/usage/windows", summary: "Read one identity's effective quota windows", tags: [USAGE_API_TAG] })).input(UsageWindowsInputSchema).output(UsageWindowsOutputSchema).handler(({ input }) => {
|
|
12645
12649
|
const snapshot = deps.usageSnapshotOf(input.identity);
|
|
12646
12650
|
if (snapshot === void 0) {
|
|
12647
12651
|
throw new ORPCError3("NOT_FOUND", { message: `identity ${input.identity} has no usage snapshot yet, so no quota window has been observed for it` });
|
|
@@ -12658,7 +12662,7 @@ function createControlApiRouter(deps) {
|
|
|
12658
12662
|
...unified?.sevenDay === void 0 ? {} : { sevenDay: effectiveWindow(unified.sevenDay, now) }
|
|
12659
12663
|
};
|
|
12660
12664
|
}),
|
|
12661
|
-
live: authed.
|
|
12665
|
+
live: authed.meta(openapi3({ method: "GET", path: "/rest/usage/live", summary: "Read the live rate-limit observations the event backbone files", tags: [USAGE_API_TAG] })).input(RcSessionQuerySchema).output(UsageLiveOutputSchema).handler(({ input }) => {
|
|
12662
12666
|
const sessions = deps.liveRateLimits(input.session);
|
|
12663
12667
|
if (input.session !== void 0 && sessions.length === 0) {
|
|
12664
12668
|
if (deps.list().some((session) => session.id === input.session)) {
|
|
@@ -12670,18 +12674,18 @@ function createControlApiRouter(deps) {
|
|
|
12670
12674
|
})
|
|
12671
12675
|
},
|
|
12672
12676
|
frontdoor: {
|
|
12673
|
-
status: authed.
|
|
12674
|
-
sessions: authed.
|
|
12677
|
+
status: authed.meta(openapi3({ method: "GET", path: "/rest/frontdoor/status", summary: "Read the front door's status", tags: [FRONTDOOR_API_TAG] })).output(FrontDoorStatusOutputSchema).handler(() => deps.frontDoorStatus()),
|
|
12678
|
+
sessions: authed.meta(openapi3({ method: "GET", path: "/rest/frontdoor/sessions", summary: "Read the front door's session registry", tags: [FRONTDOOR_API_TAG] })).output(FrontDoorSessionsOutputSchema).handler(() => ({ sessions: deps.frontDoorStatus().sessions }))
|
|
12675
12679
|
},
|
|
12676
12680
|
check: {
|
|
12677
12681
|
// The report's own JSON shape is the contract (the same one `check --json` prints and `checkReportSchema.ts` defines), so the procedure returns exactly that conversion.
|
|
12678
|
-
run: authed.
|
|
12682
|
+
run: authed.meta(openapi3({ method: "GET", path: "/rest/check", summary: "Run the check report for one directory", tags: [CHECK_API_TAG] })).input(CheckRunInputSchema).output(CheckReportJsonSchema).handler(({ input }) => checkReportToJson(deps.checkReport(input.path, input.identity)))
|
|
12679
12683
|
},
|
|
12680
12684
|
doctor: {
|
|
12681
|
-
run: authed.
|
|
12685
|
+
run: authed.meta(openapi3({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] })).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
|
|
12682
12686
|
},
|
|
12683
12687
|
pool: {
|
|
12684
|
-
pick: authed.
|
|
12688
|
+
pick: authed.meta(openapi3({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] })).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input }) => {
|
|
12685
12689
|
const report = deps.poolPick(input.pool, input.path);
|
|
12686
12690
|
if (report === void 0) {
|
|
12687
12691
|
const live = deps.poolNames();
|