pilotswarm 0.0.1 → 0.4.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/README.md +37 -1
- package/mcp/README.md +484 -0
- package/mcp/dist/bin/pilotswarm-mcp.d.ts +3 -0
- package/mcp/dist/bin/pilotswarm-mcp.d.ts.map +1 -0
- package/mcp/dist/bin/pilotswarm-mcp.js +367 -0
- package/mcp/dist/bin/pilotswarm-mcp.js.map +1 -0
- package/mcp/dist/src/auth.d.ts +7 -0
- package/mcp/dist/src/auth.d.ts.map +1 -0
- package/mcp/dist/src/auth.js +99 -0
- package/mcp/dist/src/auth.js.map +1 -0
- package/mcp/dist/src/context.d.ts +48 -0
- package/mcp/dist/src/context.d.ts.map +1 -0
- package/mcp/dist/src/context.js +83 -0
- package/mcp/dist/src/context.js.map +1 -0
- package/mcp/dist/src/index.d.ts +4 -0
- package/mcp/dist/src/index.d.ts.map +1 -0
- package/mcp/dist/src/index.js +3 -0
- package/mcp/dist/src/index.js.map +1 -0
- package/mcp/dist/src/prompts/skills.d.ts +4 -0
- package/mcp/dist/src/prompts/skills.d.ts.map +1 -0
- package/mcp/dist/src/prompts/skills.js +11 -0
- package/mcp/dist/src/prompts/skills.js.map +1 -0
- package/mcp/dist/src/resources/agents.d.ts +4 -0
- package/mcp/dist/src/resources/agents.d.ts.map +1 -0
- package/mcp/dist/src/resources/agents.js +64 -0
- package/mcp/dist/src/resources/agents.js.map +1 -0
- package/mcp/dist/src/resources/facts.d.ts +4 -0
- package/mcp/dist/src/resources/facts.d.ts.map +1 -0
- package/mcp/dist/src/resources/facts.js +125 -0
- package/mcp/dist/src/resources/facts.js.map +1 -0
- package/mcp/dist/src/resources/models.d.ts +4 -0
- package/mcp/dist/src/resources/models.d.ts.map +1 -0
- package/mcp/dist/src/resources/models.js +43 -0
- package/mcp/dist/src/resources/models.js.map +1 -0
- package/mcp/dist/src/resources/sessions.d.ts +4 -0
- package/mcp/dist/src/resources/sessions.d.ts.map +1 -0
- package/mcp/dist/src/resources/sessions.js +190 -0
- package/mcp/dist/src/resources/sessions.js.map +1 -0
- package/mcp/dist/src/resources/subscriptions.d.ts +9 -0
- package/mcp/dist/src/resources/subscriptions.d.ts.map +1 -0
- package/mcp/dist/src/resources/subscriptions.js +157 -0
- package/mcp/dist/src/resources/subscriptions.js.map +1 -0
- package/mcp/dist/src/server.d.ts +4 -0
- package/mcp/dist/src/server.d.ts.map +1 -0
- package/mcp/dist/src/server.js +59 -0
- package/mcp/dist/src/server.js.map +1 -0
- package/mcp/dist/src/tools/agents.d.ts +4 -0
- package/mcp/dist/src/tools/agents.d.ts.map +1 -0
- package/mcp/dist/src/tools/agents.js +317 -0
- package/mcp/dist/src/tools/agents.js.map +1 -0
- package/mcp/dist/src/tools/facts.d.ts +4 -0
- package/mcp/dist/src/tools/facts.d.ts.map +1 -0
- package/mcp/dist/src/tools/facts.js +151 -0
- package/mcp/dist/src/tools/facts.js.map +1 -0
- package/mcp/dist/src/tools/models.d.ts +4 -0
- package/mcp/dist/src/tools/models.d.ts.map +1 -0
- package/mcp/dist/src/tools/models.js +256 -0
- package/mcp/dist/src/tools/models.js.map +1 -0
- package/mcp/dist/src/tools/sessions.d.ts +4 -0
- package/mcp/dist/src/tools/sessions.d.ts.map +1 -0
- package/mcp/dist/src/tools/sessions.js +606 -0
- package/mcp/dist/src/tools/sessions.js.map +1 -0
- package/mcp/dist/src/util/command.d.ts +52 -0
- package/mcp/dist/src/util/command.d.ts.map +1 -0
- package/mcp/dist/src/util/command.js +78 -0
- package/mcp/dist/src/util/command.js.map +1 -0
- package/package.json +81 -6
- package/tui/README.md +35 -0
- package/tui/bin/tui.js +30 -0
- package/tui/plugins/.mcp.json +7 -0
- package/tui/plugins/plugin.json +13 -0
- package/tui/plugins/session-policy.json +8 -0
- package/tui/src/app.js +850 -0
- package/tui/src/auth/cli.js +111 -0
- package/tui/src/auth/entra-auth.js +218 -0
- package/tui/src/bootstrap-env.js +176 -0
- package/tui/src/embedded-workers.js +79 -0
- package/tui/src/http-transport-host.js +106 -0
- package/tui/src/index.js +340 -0
- package/tui/src/node-sdk-transport.js +1793 -0
- package/tui/src/platform.js +984 -0
- package/tui/src/plugin-config.js +239 -0
- package/tui/src/portal.js +7 -0
- package/tui/src/version.js +7 -0
- package/tui/tui-splash.txt +11 -0
- package/ui/core/README.md +6 -0
- package/ui/core/src/commands.js +93 -0
- package/ui/core/src/context-usage.js +212 -0
- package/ui/core/src/controller.js +6104 -0
- package/ui/core/src/formatting.js +1036 -0
- package/ui/core/src/history.js +932 -0
- package/ui/core/src/index.js +13 -0
- package/ui/core/src/layout.js +332 -0
- package/ui/core/src/reducer.js +1935 -0
- package/ui/core/src/selectors.js +5409 -0
- package/ui/core/src/session-errors.js +14 -0
- package/ui/core/src/session-tree.js +151 -0
- package/ui/core/src/state.js +248 -0
- package/ui/core/src/store.js +23 -0
- package/ui/core/src/system-titles.js +24 -0
- package/ui/core/src/themes/catppuccin-mocha.js +56 -0
- package/ui/core/src/themes/cobalt2.js +56 -0
- package/ui/core/src/themes/dark-high-contrast.js +56 -0
- package/ui/core/src/themes/daylight.js +62 -0
- package/ui/core/src/themes/dracula.js +56 -0
- package/ui/core/src/themes/github-dark.js +56 -0
- package/ui/core/src/themes/github-light.js +59 -0
- package/ui/core/src/themes/gruvbox-dark.js +56 -0
- package/ui/core/src/themes/hacker-x-matrix.js +56 -0
- package/ui/core/src/themes/hacker-x-orion-prime.js +56 -0
- package/ui/core/src/themes/helpers.js +79 -0
- package/ui/core/src/themes/high-contrast-mono.js +59 -0
- package/ui/core/src/themes/index.js +52 -0
- package/ui/core/src/themes/light-high-contrast.js +62 -0
- package/ui/core/src/themes/noctis-obscuro.js +56 -0
- package/ui/core/src/themes/noctis.js +56 -0
- package/ui/core/src/themes/paper-ink.js +62 -0
- package/ui/core/src/themes/solarized-ops.js +59 -0
- package/ui/core/src/themes/terminal-green.js +59 -0
- package/ui/core/src/themes/tokyo-night.js +56 -0
- package/ui/react/README.md +5 -0
- package/ui/react/src/chat-status.js +39 -0
- package/ui/react/src/components.js +1989 -0
- package/ui/react/src/index.js +4 -0
- package/ui/react/src/platform.js +15 -0
- package/ui/react/src/use-controller-state.js +38 -0
- package/ui/react/src/web-app.js +4390 -0
- package/web/README.md +198 -0
- package/web/api/router.js +196 -0
- package/web/api/ws.js +152 -0
- package/web/auth/authz/engine.js +204 -0
- package/web/auth/config.js +115 -0
- package/web/auth/index.js +175 -0
- package/web/auth/normalize/entra.js +22 -0
- package/web/auth/providers/entra.js +76 -0
- package/web/auth/providers/none.js +24 -0
- package/web/auth.js +10 -0
- package/web/bin/serve.js +53 -0
- package/web/config.js +20 -0
- package/web/dist/app.js +469 -0
- package/web/dist/assets/index-CBgQQk-j.css +1 -0
- package/web/dist/assets/index-DMefB7Wb.js +24 -0
- package/web/dist/assets/msal-CytV9RFv.js +7 -0
- package/web/dist/assets/pilotswarm-DyBlqVTY.js +87 -0
- package/web/dist/assets/react-BZwsW8pe.js +1 -0
- package/web/dist/index.html +16 -0
- package/web/runtime.js +454 -0
- package/web/server.js +276 -0
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as O}from"./pilotswarm-DyBlqVTY.js";var y={exports:{}},n={};var o;function S(){if(o)return n;o=1;var u=O();function g(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var i={d:{f:c,r:function(){throw Error(g(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},m=Symbol.for("react.portal");function v(r,e,t){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:a==null?null:""+a,children:r,containerInfo:e,implementation:t}}var f=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}return n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,n.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(g(299));return v(r,e,null,t)},n.flushSync=function(r){var e=f.T,t=i.p;try{if(f.T=null,i.p=2,r)return r()}finally{f.T=e,i.p=t,i.d.f()}},n.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,i.d.C(r,e))},n.prefetchDNS=function(r){typeof r=="string"&&i.d.D(r)},n.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,a=d(t,e.crossOrigin),s=typeof e.integrity=="string"?e.integrity:void 0,l=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?i.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:a,integrity:s,fetchPriority:l}):t==="script"&&i.d.X(r,{crossOrigin:a,integrity:s,fetchPriority:l,nonce:typeof e.nonce=="string"?e.nonce:void 0})}},n.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=d(e.as,e.crossOrigin);i.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&i.d.M(r)},n.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,a=d(t,e.crossOrigin);i.d.L(r,t,{crossOrigin:a,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}},n.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=d(e.as,e.crossOrigin);i.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else i.d.m(r)},n.requestFormReset=function(r){i.d.r(r)},n.unstable_batchedUpdates=function(r,e){return r(e)},n.useFormState=function(r,e,t){return f.H.useFormState(r,e,t)},n.useFormStatus=function(){return f.H.useHostTransitionStatus()},n.version="19.2.4",n}var _;function T(){if(_)return y.exports;_=1;function u(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(g){console.error(g)}}return u(),y.exports=S(),y.exports}export{T as r};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content" />
|
|
6
|
+
<title>PilotSwarm</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DMefB7Wb.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/pilotswarm-DyBlqVTY.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/react-BZwsW8pe.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/msal-CytV9RFv.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CBgQQk-j.css">
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
package/web/runtime.js
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { NodeSdkTransport } from "pilotswarm/host";
|
|
2
|
+
|
|
3
|
+
function normalizeParams(params) {
|
|
4
|
+
return params && typeof params === "object" ? params : {};
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function clampInteger(value, defaultValue, min, max) {
|
|
8
|
+
if (value == null) return defaultValue;
|
|
9
|
+
const numeric = Number(value);
|
|
10
|
+
if (!Number.isFinite(numeric)) return defaultValue;
|
|
11
|
+
return Math.max(min, Math.min(Math.trunc(numeric), max));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function normalizeSessionPageOptions(params) {
|
|
15
|
+
const limit = clampInteger(params.limit, 50, 1, 200);
|
|
16
|
+
const includeDeleted = params.includeDeleted === true;
|
|
17
|
+
if (params.cursor != null && typeof params.cursor !== "object") {
|
|
18
|
+
throw new Error("listSessionsPage cursor must be an object when provided");
|
|
19
|
+
}
|
|
20
|
+
const rawCursor = params.cursor ?? null;
|
|
21
|
+
let cursor = null;
|
|
22
|
+
|
|
23
|
+
if (rawCursor) {
|
|
24
|
+
const updatedAt = Number(rawCursor.updatedAt);
|
|
25
|
+
const sessionId = String(rawCursor.sessionId || "").trim();
|
|
26
|
+
if (!Number.isFinite(updatedAt)) {
|
|
27
|
+
throw new Error("listSessionsPage cursor.updatedAt must be a finite number");
|
|
28
|
+
}
|
|
29
|
+
if (!sessionId) {
|
|
30
|
+
throw new Error("listSessionsPage cursor.sessionId must be a non-empty string");
|
|
31
|
+
}
|
|
32
|
+
cursor = { updatedAt, sessionId };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return { limit, cursor, includeDeleted };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function normalizeTopEventEmitterOptions(params) {
|
|
39
|
+
if (params.since == null) {
|
|
40
|
+
throw new Error("getTopEventEmitters since is required");
|
|
41
|
+
}
|
|
42
|
+
const since = new Date(params.since);
|
|
43
|
+
if (Number.isNaN(since.getTime())) {
|
|
44
|
+
throw new Error("getTopEventEmitters since must be a valid date");
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
since,
|
|
48
|
+
limit: clampInteger(params.limit, 20, 1, 100),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function normalizeSessionOwner(authContext) {
|
|
53
|
+
const principal = authContext?.principal;
|
|
54
|
+
return normalizeOwnerPrincipal(principal);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function normalizeOwnerPrincipal(principal) {
|
|
58
|
+
const provider = String(principal?.provider || "").trim();
|
|
59
|
+
const subject = String(principal?.subject || "").trim();
|
|
60
|
+
if (!provider || !subject) return null;
|
|
61
|
+
return {
|
|
62
|
+
provider,
|
|
63
|
+
subject,
|
|
64
|
+
email: String(principal?.email || "").trim() || null,
|
|
65
|
+
displayName: String(principal?.displayName || "").trim() || null,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function ownerKey(owner) {
|
|
70
|
+
const provider = String(owner?.provider || "").trim();
|
|
71
|
+
const subject = String(owner?.subject || "").trim();
|
|
72
|
+
return provider && subject ? `${provider}\u0001${subject}` : null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function requireUserPrincipal(authContext, methodName) {
|
|
76
|
+
const principal = normalizeSessionOwner(authContext);
|
|
77
|
+
if (!principal) {
|
|
78
|
+
const err = new Error(`Portal RPC '${methodName}' requires an authenticated principal.`);
|
|
79
|
+
err.code = "PORTAL_AUTH_REQUIRED";
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
return principal;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class PortalRuntime {
|
|
86
|
+
constructor({ store, mode, useManagedIdentity, cmsFactsDatabaseUrl, aadDbUser } = {}) {
|
|
87
|
+
this.transport = new NodeSdkTransport({ store, mode, useManagedIdentity, cmsFactsDatabaseUrl, aadDbUser });
|
|
88
|
+
this.mode = mode;
|
|
89
|
+
this.started = false;
|
|
90
|
+
this.startPromise = null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async start() {
|
|
94
|
+
if (this.started) return;
|
|
95
|
+
if (!this.startPromise) {
|
|
96
|
+
this.startPromise = this.transport.start()
|
|
97
|
+
.then(() => {
|
|
98
|
+
this.started = true;
|
|
99
|
+
})
|
|
100
|
+
.finally(() => {
|
|
101
|
+
this.startPromise = null;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
await this.startPromise;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async stop() {
|
|
108
|
+
if (!this.started && !this.startPromise) return;
|
|
109
|
+
if (this.startPromise) {
|
|
110
|
+
await this.startPromise.catch(() => {});
|
|
111
|
+
}
|
|
112
|
+
if (this.started) {
|
|
113
|
+
await this.transport.stop();
|
|
114
|
+
this.started = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async resolveSessionGroupOwner(input = {}, authOwner = null) {
|
|
119
|
+
const inputOwner = normalizeOwnerPrincipal(input?.owner);
|
|
120
|
+
if (inputOwner) return inputOwner;
|
|
121
|
+
|
|
122
|
+
const sessionIds = Array.isArray(input?.sessionIds)
|
|
123
|
+
? Array.from(new Set(input.sessionIds.map((id) => String(id || "").trim()).filter(Boolean)))
|
|
124
|
+
: [];
|
|
125
|
+
if (sessionIds.length > 0 && typeof this.transport.getSession === "function") {
|
|
126
|
+
const owners = [];
|
|
127
|
+
for (const sessionId of sessionIds) {
|
|
128
|
+
const session = await this.transport.getSession(sessionId).catch(() => null);
|
|
129
|
+
if (!session || session.isSystem || session.isGroup || session.parentSessionId) continue;
|
|
130
|
+
owners.push(normalizeOwnerPrincipal(session.owner));
|
|
131
|
+
}
|
|
132
|
+
const ownerKeys = new Set(owners.map((owner) => ownerKey(owner) || ""));
|
|
133
|
+
if (owners.length > 0 && ownerKeys.size === 1) {
|
|
134
|
+
return owners[0] ?? null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return authOwner;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async getBootstrap() {
|
|
142
|
+
await this.start();
|
|
143
|
+
return {
|
|
144
|
+
mode: this.mode,
|
|
145
|
+
workerCount: typeof this.transport.getWorkerCount === "function"
|
|
146
|
+
? this.transport.getWorkerCount()
|
|
147
|
+
: null,
|
|
148
|
+
logConfig: typeof this.transport.getLogConfig === "function"
|
|
149
|
+
? this.transport.getLogConfig()
|
|
150
|
+
: null,
|
|
151
|
+
defaultModel: typeof this.transport.getDefaultModel === "function"
|
|
152
|
+
? this.transport.getDefaultModel()
|
|
153
|
+
: null,
|
|
154
|
+
modelsByProvider: typeof this.transport.getModelsByProvider === "function"
|
|
155
|
+
? this.transport.getModelsByProvider()
|
|
156
|
+
: [],
|
|
157
|
+
creatableAgents: typeof this.transport.listCreatableAgents === "function"
|
|
158
|
+
? await this.transport.listCreatableAgents()
|
|
159
|
+
: [],
|
|
160
|
+
sessionCreationPolicy: typeof this.transport.getSessionCreationPolicy === "function"
|
|
161
|
+
? this.transport.getSessionCreationPolicy()
|
|
162
|
+
: null,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async call(method, params = {}, authContext = null) {
|
|
167
|
+
await this.start();
|
|
168
|
+
const safeParams = normalizeParams(params);
|
|
169
|
+
const owner = normalizeSessionOwner(authContext);
|
|
170
|
+
// Privileged when admin-role, or no-auth ("anonymous" = full access on a
|
|
171
|
+
// trusted deployment). Non-admin facts reads are restricted to shared
|
|
172
|
+
// visibility so a plain caller cannot read another session's private facts.
|
|
173
|
+
const role = authContext?.authorization?.role;
|
|
174
|
+
const isAdmin = role === "admin" || role === "anonymous";
|
|
175
|
+
switch (method) {
|
|
176
|
+
case "listSessions":
|
|
177
|
+
return this.transport.listSessions();
|
|
178
|
+
case "listSessionGroups":
|
|
179
|
+
return this.transport.listSessionGroups();
|
|
180
|
+
case "createSessionGroup":
|
|
181
|
+
return this.transport.createSessionGroup({
|
|
182
|
+
...(safeParams.input || {}),
|
|
183
|
+
owner: await this.resolveSessionGroupOwner(safeParams.input || {}, owner),
|
|
184
|
+
});
|
|
185
|
+
case "updateSessionGroup":
|
|
186
|
+
return this.transport.updateSessionGroup(safeParams.groupId, safeParams.patch || {});
|
|
187
|
+
case "assignSessionsToGroup":
|
|
188
|
+
return this.transport.assignSessionsToGroup(safeParams.groupId, safeParams.sessionIds || []);
|
|
189
|
+
case "moveSessionsToGroup":
|
|
190
|
+
return this.transport.moveSessionsToGroup(safeParams.groupId ?? null, safeParams.sessionIds || []);
|
|
191
|
+
case "getChildOutcome":
|
|
192
|
+
return this.transport.getChildOutcome(safeParams.childSessionId);
|
|
193
|
+
case "listChildOutcomes":
|
|
194
|
+
return this.transport.listChildOutcomes(safeParams.parentSessionId);
|
|
195
|
+
case "listSessionsPage":
|
|
196
|
+
return this.transport.listSessionsPage(normalizeSessionPageOptions(safeParams));
|
|
197
|
+
case "getSession":
|
|
198
|
+
return this.transport.getSession(safeParams.sessionId);
|
|
199
|
+
case "getOrchestrationStats":
|
|
200
|
+
return this.transport.getOrchestrationStats(safeParams.sessionId);
|
|
201
|
+
case "getSessionMetricSummary":
|
|
202
|
+
return this.transport.getSessionMetricSummary(safeParams.sessionId);
|
|
203
|
+
case "getSessionTokensByModel":
|
|
204
|
+
return this.transport.getSessionTokensByModel(safeParams.sessionId);
|
|
205
|
+
case "getSessionTreeStats":
|
|
206
|
+
return this.transport.getSessionTreeStats(safeParams.sessionId);
|
|
207
|
+
case "getFleetStats":
|
|
208
|
+
return this.transport.getFleetStats({
|
|
209
|
+
includeDeleted: safeParams.includeDeleted,
|
|
210
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
211
|
+
});
|
|
212
|
+
case "getUserStats":
|
|
213
|
+
return this.transport.getUserStats({
|
|
214
|
+
includeDeleted: safeParams.includeDeleted,
|
|
215
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
216
|
+
});
|
|
217
|
+
case "getCurrentUserProfile":
|
|
218
|
+
return this.transport.getCurrentUserProfile({
|
|
219
|
+
principal: requireUserPrincipal(authContext, "getCurrentUserProfile"),
|
|
220
|
+
});
|
|
221
|
+
case "setCurrentUserProfileSettings":
|
|
222
|
+
return this.transport.setCurrentUserProfileSettings({
|
|
223
|
+
principal: requireUserPrincipal(authContext, "setCurrentUserProfileSettings"),
|
|
224
|
+
settings: safeParams.settings,
|
|
225
|
+
});
|
|
226
|
+
case "setCurrentUserGitHubCopilotKey":
|
|
227
|
+
return this.transport.setCurrentUserGitHubCopilotKey({
|
|
228
|
+
principal: requireUserPrincipal(authContext, "setCurrentUserGitHubCopilotKey"),
|
|
229
|
+
key: typeof safeParams.key === "string" ? safeParams.key : null,
|
|
230
|
+
});
|
|
231
|
+
case "getSessionSkillUsage":
|
|
232
|
+
return this.transport.getSessionSkillUsage(safeParams.sessionId, {
|
|
233
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
234
|
+
});
|
|
235
|
+
case "getSessionTreeSkillUsage":
|
|
236
|
+
return this.transport.getSessionTreeSkillUsage(safeParams.sessionId, {
|
|
237
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
238
|
+
});
|
|
239
|
+
case "getFleetSkillUsage":
|
|
240
|
+
return this.transport.getFleetSkillUsage({
|
|
241
|
+
includeDeleted: safeParams.includeDeleted,
|
|
242
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
243
|
+
});
|
|
244
|
+
case "getFleetRetrievalUsage":
|
|
245
|
+
return this.transport.getFleetRetrievalUsage({
|
|
246
|
+
includeDeleted: safeParams.includeDeleted,
|
|
247
|
+
since: safeParams.since ? new Date(safeParams.since) : undefined,
|
|
248
|
+
});
|
|
249
|
+
case "getSessionFactsStats":
|
|
250
|
+
return this.transport.getSessionFactsStats(safeParams.sessionId);
|
|
251
|
+
case "getSessionTreeFactsStats":
|
|
252
|
+
return this.transport.getSessionTreeFactsStats(safeParams.sessionId);
|
|
253
|
+
case "getSharedFactsStats":
|
|
254
|
+
return this.transport.getSharedFactsStats();
|
|
255
|
+
case "getFactsTombstoneStats":
|
|
256
|
+
return this.transport.getFactsTombstoneStats({ ttlSeconds: safeParams.ttlSeconds });
|
|
257
|
+
|
|
258
|
+
// ── Facts data-plane ────────────────────────────────────────
|
|
259
|
+
case "factsCapabilities":
|
|
260
|
+
return this.transport.factsCapabilities();
|
|
261
|
+
case "readFacts":
|
|
262
|
+
return this.transport.readFacts(safeParams, { admin: isAdmin });
|
|
263
|
+
case "storeFact":
|
|
264
|
+
return this.transport.storeFact(safeParams.input);
|
|
265
|
+
case "deleteFact":
|
|
266
|
+
return this.transport.deleteFactRecord(safeParams.input);
|
|
267
|
+
case "searchFacts":
|
|
268
|
+
return this.transport.searchFacts(safeParams.query, safeParams.opts, { admin: isAdmin });
|
|
269
|
+
case "similarFacts":
|
|
270
|
+
return this.transport.similarFacts(safeParams.scopeKey, safeParams.opts, { admin: isAdmin });
|
|
271
|
+
case "getEmbedderStatus":
|
|
272
|
+
return this.transport.getFactsEmbedderStatus();
|
|
273
|
+
case "startFactsEmbedder":
|
|
274
|
+
return this.transport.startFactsEmbedder({ intervalSeconds: safeParams.intervalSeconds, batch: safeParams.batch });
|
|
275
|
+
case "stopFactsEmbedder":
|
|
276
|
+
return this.transport.stopFactsEmbedder(safeParams.reason);
|
|
277
|
+
case "forcePurgeFacts":
|
|
278
|
+
return this.transport.forcePurgeFacts(safeParams.input);
|
|
279
|
+
|
|
280
|
+
// ── Graph data-plane ────────────────────────────────────────
|
|
281
|
+
case "searchGraphNodes":
|
|
282
|
+
return this.transport.searchGraphNodes(safeParams.query);
|
|
283
|
+
case "searchGraphEdges":
|
|
284
|
+
return this.transport.searchGraphEdges(safeParams.query);
|
|
285
|
+
case "graphNeighbourhood":
|
|
286
|
+
return this.transport.graphNeighbourhood(safeParams.nodeKey, safeParams.depth, { namespace: safeParams.namespace });
|
|
287
|
+
case "upsertGraphNode":
|
|
288
|
+
return this.transport.upsertGraphNode(safeParams.input);
|
|
289
|
+
case "upsertGraphEdge":
|
|
290
|
+
return this.transport.upsertGraphEdge(safeParams.input);
|
|
291
|
+
case "deleteGraphNode":
|
|
292
|
+
return this.transport.deleteGraphNode(safeParams.nodeKey, { namespace: safeParams.namespace });
|
|
293
|
+
case "deleteGraphEdge":
|
|
294
|
+
return this.transport.deleteGraphEdge(safeParams.fromKey, safeParams.toKey, safeParams.predicateKey, { namespace: safeParams.namespace });
|
|
295
|
+
case "graphStats":
|
|
296
|
+
return this.transport.graphStats({ namespace: safeParams.namespace });
|
|
297
|
+
case "listGraphNamespaces":
|
|
298
|
+
return this.transport.listGraphNamespaces({ prefix: safeParams.prefix, includeArchived: safeParams.includeArchived, includeDetails: safeParams.includeDetails });
|
|
299
|
+
case "getGraphNamespace":
|
|
300
|
+
return this.transport.getGraphNamespace(safeParams.namespace);
|
|
301
|
+
case "upsertGraphNamespace":
|
|
302
|
+
return this.transport.upsertGraphNamespace(safeParams.input);
|
|
303
|
+
case "deleteGraphNamespace":
|
|
304
|
+
return this.transport.deleteGraphNamespace(safeParams.namespace);
|
|
305
|
+
case "pruneDeletedSummaries":
|
|
306
|
+
return this.transport.pruneDeletedSummaries(new Date(safeParams.olderThan));
|
|
307
|
+
case "getExecutionHistory":
|
|
308
|
+
return this.transport.getExecutionHistory(safeParams.sessionId, safeParams.executionId);
|
|
309
|
+
case "createSession":
|
|
310
|
+
return this.transport.createSession({
|
|
311
|
+
model: safeParams.model,
|
|
312
|
+
reasoningEffort: safeParams.reasoningEffort,
|
|
313
|
+
groupId: safeParams.groupId,
|
|
314
|
+
owner,
|
|
315
|
+
});
|
|
316
|
+
case "createSessionForAgent":
|
|
317
|
+
return this.transport.createSessionForAgent(safeParams.agentName, {
|
|
318
|
+
model: safeParams.model,
|
|
319
|
+
reasoningEffort: safeParams.reasoningEffort,
|
|
320
|
+
title: safeParams.title,
|
|
321
|
+
splash: safeParams.splash,
|
|
322
|
+
initialPrompt: safeParams.initialPrompt,
|
|
323
|
+
groupId: safeParams.groupId,
|
|
324
|
+
owner,
|
|
325
|
+
});
|
|
326
|
+
case "listCreatableAgents":
|
|
327
|
+
return this.transport.listCreatableAgents();
|
|
328
|
+
case "getSessionCreationPolicy":
|
|
329
|
+
return this.transport.getSessionCreationPolicy();
|
|
330
|
+
case "sendMessage":
|
|
331
|
+
return this.transport.sendMessage(safeParams.sessionId, safeParams.prompt, safeParams.options);
|
|
332
|
+
case "sendAnswer":
|
|
333
|
+
return this.transport.sendAnswer(safeParams.sessionId, safeParams.answer);
|
|
334
|
+
case "sendSessionEvent":
|
|
335
|
+
return this.transport.sendSessionEvent(safeParams.sessionId, safeParams.eventName, safeParams.data);
|
|
336
|
+
case "getSessionStatus":
|
|
337
|
+
return this.transport.getSessionStatus(safeParams.sessionId);
|
|
338
|
+
case "waitForStatusChange": {
|
|
339
|
+
// Long-poll: the server holds the request open, capped well
|
|
340
|
+
// below typical ingress idle timeouts. On timeout the
|
|
341
|
+
// underlying wait throws; translate that into "no change"
|
|
342
|
+
// by returning the current status, so the client sees a
|
|
343
|
+
// clean unchanged snapshot and loops (instead of a 500).
|
|
344
|
+
const sessionId = safeParams.sessionId;
|
|
345
|
+
const afterVersion = Number(safeParams.afterVersion) || 0;
|
|
346
|
+
const timeoutMs = clampInteger(safeParams.timeoutMs, 25_000, 1_000, 300_000);
|
|
347
|
+
try {
|
|
348
|
+
return await this.transport.waitForStatusChange(sessionId, afterVersion, timeoutMs);
|
|
349
|
+
} catch (error) {
|
|
350
|
+
if (/Timed out waiting/i.test(String(error?.message || ""))) {
|
|
351
|
+
return this.transport.getSessionStatus(sessionId);
|
|
352
|
+
}
|
|
353
|
+
throw error;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
case "getLatestResponse":
|
|
357
|
+
return this.transport.getLatestResponse(safeParams.sessionId);
|
|
358
|
+
case "cancelPendingMessage":
|
|
359
|
+
return this.transport.cancelPendingMessage(safeParams.sessionId, safeParams.clientMessageIds);
|
|
360
|
+
case "renameSession":
|
|
361
|
+
return this.transport.renameSession(safeParams.sessionId, safeParams.title);
|
|
362
|
+
case "cancelSession":
|
|
363
|
+
return this.transport.cancelSession(safeParams.sessionId);
|
|
364
|
+
case "cancelSessionGroup":
|
|
365
|
+
return this.transport.cancelSessionGroup(safeParams.groupId, safeParams.reason);
|
|
366
|
+
case "completeSession":
|
|
367
|
+
return this.transport.completeSession(safeParams.sessionId, safeParams.reason);
|
|
368
|
+
case "completeSessionGroup":
|
|
369
|
+
return this.transport.completeSessionGroup(safeParams.groupId, safeParams.options || {});
|
|
370
|
+
case "deleteSession":
|
|
371
|
+
return this.transport.deleteSession(safeParams.sessionId);
|
|
372
|
+
case "restartSystemSession":
|
|
373
|
+
return this.transport.restartSystemSession(safeParams.agentIdOrSessionId, safeParams.options || {});
|
|
374
|
+
case "setSessionModel":
|
|
375
|
+
return this.transport.setSessionModel(safeParams.sessionId, safeParams.options || {});
|
|
376
|
+
case "stopSessionTurn":
|
|
377
|
+
return this.transport.stopSessionTurn(safeParams.sessionId, safeParams.options || {});
|
|
378
|
+
case "deleteSessionGroup":
|
|
379
|
+
return this.transport.deleteSessionGroup(safeParams.groupId);
|
|
380
|
+
case "listModels":
|
|
381
|
+
return this.transport.listModels();
|
|
382
|
+
case "listArtifacts":
|
|
383
|
+
return this.transport.listArtifacts(safeParams.sessionId);
|
|
384
|
+
case "getArtifactMetadata":
|
|
385
|
+
return this.transport.getArtifactMetadata(safeParams.sessionId, safeParams.filename);
|
|
386
|
+
case "deleteArtifact":
|
|
387
|
+
return this.transport.deleteArtifact(safeParams.sessionId, safeParams.filename);
|
|
388
|
+
case "downloadArtifact":
|
|
389
|
+
return this.transport.downloadArtifact(safeParams.sessionId, safeParams.filename);
|
|
390
|
+
case "uploadArtifact":
|
|
391
|
+
return this.transport.uploadArtifactContent(
|
|
392
|
+
safeParams.sessionId,
|
|
393
|
+
safeParams.filename,
|
|
394
|
+
safeParams.content,
|
|
395
|
+
safeParams.contentType,
|
|
396
|
+
safeParams.contentEncoding,
|
|
397
|
+
);
|
|
398
|
+
case "exportExecutionHistory":
|
|
399
|
+
return this.transport.exportExecutionHistory(safeParams.sessionId);
|
|
400
|
+
case "getModelsByProvider":
|
|
401
|
+
return this.transport.getModelsByProvider();
|
|
402
|
+
case "getDefaultModel":
|
|
403
|
+
return this.transport.getDefaultModel();
|
|
404
|
+
case "getSessionEvents":
|
|
405
|
+
return this.transport.getSessionEvents(safeParams.sessionId, safeParams.afterSeq, safeParams.limit);
|
|
406
|
+
case "getSessionEventsBefore":
|
|
407
|
+
return this.transport.getSessionEventsBefore(safeParams.sessionId, safeParams.beforeSeq, safeParams.limit);
|
|
408
|
+
case "getTopEventEmitters":
|
|
409
|
+
return this.transport.getTopEventEmitters(normalizeTopEventEmitterOptions(safeParams));
|
|
410
|
+
case "getLogConfig":
|
|
411
|
+
return this.transport.getLogConfig();
|
|
412
|
+
case "getWorkerCount":
|
|
413
|
+
return this.transport.getWorkerCount();
|
|
414
|
+
default:
|
|
415
|
+
throw new Error(`Unsupported portal RPC method: ${method}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async downloadArtifact(sessionId, filename) {
|
|
420
|
+
await this.start();
|
|
421
|
+
return this.transport.downloadArtifact(sessionId, filename);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
async getArtifactMetadata(sessionId, filename) {
|
|
425
|
+
await this.start();
|
|
426
|
+
if (typeof this.transport.getArtifactMetadata !== "function") return null;
|
|
427
|
+
return this.transport.getArtifactMetadata(sessionId, filename);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
async downloadArtifactBinary(sessionId, filename) {
|
|
431
|
+
await this.start();
|
|
432
|
+
if (typeof this.transport.downloadArtifactBinary === "function") {
|
|
433
|
+
return this.transport.downloadArtifactBinary(sessionId, filename);
|
|
434
|
+
}
|
|
435
|
+
const content = await this.transport.downloadArtifact(sessionId, filename);
|
|
436
|
+
return {
|
|
437
|
+
filename,
|
|
438
|
+
contentType: "text/plain",
|
|
439
|
+
isBinary: false,
|
|
440
|
+
sizeBytes: Buffer.byteLength(content, "utf8"),
|
|
441
|
+
uploadedAt: new Date().toISOString(),
|
|
442
|
+
source: "agent",
|
|
443
|
+
body: Buffer.from(content, "utf8"),
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
subscribeSession(sessionId, handler) {
|
|
448
|
+
return this.transport.subscribeSession(sessionId, handler);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
startLogTail(handler) {
|
|
452
|
+
return this.transport.startLogTail(handler);
|
|
453
|
+
}
|
|
454
|
+
}
|