@aexol/spectral 0.9.251 → 0.9.254
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/generated/zeus/const.d.ts.map +1 -1
- package/dist/generated/zeus/const.js +48 -6
- package/dist/generated/zeus/index.d.ts +266 -36
- package/dist/generated/zeus/index.d.ts.map +1 -1
- package/dist/mcp/mcp-auth-flow.d.ts +4 -0
- package/dist/mcp/mcp-auth-flow.d.ts.map +1 -1
- package/dist/mcp/mcp-auth-flow.js +7 -4
- package/dist/memory/commands/status.d.ts.map +1 -1
- package/dist/memory/commands/status.js +2 -1
- package/dist/memory/hooks/compaction-trigger.d.ts +14 -1
- package/dist/memory/hooks/compaction-trigger.d.ts.map +1 -1
- package/dist/memory/hooks/compaction-trigger.js +31 -4
- package/dist/relay/dispatcher.d.ts.map +1 -1
- package/dist/relay/dispatcher.js +4 -47
- package/dist/relay/routing.d.ts +1 -1
- package/dist/relay/routing.d.ts.map +1 -1
- package/dist/relay/routing.js +9 -0
- package/dist/sdk/ai/utils/image-source.d.ts +26 -11
- package/dist/sdk/ai/utils/image-source.d.ts.map +1 -1
- package/dist/sdk/ai/utils/image-source.js +184 -47
- package/dist/sdk/ai/utils/transient-error.d.ts +4 -0
- package/dist/sdk/ai/utils/transient-error.d.ts.map +1 -1
- package/dist/sdk/ai/utils/transient-error.js +15 -0
- package/dist/sdk/coding-agent/core/compaction/policy.d.ts +2 -0
- package/dist/sdk/coding-agent/core/compaction/policy.d.ts.map +1 -1
- package/dist/sdk/coding-agent/core/compaction/policy.js +2 -0
- package/dist/sdk/coding-agent/core/system-prompt.d.ts.map +1 -1
- package/dist/sdk/coding-agent/core/system-prompt.js +4 -0
- package/dist/sdk/coding-agent/core/tools/read.d.ts.map +1 -1
- package/dist/sdk/coding-agent/core/tools/read.js +14 -7
- package/dist/sdk/coding-agent/index.d.ts +1 -1
- package/dist/sdk/coding-agent/index.d.ts.map +1 -1
- package/dist/sdk/coding-agent/index.js +1 -1
- package/dist/sdk/coding-agent/utils/image-resize.d.ts +25 -11
- package/dist/sdk/coding-agent/utils/image-resize.d.ts.map +1 -1
- package/dist/sdk/coding-agent/utils/image-resize.js +54 -36
- package/dist/sdk/coding-agent/utils/photon.d.ts.map +1 -1
- package/dist/sdk/coding-agent/utils/photon.js +11 -2
- package/dist/server/agent-bridge.d.ts +32 -0
- package/dist/server/agent-bridge.d.ts.map +1 -1
- package/dist/server/agent-bridge.js +59 -9
- package/dist/server/handlers/mcp-auth.d.ts +25 -0
- package/dist/server/handlers/mcp-auth.d.ts.map +1 -0
- package/dist/server/handlers/mcp-auth.js +106 -0
- package/dist/server/handlers/mcp-status.d.ts +8 -2
- package/dist/server/handlers/mcp-status.d.ts.map +1 -1
- package/dist/server/handlers/mcp-status.js +15 -3
- package/dist/server/preset-chain.d.ts +0 -13
- package/dist/server/preset-chain.d.ts.map +1 -1
- package/dist/server/preset-chain.js +0 -25
- package/dist/server/session-stream/memory.d.ts.map +1 -1
- package/dist/server/session-stream/memory.js +8 -1
- package/dist/server/session-stream.d.ts +15 -56
- package/dist/server/session-stream.d.ts.map +1 -1
- package/dist/server/session-stream.js +41 -271
- package/dist/server/wire.d.ts +18 -32
- package/dist/server/wire.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -10,9 +10,13 @@ export type AuthStatus = "authenticated" | "expired" | "not_authenticated";
|
|
|
10
10
|
/**
|
|
11
11
|
* Start OAuth authentication flow for a server.
|
|
12
12
|
* Returns the authorization URL when browser authorization is required.
|
|
13
|
+
* Also returns the OAuth `state` parameter that was generated and persisted
|
|
14
|
+
* for this flow, so headless callers (e.g. the `/api/mcp-auth` handler) can
|
|
15
|
+
* wait for the callback without re-reading it from storage.
|
|
13
16
|
*/
|
|
14
17
|
export declare function startAuth(serverName: string, serverUrl: string, definition?: ServerEntry): Promise<{
|
|
15
18
|
authorizationUrl: string;
|
|
19
|
+
oauthState?: string;
|
|
16
20
|
}>;
|
|
17
21
|
/**
|
|
18
22
|
* Complete OAuth authentication with the authorization code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-auth-flow.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-auth-flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,SAAS,GAAG,mBAAmB,CAAA;AAkD1E
|
|
1
|
+
{"version":3,"file":"mcp-auth-flow.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-auth-flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,SAAS,GAAG,mBAAmB,CAAA;AAkD1E;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyD5D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,UAAU,CAAC,CAcrB;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,CAAC,CAuErB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA2C9B;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAM3E;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAalE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAU9D;AAED;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEnD"}
|
|
@@ -56,6 +56,9 @@ function extractOAuthConfig(definition) {
|
|
|
56
56
|
/**
|
|
57
57
|
* Start OAuth authentication flow for a server.
|
|
58
58
|
* Returns the authorization URL when browser authorization is required.
|
|
59
|
+
* Also returns the OAuth `state` parameter that was generated and persisted
|
|
60
|
+
* for this flow, so headless callers (e.g. the `/api/mcp-auth` handler) can
|
|
61
|
+
* wait for the callback without re-reading it from storage.
|
|
59
62
|
*/
|
|
60
63
|
export async function startAuth(serverName, serverUrl, definition) {
|
|
61
64
|
const config = definition ? extractOAuthConfig(definition) : {};
|
|
@@ -101,7 +104,7 @@ export async function startAuth(serverName, serverUrl, definition) {
|
|
|
101
104
|
throw new UnauthorizedError("OAuth authorization URL was not provided");
|
|
102
105
|
}
|
|
103
106
|
pendingTransports.set(serverName, new StreamableHTTPClientTransport(new URL(serverUrl), { authProvider }));
|
|
104
|
-
return { authorizationUrl: capturedUrl.toString() };
|
|
107
|
+
return { authorizationUrl: capturedUrl.toString(), oauthState };
|
|
105
108
|
}
|
|
106
109
|
catch (error) {
|
|
107
110
|
await clearOAuthState(serverName);
|
|
@@ -141,13 +144,13 @@ export async function authenticate(serverName, serverUrl, definition) {
|
|
|
141
144
|
}
|
|
142
145
|
const operation = (async () => {
|
|
143
146
|
// Start auth flow
|
|
144
|
-
const { authorizationUrl } = await startAuth(serverName, serverUrl, definition);
|
|
147
|
+
const { authorizationUrl, oauthState } = await startAuth(serverName, serverUrl, definition);
|
|
145
148
|
// If no auth URL needed, already authenticated
|
|
146
149
|
if (!authorizationUrl) {
|
|
147
150
|
return "authenticated";
|
|
148
151
|
}
|
|
149
|
-
//
|
|
150
|
-
|
|
152
|
+
// The state was generated + persisted inside startAuth() and is returned
|
|
153
|
+
// together with the authorization URL.
|
|
151
154
|
if (!oauthState) {
|
|
152
155
|
throw new Error("OAuth state not found - this should not happen");
|
|
153
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAUpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CA8F/E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SettingsManager } from "../../sdk/coding-agent/index.js";
|
|
2
2
|
import { getMemoryState, rawTokensSinceLastBound, rawTokensSinceLastCompaction, } from "../branch.js";
|
|
3
|
+
import { getContextWindow, getPostRunCompactionThresholdTokens } from "../hooks/compaction-trigger.js";
|
|
3
4
|
import { observationPoolTokens as estimateObservationPoolTokens } from "../compaction.js";
|
|
4
5
|
import { countByRelevance, formatRelevanceHistogram } from "../relevance.js";
|
|
5
6
|
import { estimateStringTokens } from "../tokens.js";
|
|
@@ -24,7 +25,7 @@ export function registerStatusCommand(ext, runtime) {
|
|
|
24
25
|
const compactionPolicy = SettingsManager.create(ctx.cwd).getCompactionPolicy();
|
|
25
26
|
const keepRecentTokens = compactionPolicy.conversation.keepRecentTokens;
|
|
26
27
|
const obsThreshold = runtime.config.observationThresholdTokens;
|
|
27
|
-
const compThreshold =
|
|
28
|
+
const compThreshold = getPostRunCompactionThresholdTokens(runtime, compactionPolicy, getContextWindow(ctx));
|
|
28
29
|
const refThreshold = runtime.config.reflectionThresholdTokens;
|
|
29
30
|
// Approximation: the real compaction gate excludes pending obs whose coversFromId falls inside
|
|
30
31
|
// the new keep-recent tail (deferred to next cycle) and adds any sync-catch-up gap obs produced
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "../../sdk/coding-agent/index.js";
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "../../sdk/coding-agent/index.js";
|
|
2
|
+
import { type CompactionPolicy } from "../../sdk/coding-agent/core/compaction/index.js";
|
|
2
3
|
import type { Runtime } from "../runtime.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the active model's context window. Prefers the live usage report,
|
|
6
|
+
* falls back to the model definition; returns undefined when unknown.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getContextWindow(ctx: Pick<ExtensionContext, "getContextUsage" | "model">): number | null | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Effective post-run compaction threshold: the configured/policy floor, capped
|
|
11
|
+
* at AUTO_COMPACTION_WINDOW_RATIO × the model context window when the window
|
|
12
|
+
* is known. An unknown window (0/undefined, e.g. synthetic/proxy models) keeps
|
|
13
|
+
* the uncapped formula.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPostRunCompactionThresholdTokens(runtime: Runtime, policy: CompactionPolicy, contextWindow?: number | null): number;
|
|
3
16
|
export declare function registerCompactionTrigger(ext: ExtensionAPI, runtime: Runtime): void;
|
|
4
17
|
//# sourceMappingURL=compaction-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-trigger.d.ts","sourceRoot":"","sources":["../../../src/memory/hooks/compaction-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"compaction-trigger.d.ts","sourceRoot":"","sources":["../../../src/memory/hooks/compaction-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAc7C;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,OAAO,CAAC,GACtD,MAAM,GAAG,IAAI,GAAG,SAAS,CAW3B;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAClD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,EACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,CAMR;AACD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAmGnF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_COMPACTION_POLICY } from "../../sdk/coding-agent/core/compaction/index.js";
|
|
1
|
+
import { AUTO_COMPACTION_WINDOW_RATIO, DEFAULT_COMPACTION_POLICY, } from "../../sdk/coding-agent/core/compaction/index.js";
|
|
2
2
|
import { rawTokensSinceLastCompaction } from "../branch.js";
|
|
3
3
|
/**
|
|
4
4
|
* Regex matching spectral's internal retryable error detection.
|
|
@@ -9,8 +9,35 @@ const RETRYABLE_ERROR_RE = /overloaded|provider.?returned.?error|rate.?limit|too
|
|
|
9
9
|
function getCompactionPolicy(ctx) {
|
|
10
10
|
return ctx.settingsManager?.getCompactionPolicy?.() ?? DEFAULT_COMPACTION_POLICY;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the active model's context window. Prefers the live usage report,
|
|
14
|
+
* falls back to the model definition; returns undefined when unknown.
|
|
15
|
+
*/
|
|
16
|
+
export function getContextWindow(ctx) {
|
|
17
|
+
try {
|
|
18
|
+
const usage = ctx.getContextUsage();
|
|
19
|
+
if (usage && typeof usage.contextWindow === "number" && usage.contextWindow > 0) {
|
|
20
|
+
return usage.contextWindow;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// getContextUsage is optional in some headless harnesses.
|
|
25
|
+
}
|
|
26
|
+
const modelWindow = ctx.model?.contextWindow;
|
|
27
|
+
return typeof modelWindow === "number" && modelWindow > 0 ? modelWindow : undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Effective post-run compaction threshold: the configured/policy floor, capped
|
|
31
|
+
* at AUTO_COMPACTION_WINDOW_RATIO × the model context window when the window
|
|
32
|
+
* is known. An unknown window (0/undefined, e.g. synthetic/proxy models) keeps
|
|
33
|
+
* the uncapped formula.
|
|
34
|
+
*/
|
|
35
|
+
export function getPostRunCompactionThresholdTokens(runtime, policy, contextWindow) {
|
|
36
|
+
const uncapped = Math.max(runtime.config.compactionThresholdTokens, policy.autoOlderHistory.minRawTokens);
|
|
37
|
+
if (typeof contextWindow !== "number" || !Number.isFinite(contextWindow) || contextWindow <= 0) {
|
|
38
|
+
return uncapped;
|
|
39
|
+
}
|
|
40
|
+
return Math.min(uncapped, Math.floor(contextWindow * AUTO_COMPACTION_WINDOW_RATIO));
|
|
14
41
|
}
|
|
15
42
|
export function registerCompactionTrigger(ext, runtime) {
|
|
16
43
|
ext.on("agent_end", (event, ctx) => {
|
|
@@ -34,7 +61,7 @@ export function registerCompactionTrigger(ext, runtime) {
|
|
|
34
61
|
}
|
|
35
62
|
const entries = ctx.sessionManager.getBranch();
|
|
36
63
|
const tokens = rawTokensSinceLastCompaction(entries);
|
|
37
|
-
const thresholdTokens = getPostRunCompactionThresholdTokens(runtime, policy);
|
|
64
|
+
const thresholdTokens = getPostRunCompactionThresholdTokens(runtime, policy, getContextWindow(ctx));
|
|
38
65
|
if (tokens < thresholdTokens)
|
|
39
66
|
return;
|
|
40
67
|
// Capture ctx properties synchronously — the setTimeout + async work below
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/relay/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAEV,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,YAAY,EACZ,SAAS,EACT,6BAA6B,EAC9B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAM3D;;;;;;;;;GASG;AACH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,6BAA6B,EAAE,CAAC;AAMlE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,2DAA2D;IA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AAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACjC,sDAAsD;IACtD,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC;CAClD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,gBAAgB,GACrB,IAAI,CAQN;AAED,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,gBAAgB,GACrB,IAAI,CAUN"}
|
package/dist/relay/dispatcher.js
CHANGED
|
@@ -130,8 +130,6 @@ async function emitChunkedSessionReady(relay, sessionId, history, attachResult,
|
|
|
130
130
|
intervalMinutes: attachResult.intervalMinutes,
|
|
131
131
|
intervalNextTickAt: attachResult.intervalNextTickAt,
|
|
132
132
|
intervalLaunchCount: attachResult.intervalLaunchCount,
|
|
133
|
-
intervalHasLoop: attachResult.intervalHasLoop || undefined,
|
|
134
|
-
intervalGoal: attachResult.intervalGoal,
|
|
135
133
|
runState: attachResult.runState,
|
|
136
134
|
},
|
|
137
135
|
});
|
|
@@ -227,19 +225,16 @@ export async function handleClientMessage(frame, deps) {
|
|
|
227
225
|
return;
|
|
228
226
|
}
|
|
229
227
|
// Interval scheduler control (sent as a content-less user_message).
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
228
|
+
const intervalControl = message.intervalControl;
|
|
229
|
+
if (intervalControl === "stop") {
|
|
232
230
|
manager.stopInterval(sessionId);
|
|
233
231
|
return;
|
|
234
232
|
}
|
|
235
|
-
if (
|
|
233
|
+
if (intervalControl === "run_now") {
|
|
236
234
|
manager.triggerIntervalNow(sessionId);
|
|
237
235
|
return;
|
|
238
236
|
}
|
|
239
237
|
const content = message.content;
|
|
240
|
-
const isLoop = message.loop === true;
|
|
241
|
-
const loopMaxIterations = message.loopMaxIterations;
|
|
242
|
-
const loopGoal = message.loopGoal;
|
|
243
238
|
// Rejected attachments (oversize inline base64, missing url+data, ...) are
|
|
244
239
|
// surfaced to the client instead of silently vanishing from the turn.
|
|
245
240
|
//
|
|
@@ -288,14 +283,6 @@ export async function handleClientMessage(frame, deps) {
|
|
|
288
283
|
});
|
|
289
284
|
return;
|
|
290
285
|
}
|
|
291
|
-
// Set autonomous iterative loop state before firing the prompt.
|
|
292
|
-
// loop:true → start/renew loop with the current content as original prompt;
|
|
293
|
-
// loop:false → stop any active loop.
|
|
294
|
-
// Arm loop state BEFORE any await: for non-reference prompts this is
|
|
295
|
-
// synchronous, preserving the client_message/subscribe interleave below.
|
|
296
|
-
// For "@preset:<name>" prompts this returns a promise that we await just
|
|
297
|
-
// before firing the turn, so the loop replays the EXPANDED prompt.
|
|
298
|
-
const armed = manager.setLoopActive(sessionId, isLoop, content, loopMaxIterations, loopGoal);
|
|
299
286
|
// 2. Attach (idempotent). On first attach we capture the replay payload
|
|
300
287
|
// and synthesize a `session_ready` ws_event so the browser sees the
|
|
301
288
|
// same first frame it would have on a direct WS connection.
|
|
@@ -354,40 +341,13 @@ export async function handleClientMessage(frame, deps) {
|
|
|
354
341
|
});
|
|
355
342
|
}
|
|
356
343
|
}
|
|
357
|
-
// "@preset:<name>" loop prompts: resolve the preset before the turn fires
|
|
358
|
-
// (undefined = already armed synchronously — no yield, no reordering).
|
|
359
|
-
// The arm path resolves to the EXPANDED prompt; `null` means it failed or
|
|
360
|
-
// was aborted (loop state changed mid-resolution) — fall back to the raw
|
|
361
|
-
// content in those cases. The promise is caught, not just awaited: serve
|
|
362
|
-
// calls this handler fire-and-forget, so a rejection (e.g. a sync throw
|
|
363
|
-
// from teamIdForSession inside the manager) would otherwise surface as an
|
|
364
|
-
// unhandled rejection instead of a visible error event.
|
|
365
|
-
let expandedLoopPrompt = null;
|
|
366
|
-
if (armed instanceof Promise) {
|
|
367
|
-
try {
|
|
368
|
-
expandedLoopPrompt = await armed;
|
|
369
|
-
}
|
|
370
|
-
catch (err) {
|
|
371
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
372
|
-
logger.error?.(`[dispatcher] loop arming failed for ${sessionId}:`, err);
|
|
373
|
-
relay.send({
|
|
374
|
-
kind: "ws_event",
|
|
375
|
-
sessionId,
|
|
376
|
-
event: { type: "error", message: humanizeProviderError(msg) },
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
const promptContent = expandedLoopPrompt ?? content;
|
|
381
344
|
// 3. Fire the prompt. `prompt()` resolves on `agent_end`; errors are
|
|
382
345
|
// converted to `error` events by the manager itself, so we just log.
|
|
383
346
|
// `modelId` (Phase 3 — Available Models whitelist) is forwarded as
|
|
384
347
|
// sticky next-prompt selection. The backend has already validated it
|
|
385
348
|
// against the team-scoped whitelist; the CLI resolves it via spectral's
|
|
386
349
|
// own model registry inside the manager → bridge.
|
|
387
|
-
|
|
388
|
-
// When `loop: true`, loop state is set before prompting; the normal
|
|
389
|
-
// model is used — loop replay is handled by session-stream on agent_end.
|
|
390
|
-
manager.prompt(sessionId, promptContent, modelId, validImages, reasoningEffort).catch((err) => {
|
|
350
|
+
manager.prompt(sessionId, content, modelId, validImages, reasoningEffort).catch((err) => {
|
|
391
351
|
logger.error?.(`[dispatcher] manager.prompt failed for ${sessionId}:`, err);
|
|
392
352
|
});
|
|
393
353
|
// Arm the interval scheduler after the first (immediate) launch.
|
|
@@ -395,9 +355,6 @@ export async function handleClientMessage(frame, deps) {
|
|
|
395
355
|
if (typeof intervalMinutes === "number" && intervalMinutes > 0) {
|
|
396
356
|
manager.armInterval(sessionId, {
|
|
397
357
|
prompt: content,
|
|
398
|
-
loop: isLoop,
|
|
399
|
-
loopMaxIterations,
|
|
400
|
-
loopGoal,
|
|
401
358
|
modelId,
|
|
402
359
|
reasoningEffort,
|
|
403
360
|
images: validImages,
|
package/dist/relay/routing.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { type WizardLoginResult } from "./wizard-login.js";
|
|
|
20
20
|
* `id` is populated when the route had an `:id` placeholder.
|
|
21
21
|
*/
|
|
22
22
|
interface RouteMatch {
|
|
23
|
-
route: "list_projects" | "create_project" | "update_project" | "delete_project" | "bind_studio" | "unbind_studio" | "get_project_observations" | "list_project_sessions" | "cleanup_project_sessions" | "cleanup_all_sessions" | "create_session" | "get_session" | "get_session_active_agent" | "update_session_active_agent" | "get_session_messages" | "update_session" | "delete_session" | "get_session_memory" | "get_session_memory_details" | "compact_session" | "remember_and_delete_session" | "fork_session" | "list_path_autocomplete" | "list_directory" | "get_home_directory" | "create_directory" | "search_project_files" | "enqueue_prompt" | "get_prompt_queue" | "remove_prompt" | "clear_prompt_queue" | "list_mcp_status" | "reload_mcp_config" | "refresh_native_extensions" | "refresh_cloud_agents" | "get_settings" | "put_settings" | "get_agent_settings" | "put_agent_settings" | "get_prompt_mutation_settings" | "put_prompt_mutation_settings" | "wizard_login" | "list_agents" | "list_dev_processes" | "start_dev_process" | "kill_dev_process" | "restart_dev_process" | "scan_dev_servers" | "kill_dev_server" | "list_secrets" | "create_secret" | "delete_secret";
|
|
23
|
+
route: "list_projects" | "create_project" | "update_project" | "delete_project" | "bind_studio" | "unbind_studio" | "get_project_observations" | "list_project_sessions" | "cleanup_project_sessions" | "cleanup_all_sessions" | "create_session" | "get_session" | "get_session_active_agent" | "update_session_active_agent" | "get_session_messages" | "update_session" | "delete_session" | "get_session_memory" | "get_session_memory_details" | "compact_session" | "remember_and_delete_session" | "fork_session" | "list_path_autocomplete" | "list_directory" | "get_home_directory" | "create_directory" | "search_project_files" | "enqueue_prompt" | "get_prompt_queue" | "remove_prompt" | "clear_prompt_queue" | "list_mcp_status" | "reload_mcp_config" | "start_mcp_auth" | "refresh_native_extensions" | "refresh_cloud_agents" | "get_settings" | "put_settings" | "get_agent_settings" | "put_agent_settings" | "get_prompt_mutation_settings" | "put_prompt_mutation_settings" | "wizard_login" | "list_agents" | "list_dev_processes" | "start_dev_process" | "kill_dev_process" | "restart_dev_process" | "scan_dev_servers" | "kill_dev_server" | "list_secrets" | "create_secret" | "delete_secret";
|
|
24
24
|
id?: string;
|
|
25
25
|
/** Parsed query params, if the path carried a `?...` suffix. */
|
|
26
26
|
query?: URLSearchParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/relay/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/relay/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAmDzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAczD,OAAO,EAAoB,KAAK,iBAAiB,EAA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C9B,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,6FAA6F;IAC7F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KACrC,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,OAAO,CAAC,CA4ZlB"}
|
package/dist/relay/routing.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import { BadRequestError } from "../server/handlers/errors.js";
|
|
14
|
+
import { handleStartMcpAuth } from "../server/handlers/mcp-auth.js";
|
|
14
15
|
import { handleListMcpStatus } from "../server/handlers/mcp-status.js";
|
|
15
16
|
import { handleReloadMcpConfig } from "../server/handlers/mcp-reload.js";
|
|
16
17
|
import { handlePathAutocomplete } from "../server/handlers/paths-autocomplete.js";
|
|
@@ -68,6 +69,11 @@ export function matchRoute(method, path) {
|
|
|
68
69
|
return { route: "reload_mcp_config" };
|
|
69
70
|
return null;
|
|
70
71
|
}
|
|
72
|
+
if (cleanPath === "/api/mcp-auth") {
|
|
73
|
+
if (method === "POST")
|
|
74
|
+
return { route: "start_mcp_auth" };
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
71
77
|
if (cleanPath === "/api/native-extensions/refresh") {
|
|
72
78
|
if (method === "POST")
|
|
73
79
|
return { route: "refresh_native_extensions" };
|
|
@@ -655,6 +661,9 @@ export async function dispatchRoute(match, body, deps) {
|
|
|
655
661
|
case "reload_mcp_config": {
|
|
656
662
|
return await handleReloadMcpConfig(deps.mcpState);
|
|
657
663
|
}
|
|
664
|
+
case "start_mcp_auth": {
|
|
665
|
+
return await handleStartMcpAuth(deps.mcpState, asObject(body));
|
|
666
|
+
}
|
|
658
667
|
case "refresh_native_extensions": {
|
|
659
668
|
if (!deps.refreshNativeExtensions) {
|
|
660
669
|
return { ok: true };
|
|
@@ -14,12 +14,19 @@
|
|
|
14
14
|
* as a base64 data URI — OpenRouter's server-side
|
|
15
15
|
* media fetcher gets HTTP 400 from S3 on
|
|
16
16
|
* presigned urls, so the raw presigned url must
|
|
17
|
-
* never reach the provider. If the
|
|
18
|
-
* fails
|
|
19
|
-
*
|
|
17
|
+
* never reach the provider. If the download
|
|
18
|
+
* fails the image is dropped — a presigned url
|
|
19
|
+
* is never sent as a fallback.
|
|
20
20
|
* (`/generated-images/<id>` is what the backend
|
|
21
21
|
* returns; it is AUTH-GATED, so handing it to a
|
|
22
22
|
* provider only yields a 401)
|
|
23
|
+
* - `url` S3 presigned -> STALE/EXPIRED signatures must never reach the
|
|
24
|
+
* provider ("Failed to fetch media from URL ...
|
|
25
|
+
* parameter=image_url" + 8x retry spam in old
|
|
26
|
+
* sessions): presigned sources are mapped back
|
|
27
|
+
* to the hosted ref (`/generated-images/<id>`)
|
|
28
|
+
* and re-signed fresh, else fetched + inlined
|
|
29
|
+
* directly, else DROPPED.
|
|
23
30
|
* - `url` relative -> resolved against the backend base url first
|
|
24
31
|
* - `url` local/private -> fetched and inlined **at send time only**
|
|
25
32
|
*
|
|
@@ -85,14 +92,6 @@ export interface ResolvedImageSource {
|
|
|
85
92
|
* (inline `data` present, or fetched from a local url).
|
|
86
93
|
*/
|
|
87
94
|
data?: string;
|
|
88
|
-
/**
|
|
89
|
-
* True when `url` is a presigned url returned by `resolveHostedUrl` (i.e.
|
|
90
|
-
* it replaced an auth-gated `/generated-images/<id>` reference). Only set
|
|
91
|
-
* when the presigned url itself is handed to the provider — which only
|
|
92
|
-
* happens as a fallback when inlining its bytes failed; a successful
|
|
93
|
-
* download is inlined (`inlined: true`) and the flag stays unset.
|
|
94
|
-
*/
|
|
95
|
-
hostedResolved?: boolean;
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
97
|
* True when `rawUrl` has no scheme, i.e. it is relative and therefore
|
|
@@ -104,6 +103,21 @@ export declare function isRelativeImageUrl(rawUrl: string): boolean;
|
|
|
104
103
|
* url. Absolute urls and missing base urls are returned untouched.
|
|
105
104
|
*/
|
|
106
105
|
export declare function resolveImageUrlAgainstBase(rawUrl: string, baseUrl?: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* True when `rawUrl` is an AWS S3 presigned GET (SigV4): its query string
|
|
108
|
+
* carries `X-Amz-Algorithm`/`X-Amz-Signature`/`X-Amz-Date` (case-insensitive
|
|
109
|
+
* per the SigV4 spec). Such urls are short-lived — a stale one sitting in
|
|
110
|
+
* persisted session history would fail every provider request forever.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isS3PresignedUrl(rawUrl: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Stable backend-hosted reference (`/generated-images/<uuid>`) for a
|
|
115
|
+
* presigned S3 url whose key follows the conversation-image convention
|
|
116
|
+
* (`<ownerPrefix>/images/<uuid>.<ext>`), or `null` when the path does not
|
|
117
|
+
* match. Resolving the hosted ref lets a request re-sign a FRESH presigned
|
|
118
|
+
* url — and rewrite the stale/expired signature out of the request entirely.
|
|
119
|
+
*/
|
|
120
|
+
export declare function hostedRefFromPresignedUrl(rawUrl: string): string | null;
|
|
107
121
|
/**
|
|
108
122
|
* True when a provider is unlikely to be able to fetch this URL itself and
|
|
109
123
|
* the image must therefore be inlined as base64 before sending.
|
|
@@ -148,6 +162,7 @@ export declare function base64FromImageData(data: string): string;
|
|
|
148
162
|
* Returns `null` when the block carries neither data nor url (nothing sendable).
|
|
149
163
|
* Local/private urls are fetched and inlined; failures fall back to the raw
|
|
150
164
|
* url so the caller still emits *something* rather than dropping the image.
|
|
165
|
+
* S3 presigned urls are never sent as-is — see `resolvePresignedSourceImage`.
|
|
151
166
|
*/
|
|
152
167
|
export declare function resolveImageForProvider(image: ImageContent, options?: ResolveImageOptions): Promise<ResolvedImageSource | null>;
|
|
153
168
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-source.d.ts","sourceRoot":"","sources":["../../../../src/sdk/ai/utils/image-source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image-source.d.ts","sourceRoot":"","sources":["../../../../src/sdk/ai/utils/image-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAW,MAAM,aAAa,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAEzD,iEAAiE;AACjE,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IACnC,mEAAmE;IACnE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,KAAK,CAA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