@nuvin/session 0.1.0-rc.9 → 0.1.1-rc.0
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/chunk-7HGJO7ZX.js +9 -0
- package/dist/{chunk-FR3R66RD.js → chunk-COVRYM64.js} +24 -4
- package/dist/chunk-HJLRL64D.js +13 -0
- package/dist/{chunk-3IPZO7LP.js → chunk-TUNCGICQ.js} +19 -1
- package/dist/{chunk-3J44LBXZ.js → chunk-WB4FEWBI.js} +1 -1
- package/dist/client/daemon-client.d.ts +50 -0
- package/dist/client/daemon-client.d.ts.map +1 -0
- package/dist/client/data-client.d.ts +21 -3
- package/dist/client/data-client.d.ts.map +1 -1
- package/dist/client/directory.d.ts +7 -12
- package/dist/client/directory.d.ts.map +1 -1
- package/dist/client/http-data-client.d.ts +2 -0
- package/dist/client/http-data-client.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1300 -979
- package/dist/client/session-client.d.ts +19 -6
- package/dist/client/session-client.d.ts.map +1 -1
- package/dist/client/transport.d.ts +18 -2
- package/dist/client/transport.d.ts.map +1 -1
- package/dist/client/websocket.d.ts +5 -0
- package/dist/client/websocket.d.ts.map +1 -1
- package/dist/controller/index.js +129 -40
- package/dist/controller/session-controller.d.ts +18 -5
- package/dist/controller/session-controller.d.ts.map +1 -1
- package/dist/grant/index.d.ts +1 -1
- package/dist/grant/index.d.ts.map +1 -1
- package/dist/grant/index.js +2 -1
- package/dist/protocol/data-rpc.d.ts +70 -3
- package/dist/protocol/data-rpc.d.ts.map +1 -1
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +12 -3
- package/dist/protocol/model-identity.d.ts +7 -0
- package/dist/protocol/model-identity.d.ts.map +1 -0
- package/dist/protocol/types.d.ts +176 -83
- package/dist/protocol/types.d.ts.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/state/approvals.d.ts +6 -3
- package/dist/state/approvals.d.ts.map +1 -1
- package/dist/state/index.js +5 -1
- package/dist/state/messages.d.ts.map +1 -1
- package/dist/state/session.d.ts.map +1 -1
- package/dist/state/tool-preview.d.ts.map +1 -1
- package/dist/state/tool-preview.js +65 -1
- package/dist/test-utils/fake-relay.d.ts.map +1 -1
- package/dist/test-utils/index.js +6 -4
- package/package.json +5 -4
- package/dist/chunk-NN43LVAS.js +0 -0
|
@@ -10,12 +10,26 @@ var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
|
10
10
|
"WebFetch",
|
|
11
11
|
"WebSearch"
|
|
12
12
|
]);
|
|
13
|
-
var BACKGROUNDLESS_TOOLS = /* @__PURE__ */ new Set([
|
|
13
|
+
var BACKGROUNDLESS_TOOLS = /* @__PURE__ */ new Set([
|
|
14
|
+
...READ_ONLY_TOOLS,
|
|
15
|
+
"FileNew",
|
|
16
|
+
"TodoWrite",
|
|
17
|
+
"UpdateTopic",
|
|
18
|
+
"MemorySave",
|
|
19
|
+
"MemoryQuery",
|
|
20
|
+
"InvokeCommand"
|
|
21
|
+
]);
|
|
14
22
|
var INTERACTIVE_TOOLS = /* @__PURE__ */ new Set(["AskUserTool", "TodoWrite", "UpdateTopic"]);
|
|
15
23
|
var AUTO_APPROVED_TOOLS = /* @__PURE__ */ new Set([...READ_ONLY_TOOLS, ...INTERACTIVE_TOOLS]);
|
|
16
24
|
function isAutoApprovedTool(toolName) {
|
|
17
25
|
return AUTO_APPROVED_TOOLS.has(toolName);
|
|
18
26
|
}
|
|
27
|
+
var EDIT_TOOLS = /* @__PURE__ */ new Set(["FileEdit", "FileNew"]);
|
|
28
|
+
function isToolAutoApprovedForMode(mode, toolName, baselineAutoApproved = isAutoApprovedTool) {
|
|
29
|
+
if (mode === "sudo") return true;
|
|
30
|
+
if (mode === "acceptEdits" && EDIT_TOOLS.has(toolName)) return true;
|
|
31
|
+
return baselineAutoApproved(toolName);
|
|
32
|
+
}
|
|
19
33
|
function createApprovalQueueState() {
|
|
20
34
|
return { active: null, pending: [] };
|
|
21
35
|
}
|
|
@@ -268,6 +282,7 @@ function setToolMessageHidden(state, toolCallId, hidden) {
|
|
|
268
282
|
});
|
|
269
283
|
}
|
|
270
284
|
function applyToolResult(state, result, now) {
|
|
285
|
+
const status = asJsonObject(result.structured)?.error === "tool_rejected" ? "rejected" : result.status;
|
|
271
286
|
const toolMessageId = state.toolMessageIds[result.callId];
|
|
272
287
|
if (!toolMessageId) {
|
|
273
288
|
const id = createMessageId(state);
|
|
@@ -277,7 +292,7 @@ function applyToolResult(state, result, now) {
|
|
|
277
292
|
role: "tool",
|
|
278
293
|
toolName: result.toolName,
|
|
279
294
|
toolCallId: result.callId,
|
|
280
|
-
status
|
|
295
|
+
status,
|
|
281
296
|
summary: "",
|
|
282
297
|
text: result.output,
|
|
283
298
|
structured: result.structured
|
|
@@ -297,7 +312,7 @@ function applyToolResult(state, result, now) {
|
|
|
297
312
|
return {
|
|
298
313
|
...message,
|
|
299
314
|
completedAt: message.completedAt ?? now,
|
|
300
|
-
status
|
|
315
|
+
status,
|
|
301
316
|
text: mergeToolResultText(message.text, result),
|
|
302
317
|
structured: result.structured,
|
|
303
318
|
hidden: false,
|
|
@@ -576,8 +591,9 @@ function createSessionViewState() {
|
|
|
576
591
|
approval: createApprovalQueueState(),
|
|
577
592
|
authFlow: null,
|
|
578
593
|
busy: false,
|
|
594
|
+
mcp: { revision: 0, servers: [], pending: null, error: null },
|
|
579
595
|
messages: createMessageState(),
|
|
580
|
-
meta: { approvalMode: "ask before tools", cwd: "",
|
|
596
|
+
meta: { approvalMode: "ask before tools", cwd: "", modelIdentity: "", persona: "default" },
|
|
581
597
|
metrics: null,
|
|
582
598
|
queuedCount: 0,
|
|
583
599
|
queued: [],
|
|
@@ -641,6 +657,8 @@ function reduceSessionEvent(state, event) {
|
|
|
641
657
|
return { ...state, metrics: event.snapshot };
|
|
642
658
|
case "auth-flow":
|
|
643
659
|
return { ...state, authFlow: event.flow };
|
|
660
|
+
case "mcp-state":
|
|
661
|
+
return event.state.revision > state.mcp.revision ? { ...state, mcp: event.state } : state;
|
|
644
662
|
case "workflow-progress": {
|
|
645
663
|
const prev = state.workflows[event.runId] ?? createWorkflowViewState(event.runId);
|
|
646
664
|
return {
|
|
@@ -659,6 +677,8 @@ export {
|
|
|
659
677
|
READ_ONLY_TOOLS,
|
|
660
678
|
BACKGROUNDLESS_TOOLS,
|
|
661
679
|
isAutoApprovedTool,
|
|
680
|
+
EDIT_TOOLS,
|
|
681
|
+
isToolAutoApprovedForMode,
|
|
662
682
|
createApprovalQueueState,
|
|
663
683
|
enqueueApproval,
|
|
664
684
|
dequeueActiveApproval,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/protocol/types.ts
|
|
2
|
+
var GRANT_CAPABILITIES = ["manage-provider-auth"];
|
|
3
|
+
var PROVIDER_SURFACE_IDS = [
|
|
4
|
+
"anthropic-messages",
|
|
5
|
+
"openai-chat-completions",
|
|
6
|
+
"openai-responses",
|
|
7
|
+
"openai-responses-ws"
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
GRANT_CAPABILITIES,
|
|
12
|
+
PROVIDER_SURFACE_IDS
|
|
13
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GRANT_CAPABILITIES
|
|
3
|
+
} from "./chunk-HJLRL64D.js";
|
|
4
|
+
|
|
1
5
|
// src/grant/index.ts
|
|
2
6
|
import { createPrivateKey, createPublicKey, generateKeyPairSync, sign, verify } from "crypto";
|
|
3
7
|
var DEFAULT_GRANT_SKEW_MS = 5 * 60 * 1e3;
|
|
@@ -18,10 +22,24 @@ function signGrant(payload, privateKeyBase64) {
|
|
|
18
22
|
const signature = sign(null, body, key);
|
|
19
23
|
return `${body.toString("base64url")}.${signature.toString("base64url")}`;
|
|
20
24
|
}
|
|
25
|
+
var KNOWN_GRANT_CAPABILITIES = new Set(GRANT_CAPABILITIES);
|
|
26
|
+
var isGrantCapabilities = (value) => {
|
|
27
|
+
if (value === void 0) return true;
|
|
28
|
+
if (!Array.isArray(value)) return false;
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
for (const entry of value) {
|
|
31
|
+
if (typeof entry !== "string" || entry === "" || !KNOWN_GRANT_CAPABILITIES.has(entry)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (seen.has(entry)) return false;
|
|
35
|
+
seen.add(entry);
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
21
39
|
var isGrantPayload = (value) => {
|
|
22
40
|
if (typeof value !== "object" || value === null) return false;
|
|
23
41
|
const record = value;
|
|
24
|
-
return typeof record.daemonId === "string" && typeof record.userId === "string" && typeof record.grantId === "string" && typeof record.issuedAt === "number" && typeof record.expiresAt === "number";
|
|
42
|
+
return typeof record.daemonId === "string" && typeof record.userId === "string" && typeof record.grantId === "string" && typeof record.issuedAt === "number" && typeof record.expiresAt === "number" && isGrantCapabilities(record.capabilities);
|
|
25
43
|
};
|
|
26
44
|
function verifyGrant(grant, opts) {
|
|
27
45
|
const now = opts.now ?? Date.now();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DaemonDataClient } from "./data-client.ts";
|
|
2
|
+
import type { DirectoryServerConfig } from "./directory.ts";
|
|
3
|
+
import { type SessionClient } from "./session-client.ts";
|
|
4
|
+
import { type TransportSocket } from "./socket.ts";
|
|
5
|
+
import { type WebSocketClientTransport, type WebSocketTransportOptions } from "./websocket.ts";
|
|
6
|
+
export type DaemonTarget = {
|
|
7
|
+
kind: "local";
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
socketPath: string;
|
|
11
|
+
token: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "direct";
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
wsUrl: string;
|
|
17
|
+
token: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "relay";
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
apiBaseUrl: string;
|
|
23
|
+
getAccessToken: () => Promise<string>;
|
|
24
|
+
refreshAccessToken: () => Promise<string>;
|
|
25
|
+
};
|
|
26
|
+
export type DaemonClientDeps = {
|
|
27
|
+
udsFetch?: (socketPath: string) => typeof fetch;
|
|
28
|
+
fetchImpl?: typeof fetch;
|
|
29
|
+
socketFactory?: (url: string) => TransportSocket;
|
|
30
|
+
};
|
|
31
|
+
export type DropDaemonId<F> = F extends (daemonId: string, ...args: infer A) => infer R ? (...args: A) => R : never;
|
|
32
|
+
export type BoundDaemonDataClient = {
|
|
33
|
+
[K in keyof DaemonDataClient]: DropDaemonId<DaemonDataClient[K]>;
|
|
34
|
+
};
|
|
35
|
+
export type SessionConnection = {
|
|
36
|
+
client: SessionClient;
|
|
37
|
+
transport: WebSocketClientTransport;
|
|
38
|
+
close(): void;
|
|
39
|
+
};
|
|
40
|
+
export type SessionConnectionOptions = Pick<WebSocketTransportOptions, "onDetached" | "onRejected">;
|
|
41
|
+
export interface DaemonClient {
|
|
42
|
+
readonly target: DaemonTarget;
|
|
43
|
+
readonly data: BoundDaemonDataClient;
|
|
44
|
+
directoryEndpoint(): DirectoryServerConfig;
|
|
45
|
+
openSession(sessionId: string, options?: SessionConnectionOptions): SessionConnection;
|
|
46
|
+
close(): void;
|
|
47
|
+
}
|
|
48
|
+
export declare function bindDaemonDataClient(client: DaemonDataClient, daemonId: string): BoundDaemonDataClient;
|
|
49
|
+
export declare function createDaemonClient(target: DaemonTarget, deps?: DaemonClientDeps): DaemonClient;
|
|
50
|
+
//# sourceMappingURL=daemon-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-client.d.ts","sourceRoot":"","sources":["../../src/client/daemon-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,C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,CAAC,KAAK,CAAC,GACjB,KAAK,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG;KACjC,CAAC,IAAI,MAAM,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,wBAAwB,CAAC;IACpC,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC;AAEpG,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,iBAAiB,IAAI,qBAAqB,CAAC;IAC3C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CAAC;IACtF,KAAK,IAAI,IAAI,CAAC;CACf;AASD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAiBvB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,IAAI,GAAE,gBAAqB,GAC1B,YAAY,CA8Md"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DaemonDirectoryRow, HistoryPage, SessionSnapshot,
|
|
1
|
+
import type { AddProviderInput, ConfigMutationResult, DaemonDirectoryRow, HistoryPage, ProfileSummary, ProviderConfigSummary, ProviderCredentialInput, SessionSnapshot, UpdateWorkspaceInput, WorkspaceConfigSummary } from "../protocol/index.ts";
|
|
2
2
|
import type { TransportCredential } from "./endpoint.ts";
|
|
3
3
|
/** Discovery payload: the daemon directory (account-scoped cloud, machine-scoped local). */
|
|
4
4
|
export type DaemonDirectory = {
|
|
@@ -45,16 +45,34 @@ export interface DaemonDataClient {
|
|
|
45
45
|
}): Promise<HistoryPage>;
|
|
46
46
|
listWorkspaces(daemonId: string, opts?: {
|
|
47
47
|
profile?: string;
|
|
48
|
-
}): Promise<
|
|
48
|
+
}): Promise<WorkspaceConfigSummary[]>;
|
|
49
49
|
createWorkspace(daemonId: string, opts: {
|
|
50
50
|
name: string;
|
|
51
51
|
root?: string;
|
|
52
52
|
profile?: string;
|
|
53
|
-
}): Promise<
|
|
53
|
+
}): Promise<WorkspaceConfigSummary>;
|
|
54
54
|
deleteSession(daemonId: string, historyId: string, opts?: {
|
|
55
55
|
workspace?: string;
|
|
56
56
|
profile?: string;
|
|
57
57
|
}): Promise<void>;
|
|
58
|
+
listProfiles(daemonId: string): Promise<ProfileSummary[]>;
|
|
59
|
+
listProviders(daemonId: string, opts?: {
|
|
60
|
+
profile?: string;
|
|
61
|
+
}): Promise<ProviderConfigSummary[]>;
|
|
62
|
+
addProvider(daemonId: string, input: AddProviderInput): Promise<ConfigMutationResult<ProviderConfigSummary>>;
|
|
63
|
+
removeProvider(daemonId: string, providerId: string, opts?: {
|
|
64
|
+
profile?: string;
|
|
65
|
+
}): Promise<ConfigMutationResult<null>>;
|
|
66
|
+
setDefaultProvider(daemonId: string, providerId: string, opts?: {
|
|
67
|
+
profile?: string;
|
|
68
|
+
}): Promise<ConfigMutationResult<null>>;
|
|
69
|
+
setProviderAuth(daemonId: string, providerId: string, credential: ProviderCredentialInput, opts?: {
|
|
70
|
+
profile?: string;
|
|
71
|
+
}): Promise<ConfigMutationResult<null>>;
|
|
72
|
+
clearProviderAuth(daemonId: string, providerId: string, opts?: {
|
|
73
|
+
profile?: string;
|
|
74
|
+
}): Promise<ConfigMutationResult<null>>;
|
|
75
|
+
updateWorkspace(daemonId: string, name: string, patch: UpdateWorkspaceInput): Promise<ConfigMutationResult<WorkspaceConfigSummary>>;
|
|
58
76
|
}
|
|
59
77
|
/** The full client both web modes compose (spec §4.2). */
|
|
60
78
|
export type DataClient = DaemonDirectoryClient & DaemonDataClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../../src/client/data-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../../src/client/data-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,4FAA4F;AAC5F,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE9E;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5D;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9C,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5B,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;Q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oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,kBAAkB,CAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,uBAAuB,EACnC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,iBAAiB,CACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,sBAAsB,CAAC,CAAC,CAAC;CAC1D;AAED,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SessionDescriptor } from "../protocol/types.ts";
|
|
2
|
+
import type { SessionApprovalMode } from "../state/approvals.ts";
|
|
2
3
|
import type { GetEndpoint } from "./endpoint.ts";
|
|
3
4
|
import { type TransportSocket } from "./socket.ts";
|
|
4
5
|
/**
|
|
@@ -47,7 +48,7 @@ export type ServerDirectoryOptions = {
|
|
|
47
48
|
* Multi-server session listing for the picker (spec §7). One directory socket
|
|
48
49
|
* per configured server: hello/welcome handshake (token in the hello frame,
|
|
49
50
|
* NEVER the URL — spec §4.1), then `list-sessions` and the pre-attach
|
|
50
|
-
*
|
|
51
|
+
* commands. Directory sockets never carry session traffic —
|
|
51
52
|
* attaching to a picked session opens a fresh WebSocketTransport.
|
|
52
53
|
*
|
|
53
54
|
* Failure policy (spec §8): auth/version rejections, timeouts, and dropped
|
|
@@ -74,6 +75,10 @@ export interface ServerDirectory {
|
|
|
74
75
|
name?: string;
|
|
75
76
|
workspace?: string;
|
|
76
77
|
profile?: string;
|
|
78
|
+
headless?: true;
|
|
79
|
+
approvalMode?: SessionApprovalMode;
|
|
80
|
+
activeProvider?: string;
|
|
81
|
+
activeModel?: string;
|
|
77
82
|
}): Promise<SessionDescriptor>;
|
|
78
83
|
/**
|
|
79
84
|
* Switch-and-resume a cold session (spec §3/§5): issues `resume-session` and
|
|
@@ -93,16 +98,6 @@ export interface ServerDirectory {
|
|
|
93
98
|
}): Promise<void>;
|
|
94
99
|
/** Remote cwd completion for the new-session flow (spec §7). */
|
|
95
100
|
completePath(server: string, prefix: string): Promise<string[]>;
|
|
96
|
-
/** List the SELECTED server's config profiles (per-daemon) for the new-session screen. */
|
|
97
|
-
listProfiles(server: string): Promise<ProfileSummary[]>;
|
|
98
|
-
/** List the SELECTED server's configured providers (web spec §7). */
|
|
99
|
-
listProviders(server: string): Promise<ProviderSummary[]>;
|
|
100
|
-
/** Set the server's default provider; the daemon reloads running sessions like reload-config. */
|
|
101
|
-
setDefaultProvider(server: string, providerId: string): Promise<void>;
|
|
102
|
-
/** Store a provider credential on the daemon (transits the wire; stored only daemon-side). */
|
|
103
|
-
setProviderAuth(server: string, providerId: string, credential: string): Promise<void>;
|
|
104
|
-
/** Remove a provider's stored credential on the daemon. */
|
|
105
|
-
clearProviderAuth(server: string, providerId: string): Promise<void>;
|
|
106
101
|
close(): void;
|
|
107
102
|
}
|
|
108
103
|
export declare function createServerDirectory(options: ServerDirectoryOptions): ServerDirectory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/client/directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/client/directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,kFAAkF;IAClF,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,eAAe,CAAC;CAClD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,GACvB;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAAE,GAClD;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,mGAAmG;IACnG,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MA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M,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,KAAK,IAAI,IAAI,CAAC;CACf;AAqDD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAwZtF"}
|
|
@@ -4,6 +4,8 @@ export type HttpDataClientOptions = {
|
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
/** Cloud: fresh Clerk JWT per request. Absent ⇒ no bearer on discovery. */
|
|
6
6
|
getToken?: () => Promise<string | null>;
|
|
7
|
+
/** Cloud relay: force-refresh after the first rejected /connect token. */
|
|
8
|
+
refreshAccessToken?: () => Promise<string | null>;
|
|
7
9
|
/** Cloud: 401 anywhere ⇒ route to /sign-in with return-to. */
|
|
8
10
|
onUnauthorized?: () => void;
|
|
9
11
|
fetchImpl?: typeof fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-data-client.d.ts","sourceRoot":"","sources":["../../src/client/http-data-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-data-client.d.ts","sourceRoot":"","sources":["../../src/client/http-data-client.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmC,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGpF,MAAM,MAAM,qBAAqB,GAAG;IAClC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAClD,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AA0CD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,UAAU,CAuSpF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|