@burdenoff/fe-libs 2026.915.4 → 2026.916.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/shared/assistant/adminModeSendGate.d.ts +81 -0
- package/dist/shared/assistant/adminModeSendGate.d.ts.map +1 -0
- package/dist/shared/assistant/adminModeSendGate.js +37 -0
- package/dist/shared/assistant/api.d.ts +8 -6
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +2 -2
- package/dist/shared/assistant/conversation.d.ts +27 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.d.ts +9 -3
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +13 -10
- package/dist/shared/assistant/images.d.ts +37 -2
- package/dist/shared/assistant/images.d.ts.map +1 -1
- package/dist/shared/assistant/images.js +24 -16
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/legacyFiller.d.ts.map +1 -1
- package/dist/shared/assistant/legacyFiller.js +2 -2
- package/dist/shared/assistant/modeCapabilities.d.ts +115 -0
- package/dist/shared/assistant/modeCapabilities.d.ts.map +1 -0
- package/dist/shared/assistant/modeCapabilities.js +46 -0
- package/dist/shared/assistant/modeCopy.d.ts +27 -7
- package/dist/shared/assistant/modeCopy.d.ts.map +1 -1
- package/dist/shared/assistant/modeCopy.js +7 -1
- package/dist/shared/assistant/modeIds.d.ts +67 -0
- package/dist/shared/assistant/modeIds.d.ts.map +1 -0
- package/dist/shared/assistant/modeIds.js +21 -0
- package/dist/shared/assistant/streamBudget.d.ts +18 -18
- package/dist/shared/assistant/streamBudget.d.ts.map +1 -1
- package/dist/shared/assistant/streamBudget.js +21 -19
- package/dist/shared/assistant/types.d.ts +31 -1
- package/dist/shared/assistant/types.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +338 -315
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts +18 -2
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.js +38 -32
- package/dist/shared-assistant.js +118 -115
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeCapabilities.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/modeCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,yBAAyB;IACxC,sEAAsE;IACtE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,yFAAyF;IACzF,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,2EAA2E;AAC3E,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,mBAAmB,EACnB,IAAI,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,uBAAuB,CACxE,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,UAAY,CAAC;AASxD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAC/C,MAAM,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAcvD,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,4BAA4B,EAAE,yBAMvC,CAAC;AAeL;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EACtC,MAAM,CAAC,EAAE,6BAA6B,GAAG,IAAI,GAC5C,yBAAyB,CAuB3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE;IAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAC/D,MAAM,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GACxE,MAAM,GAAG,IAAI,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,aAAa,CAAA;CAAE,EACrE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACrC,CAAC,GAAG,SAAS,CAGf"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isBuiltInAssistantMode as e } from "./modeCopy.js";
|
|
2
|
+
import { isProductAssistantModeId as t } from "./modeIds.js";
|
|
3
|
+
//#region src/shared/assistant/modeCapabilities.ts
|
|
4
|
+
var n = 18e4, r = 6e5, i = 36e5, a = Object.freeze({
|
|
5
|
+
producesArtifacts: !1,
|
|
6
|
+
streamBudgetMs: n,
|
|
7
|
+
continuesInBackground: !1,
|
|
8
|
+
provisionable: !0
|
|
9
|
+
}), o = Object.freeze({
|
|
10
|
+
general: a,
|
|
11
|
+
assistant: a,
|
|
12
|
+
"api-calls": a,
|
|
13
|
+
"vibe-plugins": Object.freeze({
|
|
14
|
+
producesArtifacts: !0,
|
|
15
|
+
streamBudgetMs: r,
|
|
16
|
+
continuesInBackground: !0,
|
|
17
|
+
provisionable: !0
|
|
18
|
+
})
|
|
19
|
+
}), s = Object.freeze({
|
|
20
|
+
producesArtifacts: !1,
|
|
21
|
+
streamBudgetMs: n,
|
|
22
|
+
continuesInBackground: !1,
|
|
23
|
+
provisionable: !1
|
|
24
|
+
}), c = (e) => typeof e == "boolean" ? e : void 0, l = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= 36e5 ? e : void 0;
|
|
25
|
+
function u(n, r) {
|
|
26
|
+
let i = r && r.id === n ? r : void 0, u;
|
|
27
|
+
if (e(n)) u = o[n];
|
|
28
|
+
else if (i && t(n)) u = a;
|
|
29
|
+
else return s;
|
|
30
|
+
if (!i) return u;
|
|
31
|
+
let d = c(i.producesArtifacts);
|
|
32
|
+
return {
|
|
33
|
+
producesArtifacts: d ?? u.producesArtifacts,
|
|
34
|
+
streamBudgetMs: l(i.streamBudgetMs) ?? u.streamBudgetMs,
|
|
35
|
+
continuesInBackground: c(i.continuesInBackground) ?? d ?? u.continuesInBackground,
|
|
36
|
+
provisionable: !0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function d(e, t) {
|
|
40
|
+
return e?.requiresAdmin ? t.loading ? "Still checking whether you can use this assistant mode. Wait a moment, then send again." : t.canUseAdminModes ? null : "This assistant mode is only available to organization admins. Switch to another mode and send again." : null;
|
|
41
|
+
}
|
|
42
|
+
function f(e, t) {
|
|
43
|
+
if (t) return e?.find((e) => e.id === t);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { o as BUILT_IN_MODE_CAPABILITIES, i as MAX_ASSISTANT_STREAM_BUDGET_MS, s as UNDECLARED_MODE_CAPABILITIES, d as adminOnlyModeSendRefusal, f as findAssistantModeConfig, u as resolveAssistantModeCapabilities };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssistantMode } from './types';
|
|
1
|
+
import { AssistantMode, BuiltInAssistantMode } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* The shared English name of each mode: what a mode pill shows when the
|
|
4
4
|
* product's own `label` is empty.
|
|
@@ -9,9 +9,10 @@ import { AssistantMode } from './types';
|
|
|
9
9
|
* the manifest outside any React tree — so neither may live behind a component
|
|
10
10
|
* import.
|
|
11
11
|
*
|
|
12
|
-
* ★ `satisfies Record<
|
|
13
|
-
* union: a new mode without a name here, or a name for a
|
|
14
|
-
* exists, fails the typecheck.
|
|
12
|
+
* ★ `satisfies Record<BuiltInAssistantMode, string>` makes the table exactly
|
|
13
|
+
* the built-in union: a new built-in mode without a name here, or a name for a
|
|
14
|
+
* mode that no longer exists, fails the typecheck. Product-declared modes are
|
|
15
|
+
* named by `assistantModeFallbackLabel`.
|
|
15
16
|
*/
|
|
16
17
|
export declare const ASSISTANT_MODE_FALLBACK_LABELS: {
|
|
17
18
|
readonly general: "Ask";
|
|
@@ -20,8 +21,27 @@ export declare const ASSISTANT_MODE_FALLBACK_LABELS: {
|
|
|
20
21
|
readonly "vibe-plugins": "Build";
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
23
|
-
* Every mode id, read off the table above so the list cannot fall
|
|
24
|
-
* union.
|
|
24
|
+
* Every BUILT-IN mode id, read off the table above so the list cannot fall
|
|
25
|
+
* behind the union. Product-declared ids are, by design, not listed anywhere in
|
|
26
|
+
* shared code — see `ProductAssistantMode`.
|
|
25
27
|
*/
|
|
26
|
-
export declare const ASSISTANT_MODE_IDS: readonly
|
|
28
|
+
export declare const ASSISTANT_MODE_IDS: readonly BuiltInAssistantMode[];
|
|
29
|
+
/**
|
|
30
|
+
* Is this one of fe-libs' own modes?
|
|
31
|
+
*
|
|
32
|
+
* ★ Lives beside the table it reads, so the check and the list are one thing.
|
|
33
|
+
* `Object.hasOwn`, not `in`: `"toString" in table` is true.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isBuiltInAssistantMode(value: unknown): value is BuiltInAssistantMode;
|
|
36
|
+
/**
|
|
37
|
+
* The shared English name for a mode whose product gave an empty `label`.
|
|
38
|
+
*
|
|
39
|
+
* Built-in: the table above. Product-declared: named by what it does — the
|
|
40
|
+
* build mode's word for a mode that `producesArtifacts`, otherwise Ask's. Same
|
|
41
|
+
* two words the built-ins already use, so no new copy exists to seed.
|
|
42
|
+
*/
|
|
43
|
+
export declare function assistantModeFallbackLabel(mode: {
|
|
44
|
+
id: AssistantMode;
|
|
45
|
+
producesArtifacts?: boolean;
|
|
46
|
+
}): string;
|
|
27
47
|
//# sourceMappingURL=modeCopy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modeCopy.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/modeCopy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"modeCopy.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/modeCopy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B;;;;;CAKc,CAAC;AAE1D;;;;GAIG;AAGH,eAAO,MAAM,kBAAkB,EAE1B,SAAS,oBAAoB,EAAE,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAK/B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,EAAE,EAAE,aAAa,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,MAAM,CAOT"}
|
|
@@ -5,5 +5,11 @@ var e = {
|
|
|
5
5
|
"api-calls": "Take action",
|
|
6
6
|
"vibe-plugins": "Build"
|
|
7
7
|
}, t = Object.keys(e);
|
|
8
|
+
function n(t) {
|
|
9
|
+
return typeof t == "string" && Object.hasOwn(e, t);
|
|
10
|
+
}
|
|
11
|
+
function r(t) {
|
|
12
|
+
return n(t.id) ? e[t.id] : t.producesArtifacts === !0 ? e["vibe-plugins"] : e.assistant;
|
|
13
|
+
}
|
|
8
14
|
//#endregion
|
|
9
|
-
export { e as ASSISTANT_MODE_FALLBACK_LABELS, t as ASSISTANT_MODE_IDS };
|
|
15
|
+
export { e as ASSISTANT_MODE_FALLBACK_LABELS, t as ASSISTANT_MODE_IDS, r as assistantModeFallbackLabel, n as isBuiltInAssistantMode };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AssistantMode, BuiltInAssistantMode, ProductAssistantMode } from './types';
|
|
2
|
+
export { isBuiltInAssistantMode } from './modeCopy';
|
|
3
|
+
/**
|
|
4
|
+
* Which strings may name an assistant mode.
|
|
5
|
+
*
|
|
6
|
+
* Built-in ids are the `BuiltInAssistantMode` union. Everything else is a
|
|
7
|
+
* PRODUCT-declared id (see `ProductAssistantMode`) and must pass the checks
|
|
8
|
+
* below before shared code will provision, reuse, time or label a sandbox for it.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Lowercase kebab-case: `general`, `api-calls`, `vibe-plugins` all fit, and so
|
|
12
|
+
* does every product persona the sandbox service knows today.
|
|
13
|
+
*
|
|
14
|
+
* ★ Not cosmetic. The id is interpolated into the sandbox NAME
|
|
15
|
+
* (`ai-assistant-<id>-<epoch ms>`, a DNS-1123 label on the Kubernetes backend),
|
|
16
|
+
* stamped into its metadata, sent as `AI_ASSISTANT_MODE`, and becomes the last
|
|
17
|
+
* segment of the `mode.<id>` i18n key — where a `.` would split the key and a
|
|
18
|
+
* capital or space would make it unseedable.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PRODUCT_ASSISTANT_MODE_ID_PATTERN: RegExp;
|
|
21
|
+
/**
|
|
22
|
+
* `ai-assistant-` (13) + id + `-` + 13-digit epoch ms must stay within the
|
|
23
|
+
* 63-character label limit: 63 - 27 = 36, rounded down for headroom.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PRODUCT_ASSISTANT_MODE_ID_MAX_LENGTH = 32;
|
|
26
|
+
/**
|
|
27
|
+
* The built-in mode `value` extends with a `-` segment (`general-docs` →
|
|
28
|
+
* `general`), or undefined.
|
|
29
|
+
*
|
|
30
|
+
* ★★ Such an id is refused. Its sandboxes would be named
|
|
31
|
+
* `ai-assistant-general-docs-<epoch>`, which starts with the built-in's
|
|
32
|
+
* `ai-assistant-general-` — the prefix legacy built-in sandboxes are still
|
|
33
|
+
* recognised by. Metadata now decides first (`resolveSandboxAssistantMode`), so
|
|
34
|
+
* this is the second wall: no id a product can declare is a name-prefix
|
|
35
|
+
* collision with a built-in in the first place.
|
|
36
|
+
*/
|
|
37
|
+
export declare function builtInModeExtendedBy(value: string): BuiltInAssistantMode | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* A well-formed id that is NOT built in and does not extend a built-in's name —
|
|
40
|
+
* i.e. one only a product can declare.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isProductAssistantModeId(value: unknown): value is ProductAssistantMode;
|
|
43
|
+
/** Built in, or a well-formed product id. Says nothing about whether it is OFFERED. */
|
|
44
|
+
export declare function isAssistantModeId(value: unknown): value is AssistantMode;
|
|
45
|
+
/**
|
|
46
|
+
* Admit a backend mode id a product offers — the one way to obtain a
|
|
47
|
+
* `ProductAssistantMode`.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* const NODE_BUILDER = declareAssistantMode("acme-node");
|
|
51
|
+
* const modes = [{ id: NODE_BUILDER, label: "Build a node", producesArtifacts: true, streamBudgetMs: 600_000, ... }];
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* ★ Throws rather than returning null: this runs once at module load in the
|
|
55
|
+
* product, where a thrown error is a failed build or a red test, not a user-facing
|
|
56
|
+
* crash — and a mode that silently failed to declare would vanish from the panel.
|
|
57
|
+
*
|
|
58
|
+
* ★ A declared mode gets NO authority. It never receives the user's tokens, never
|
|
59
|
+
* runs read-only or write-gated, and runs on the proxy-token artifact image; see
|
|
60
|
+
* `sandboxBaseModeFor` and `forwardsUserTokensToSandbox`. Authority is granted
|
|
61
|
+
* only by being `assistant` or `api-calls`, which is a fe-libs change.
|
|
62
|
+
*
|
|
63
|
+
* @throws when `id` is a built-in mode (use it directly), extends a built-in's
|
|
64
|
+
* name (`general-docs`), or is not a valid id.
|
|
65
|
+
*/
|
|
66
|
+
export declare function declareAssistantMode(id: string): ProductAssistantMode;
|
|
67
|
+
//# sourceMappingURL=modeIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeIds.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/modeIds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,iCAAiC,QAAoC,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GACZ,oBAAoB,GAAG,SAAS,CAElC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAQ/B;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAExE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,CAkBrE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ASSISTANT_MODE_IDS as e, isBuiltInAssistantMode as t } from "./modeCopy.js";
|
|
2
|
+
//#region src/shared/assistant/modeIds.ts
|
|
3
|
+
var n = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, r = 32;
|
|
4
|
+
function i(t) {
|
|
5
|
+
return e.find((e) => t.startsWith(`${e}-`));
|
|
6
|
+
}
|
|
7
|
+
function a(e) {
|
|
8
|
+
return typeof e == "string" && e.length <= 32 && n.test(e) && !t(e) && i(e) === void 0;
|
|
9
|
+
}
|
|
10
|
+
function o(e) {
|
|
11
|
+
return t(e) || a(e);
|
|
12
|
+
}
|
|
13
|
+
function s(e) {
|
|
14
|
+
if (t(e)) throw Error(`declareAssistantMode: ${JSON.stringify(e)} is a built-in mode; use the id directly.`);
|
|
15
|
+
let n = typeof e == "string" ? i(e) : void 0;
|
|
16
|
+
if (n !== void 0) throw Error(`declareAssistantMode: ${JSON.stringify(e)} starts with the built-in mode "${n}-"; its sandboxes would be named like that mode's. Choose an id that does not.`);
|
|
17
|
+
if (!a(e)) throw Error(`declareAssistantMode: ${JSON.stringify(e)} is not a valid mode id (lowercase kebab-case, at most 32 characters).`);
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { r as PRODUCT_ASSISTANT_MODE_ID_MAX_LENGTH, n as PRODUCT_ASSISTANT_MODE_ID_PATTERN, i as builtInModeExtendedBy, s as declareAssistantMode, o as isAssistantModeId, a as isProductAssistantModeId };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssistantModeCapabilityConfig } from './modeCapabilities';
|
|
2
|
+
import { AssistantMode, BuiltInAssistantMode } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* How long the client streams progress before it stops polling a turn.
|
|
4
5
|
*
|
|
5
|
-
* Chat replies
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* TTL is auto-extended every 30s during the
|
|
9
|
-
* outlives the sandbox.
|
|
6
|
+
* Chat replies finish in seconds; a build is a multi-step pipeline that runs for
|
|
7
|
+
* minutes, so it gets a much larger budget. Which modes build is a CAPABILITY
|
|
8
|
+
* (`streamBudgetMs` on `AssistantModeConfig`, resolved in `modeCapabilities.ts`),
|
|
9
|
+
* not a list of mode ids. The sandbox TTL is auto-extended every 30s during the
|
|
10
|
+
* poll loop, so a longer budget never outlives the sandbox.
|
|
10
11
|
*
|
|
11
12
|
* ★★ THE BUDGET ELAPSING IS NOT AN ERROR. It used to be, for every mode except
|
|
12
|
-
*
|
|
13
|
+
* the build mode: the poll loop `throw`ew, the catch wrote
|
|
13
14
|
* `Sorry, an error occurred: …` into the assistant message, and that error was
|
|
14
15
|
* PERSISTED — it survived a reload, so the turn was destroyed rather than
|
|
15
16
|
* merely unfinished. Measured in production on 2026-09-12 with a 10.8 KB
|
|
@@ -21,29 +22,28 @@ import { AssistantMode } from './types';
|
|
|
21
22
|
* overwrite the conversation. So the budget elapsing now yields a normal
|
|
22
23
|
* assistant message: whatever content arrived, plus an honest closing note.
|
|
23
24
|
*/
|
|
24
|
-
export declare const STREAM_BUDGET_MS: Record<
|
|
25
|
-
export declare const DEFAULT_STREAM_BUDGET_MS
|
|
25
|
+
export declare const STREAM_BUDGET_MS: Record<BuiltInAssistantMode, number>;
|
|
26
|
+
export declare const DEFAULT_STREAM_BUDGET_MS: number;
|
|
26
27
|
/**
|
|
27
|
-
* Budget for `mode`,
|
|
28
|
+
* Budget for `mode`, with the product's config for it applied.
|
|
28
29
|
*
|
|
29
30
|
* Exported as a function rather than leaving callers to index the record, so a
|
|
30
31
|
* new mode cannot silently get `undefined` and a `NaN` deadline.
|
|
31
32
|
*/
|
|
32
|
-
export declare function streamBudgetMs(mode: AssistantMode): number;
|
|
33
|
+
export declare function streamBudgetMs(mode: AssistantMode, config?: AssistantModeCapabilityConfig | null): number;
|
|
33
34
|
/** i18n key + English fallback for the note closing an unfinished turn. */
|
|
34
35
|
export interface IncompleteTurnNotice {
|
|
35
36
|
key: string;
|
|
36
37
|
fallback: string;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
*
|
|
40
|
+
* Every note that can close an unfinished turn, whatever the mode.
|
|
40
41
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* raw braces to real users on most of the fleet. The elapsed budget is not worth
|
|
44
|
-
* that risk, and a reader does not need the number to know what to do next.
|
|
42
|
+
* ★ Two keys for any number of modes: the copy is chosen by capability, so a
|
|
43
|
+
* product declaring a new mode adds no notice keys to seed.
|
|
45
44
|
*/
|
|
46
|
-
export declare
|
|
45
|
+
export declare const INCOMPLETE_TURN_NOTICES: readonly IncompleteTurnNotice[];
|
|
46
|
+
export declare function incompleteTurnNotice(mode: AssistantMode, config?: AssistantModeCapabilityConfig | null): IncompleteTurnNotice;
|
|
47
47
|
/**
|
|
48
48
|
* Close an unfinished turn: keep every character the turn did produce, then
|
|
49
49
|
* append the note for `mode`.
|
|
@@ -53,5 +53,5 @@ export declare function incompleteTurnNotice(mode: AssistantMode): IncompleteTur
|
|
|
53
53
|
* silent failure. `translate` is injected rather than taken from a hook so this
|
|
54
54
|
* is testable without a React tree or an i18n provider.
|
|
55
55
|
*/
|
|
56
|
-
export declare function withIncompleteTurnNotice(content: string, mode: AssistantMode, translate: (key: string, fallback: string) => string): string;
|
|
56
|
+
export declare function withIncompleteTurnNotice(content: string, mode: AssistantMode, translate: (key: string, fallback: string) => string, config?: AssistantModeCapabilityConfig | null): string;
|
|
57
57
|
//# sourceMappingURL=streamBudget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamBudget.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/streamBudget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"streamBudget.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/streamBudget.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAKjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,QACQ,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,6BAA6B,GAAG,IAAI,GAC5C,MAAM,CAER;AAED,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AA+BD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EAGlE,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,6BAA6B,GAAG,IAAI,GAC5C,oBAAoB,CAMtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,EACpD,MAAM,CAAC,EAAE,6BAA6B,GAAG,IAAI,GAC5C,MAAM,CAWR"}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
+
import { BUILT_IN_MODE_CAPABILITIES as e, UNDECLARED_MODE_CAPABILITIES as t, resolveAssistantModeCapabilities as n } from "./modeCapabilities.js";
|
|
1
2
|
//#region src/shared/assistant/streamBudget.ts
|
|
2
|
-
var
|
|
3
|
-
general:
|
|
4
|
-
assistant:
|
|
5
|
-
"api-calls":
|
|
6
|
-
"vibe-plugins":
|
|
7
|
-
},
|
|
8
|
-
function
|
|
9
|
-
return e
|
|
3
|
+
var r = {
|
|
4
|
+
general: e.general.streamBudgetMs,
|
|
5
|
+
assistant: e.assistant.streamBudgetMs,
|
|
6
|
+
"api-calls": e["api-calls"].streamBudgetMs,
|
|
7
|
+
"vibe-plugins": e["vibe-plugins"].streamBudgetMs
|
|
8
|
+
}, i = t.streamBudgetMs;
|
|
9
|
+
function a(e, t) {
|
|
10
|
+
return n(e, t).streamBudgetMs;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var o = {
|
|
13
|
+
key: "assistant.turnIncomplete",
|
|
14
|
+
fallback: "_This turn stopped before an answer arrived. Your message and any attachment are still here — send it again, or try a shorter document or a narrower question._"
|
|
15
|
+
}, s = {
|
|
16
|
+
key: "assistant.turnStillBuilding",
|
|
17
|
+
fallback: "_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._"
|
|
18
|
+
}, c = [o, s];
|
|
19
|
+
function l(e, t) {
|
|
20
|
+
return { ...n(e, t).continuesInBackground ? s : o };
|
|
19
21
|
}
|
|
20
|
-
function
|
|
21
|
-
let i =
|
|
22
|
+
function u(e, t, n, r) {
|
|
23
|
+
let i = l(t, r), a;
|
|
22
24
|
try {
|
|
23
25
|
a = n(i.key, i.fallback) || i.fallback;
|
|
24
26
|
} catch {
|
|
@@ -27,4 +29,4 @@ function i(e, t, n) {
|
|
|
27
29
|
return e.trim() ? `${e}\n\n${a}` : a;
|
|
28
30
|
}
|
|
29
31
|
//#endregion
|
|
30
|
-
export {
|
|
32
|
+
export { i as DEFAULT_STREAM_BUDGET_MS, c as INCOMPLETE_TURN_NOTICES, r as STREAM_BUDGET_MS, l as incompleteTurnNotice, a as streamBudgetMs, u as withIncompleteTurnNotice };
|
|
@@ -6,7 +6,36 @@
|
|
|
6
6
|
* of this logic; this module centralizes it behind a config-driven factory. The
|
|
7
7
|
* only genuine per-product inputs are the product id and its `gatherPageContext`.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The modes fe-libs itself defines — and the only ones whose AUTHORITY it has
|
|
11
|
+
* audited. Every authority decision in `api.ts` (user tokens for `assistant`,
|
|
12
|
+
* the confirm-before-write gate for `api-calls`) is an equality test against one
|
|
13
|
+
* of these ids, so nothing outside this union can ever be handed a user token or
|
|
14
|
+
* a write path.
|
|
15
|
+
*/
|
|
16
|
+
export type BuiltInAssistantMode = 'general' | 'api-calls' | 'vibe-plugins' | 'assistant';
|
|
17
|
+
declare const productAssistantModeBrand: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* A backend mode id a PRODUCT declares through its seam (the `modes` it gives
|
|
20
|
+
* `AssistantProductProvider`): a persona the sandbox service and the agent image
|
|
21
|
+
* know, which shared code deliberately does not name.
|
|
22
|
+
*
|
|
23
|
+
* ★★ Branded, so the only way to hold one is `declareAssistantMode(id)`, which
|
|
24
|
+
* validates it. The id lands in a sandbox name, its metadata and an i18n key, so
|
|
25
|
+
* an unchecked string is not acceptable there — and a typo of a built-in id must
|
|
26
|
+
* not compile silently as a "new" mode.
|
|
27
|
+
*
|
|
28
|
+
* ★ Why fe-libs does not keep a list of these: the sandbox service is the
|
|
29
|
+
* authority on which mode ids exist (it answers an unknown one with
|
|
30
|
+
* `Unsupported assistant mode`), and a second hard-coded list is exactly what
|
|
31
|
+
* once rejected a mode after it had shipped in the agent image. Shared code also
|
|
32
|
+
* names no product (`noProductNames.test.ts`), and a product's mode id usually
|
|
33
|
+
* carries the product's name.
|
|
34
|
+
*/
|
|
35
|
+
export type ProductAssistantMode = string & {
|
|
36
|
+
readonly [productAssistantModeBrand]: true;
|
|
37
|
+
};
|
|
38
|
+
export type AssistantMode = BuiltInAssistantMode | ProductAssistantMode;
|
|
10
39
|
/** Local mirror of a product's PageContext; the transport forwards a subset. */
|
|
11
40
|
export interface PageContext {
|
|
12
41
|
currentUrl?: string;
|
|
@@ -168,4 +197,5 @@ export interface DownloadedAssistantArtifact {
|
|
|
168
197
|
mimeType: string;
|
|
169
198
|
contentBase64: string;
|
|
170
199
|
}
|
|
200
|
+
export {};
|
|
171
201
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/types.ts"],"names":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GAAG,MAAM,CAAC;AAE5C,sEAAsE;AACtE,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,kFAAkF;IAClF,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,iEAAiE;IACjE,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAuEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAuEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAwDvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAklExD,CAAC"}
|