@xemahq/ui-kernel 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/biome-host/index.d.ts +0 -1
- package/dist/lib/biome-host/index.d.ts.map +1 -1
- package/dist/lib/biome-host/index.js +0 -1
- package/dist/lib/biome-host/index.js.map +1 -1
- package/dist/lib/biome-host/session-contributions.d.ts +9 -4
- package/dist/lib/biome-host/session-contributions.d.ts.map +1 -1
- package/dist/registry/lib/session-context-builder.d.ts +10 -2
- package/dist/registry/lib/session-context-builder.d.ts.map +1 -1
- package/dist/registry/lib/session-context-builder.js +14 -7
- package/dist/registry/lib/session-context-builder.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/biome-host/index.ts +0 -1
- package/src/lib/biome-host/session-contributions.ts +21 -18
- package/src/registry/lib/session-context-builder.ts +33 -17
- package/dist/lib/biome-host/session-profiles.d.ts +0 -18
- package/dist/lib/biome-host/session-profiles.d.ts.map +0 -1
- package/dist/lib/biome-host/session-profiles.js +0 -38
- package/dist/lib/biome-host/session-profiles.js.map +0 -1
- package/src/lib/biome-host/session-profiles.ts +0 -105
|
@@ -9,7 +9,6 @@ export * from './define-web-biome';
|
|
|
9
9
|
export * from './create-biome-orval-config';
|
|
10
10
|
export * from './biome-registry';
|
|
11
11
|
export * from './session-contributions';
|
|
12
|
-
export * from './session-profiles';
|
|
13
12
|
export * from './host-sources';
|
|
14
13
|
export * from './biome-mode';
|
|
15
14
|
export * from './agent-validation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC"}
|
|
@@ -9,7 +9,6 @@ export * from './define-web-biome';
|
|
|
9
9
|
export * from './create-biome-orval-config';
|
|
10
10
|
export * from './biome-registry';
|
|
11
11
|
export * from './session-contributions';
|
|
12
|
-
export * from './session-profiles';
|
|
13
12
|
export * from './host-sources';
|
|
14
13
|
export * from './biome-mode';
|
|
15
14
|
export * from './agent-validation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import type { HostBridge } from './host-bridge';
|
|
3
|
-
import type { SessionProfileDescriptor } from './session-profiles';
|
|
4
3
|
export interface SessionContext {
|
|
5
4
|
readonly sessionId: string;
|
|
6
5
|
readonly orgId: string;
|
|
7
6
|
readonly projectId: string;
|
|
8
7
|
readonly biomeId?: string;
|
|
9
|
-
readonly profileKey?: string;
|
|
10
8
|
readonly status: string;
|
|
11
|
-
readonly
|
|
9
|
+
readonly agent?: SessionResolvedAgent;
|
|
10
|
+
readonly repositoryId?: string;
|
|
12
11
|
readonly isActive: boolean;
|
|
13
12
|
}
|
|
13
|
+
export interface SessionResolvedAgent {
|
|
14
|
+
readonly ref: string;
|
|
15
|
+
readonly requiredCapabilities: ReadonlySet<string>;
|
|
16
|
+
readonly mayEditRepositories: boolean;
|
|
17
|
+
readonly mayWriteKnowledgeBase: boolean;
|
|
18
|
+
readonly hasOutputSurface: boolean;
|
|
19
|
+
}
|
|
14
20
|
export interface SessionActivityEvent {
|
|
15
21
|
readonly id: string;
|
|
16
22
|
readonly kind: string;
|
|
@@ -138,6 +144,5 @@ export interface SessionContributions {
|
|
|
138
144
|
readonly mutationBars?: readonly MutationBarContribution[];
|
|
139
145
|
readonly headerChips?: readonly HeaderChipContribution[];
|
|
140
146
|
readonly attachmentClasses?: readonly AttachmentClassContribution[];
|
|
141
|
-
readonly profiles?: readonly SessionProfileDescriptor[];
|
|
142
147
|
}
|
|
143
148
|
//# sourceMappingURL=session-contributions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-contributions.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/session-contributions.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"session-contributions.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/session-contributions.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAM3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EA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;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAQD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IAClE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,CACtB,GAAG,EAAE,qBAAqB,KACvB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CAC3C;AAWD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC7D,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACrE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC3D,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACzD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;CACrE"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SessionContext } from '../../index';
|
|
2
|
+
export interface SessionResolvedAgentInput {
|
|
3
|
+
readonly ref: string;
|
|
4
|
+
readonly requiredCapabilities: readonly string[];
|
|
5
|
+
readonly mayEditRepositories: boolean;
|
|
6
|
+
readonly mayWriteKnowledgeBase: boolean;
|
|
7
|
+
readonly hasOutputSurface: boolean;
|
|
8
|
+
}
|
|
2
9
|
export interface BuildSessionContextInput {
|
|
3
10
|
readonly sessionId: string;
|
|
4
11
|
readonly orgId: string;
|
|
5
12
|
readonly projectId: string;
|
|
6
13
|
readonly biomeId?: string;
|
|
7
|
-
readonly
|
|
14
|
+
readonly repositoryId?: string;
|
|
15
|
+
readonly agent?: SessionResolvedAgentInput;
|
|
8
16
|
readonly status: string;
|
|
9
17
|
readonly isActive: boolean;
|
|
10
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-context-builder.d.ts","sourceRoot":"","sources":["../../../src/registry/lib/session-context-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-context-builder.d.ts","sourceRoot":"","sources":["../../../src/registry/lib/session-context-builder.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAUD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,wBAAwB,GAC9B,cAAc,CAkChB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useSessionProfileDescriptor, } from '../../index';
|
|
3
2
|
const TERMINAL_STATUSES = new Set([
|
|
4
3
|
'paused',
|
|
5
4
|
'completed',
|
|
@@ -11,25 +10,33 @@ export function isStatusActive(status) {
|
|
|
11
10
|
return !TERMINAL_STATUSES.has(status);
|
|
12
11
|
}
|
|
13
12
|
export function useSessionContext(input) {
|
|
14
|
-
const descriptor = useSessionProfileDescriptor(input.biomeId, input.profileKey);
|
|
15
13
|
return useMemo(() => ({
|
|
16
14
|
sessionId: input.sessionId,
|
|
17
15
|
orgId: input.orgId,
|
|
18
16
|
projectId: input.projectId,
|
|
19
|
-
biomeId: input.biomeId
|
|
20
|
-
|
|
17
|
+
...(input.biomeId !== undefined ? { biomeId: input.biomeId } : {}),
|
|
18
|
+
...(input.repositoryId !== undefined
|
|
19
|
+
? { repositoryId: input.repositoryId }
|
|
20
|
+
: {}),
|
|
21
|
+
...(input.agent !== undefined
|
|
22
|
+
? {
|
|
23
|
+
agent: {
|
|
24
|
+
...input.agent,
|
|
25
|
+
requiredCapabilities: Object.freeze(new Set(input.agent.requiredCapabilities)),
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
21
29
|
status: input.status,
|
|
22
|
-
capabilities: Object.freeze(new Set(descriptor.capabilities)),
|
|
23
30
|
isActive: input.isActive,
|
|
24
31
|
}), [
|
|
25
32
|
input.sessionId,
|
|
26
33
|
input.orgId,
|
|
27
34
|
input.projectId,
|
|
28
35
|
input.biomeId,
|
|
29
|
-
input.
|
|
36
|
+
input.repositoryId,
|
|
37
|
+
input.agent,
|
|
30
38
|
input.status,
|
|
31
39
|
input.isActive,
|
|
32
|
-
descriptor,
|
|
33
40
|
]);
|
|
34
41
|
}
|
|
35
42
|
//# sourceMappingURL=session-context-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-context-builder.js","sourceRoot":"","sources":["../../../src/registry/lib/session-context-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-context-builder.js","sourceRoot":"","sources":["../../../src/registry/lib/session-context-builder.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAuBhC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,QAAQ;IACR,WAAW;IACX,WAAW;IACX,QAAQ;IACR,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAA+B;IAE/B,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE;YACtC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS;YAC3B,CAAC,CAAC;gBACE,KAAK,EAAE;oBACL,GAAG,KAAK,CAAC,KAAK;oBACd,oBAAoB,EAAE,MAAM,CAAC,MAAM,CACjC,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAC1C;iBACF;aACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,EACF;QACE,KAAK,CAAC,SAAS;QACf,KAAK,CAAC,KAAK;QACX,KAAK,CAAC,SAAS;QACf,KAAK,CAAC,OAAO;QACb,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,KAAK;QACX,KAAK,CAAC,MAAM;QACZ,KAAK,CAAC,QAAQ;KACf,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/ui-kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Host-framework-agnostic UI kernel for the Xema OS. Defines the SystemBus orchestration contract (capability.invoke, cross-biome intents, command palette, xema:// deeplinks, window manager) AND the biome-host contract surface (FrontendBiome/FrontendBiomeFactory, HostBridge, the singleton biomeRegistry, session contributions) that every frontend biome composes against. No Vite, Next.js, or React-Router — React itself IS allowed as the shared component model (the contracts traffic in ReactNode/ComponentType and a React context). Concrete host adapters (router/auth/toast wiring) live in separate packages that consume this kernel. The SystemBus is pure orchestration: it never authorizes, the backend capability-router enforces all policy.",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"prettier": "3.6.2",
|
|
78
78
|
"react": "^18.3.1",
|
|
79
79
|
"typescript": "5.9.3",
|
|
80
|
-
"@xemahq/kernel-contracts": "^0.
|
|
80
|
+
"@xemahq/kernel-contracts": "^0.60.0"
|
|
81
81
|
},
|
|
82
82
|
"exports": {
|
|
83
83
|
".": {
|
|
@@ -23,7 +23,6 @@ export * from './define-web-biome';
|
|
|
23
23
|
export * from './create-biome-orval-config';
|
|
24
24
|
export * from './biome-registry';
|
|
25
25
|
export * from './session-contributions';
|
|
26
|
-
export * from './session-profiles';
|
|
27
26
|
export * from './host-sources';
|
|
28
27
|
export * from './biome-mode';
|
|
29
28
|
export * from './agent-validation';
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* `SessionContext`.
|
|
14
14
|
*
|
|
15
15
|
* `appliesTo` is the single gating primitive — biomes use it to scope
|
|
16
|
-
* a contribution to
|
|
17
|
-
*
|
|
16
|
+
* a contribution to explicit Agent, workspace, domain, or session status
|
|
17
|
+
* facts. Without it, every contribution applies everywhere.
|
|
18
18
|
*
|
|
19
19
|
* Naming convention: contribution ids MUST be namespaced as
|
|
20
20
|
* `<biome-id>/<contribution>` so cross-biome collisions surface
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
import type { ComponentType, ReactNode } from 'react';
|
|
24
24
|
|
|
25
25
|
import type { HostBridge } from './host-bridge';
|
|
26
|
-
import type { SessionProfileDescriptor } from './session-profiles';
|
|
27
|
-
|
|
28
26
|
/**
|
|
29
27
|
* Read-only snapshot of the session the contribution is evaluated
|
|
30
28
|
* against. Passed into every `appliesTo` predicate and every render
|
|
@@ -41,14 +39,15 @@ export interface SessionContext {
|
|
|
41
39
|
* sessions they care about.
|
|
42
40
|
*/
|
|
43
41
|
readonly biomeId?: string;
|
|
44
|
-
readonly profileKey?: string;
|
|
45
42
|
readonly status: string;
|
|
46
43
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* The resolved Agent contract that launched this session. This is
|
|
45
|
+
* runtime truth returned by the Agent resolver, never a UI-authored
|
|
46
|
+
* profile or a synthetic fallback.
|
|
50
47
|
*/
|
|
51
|
-
readonly
|
|
48
|
+
readonly agent?: SessionResolvedAgent;
|
|
49
|
+
/** Repository actually bound to the session, when one exists. */
|
|
50
|
+
readonly repositoryId?: string;
|
|
52
51
|
/**
|
|
53
52
|
* `true` while the session is in a state that accepts new work
|
|
54
53
|
* (running, waiting, idle); `false` for terminal/paused/failed states.
|
|
@@ -58,6 +57,19 @@ export interface SessionContext {
|
|
|
58
57
|
readonly isActive: boolean;
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
/**
|
|
61
|
+
* UI-safe projection of the resolved Agent contract. The host obtains this
|
|
62
|
+
* from the Agent resolver and passes it into the kernel; plugins only consume
|
|
63
|
+
* the explicit permission/workspace facts they need.
|
|
64
|
+
*/
|
|
65
|
+
export interface SessionResolvedAgent {
|
|
66
|
+
readonly ref: string;
|
|
67
|
+
readonly requiredCapabilities: ReadonlySet<string>;
|
|
68
|
+
readonly mayEditRepositories: boolean;
|
|
69
|
+
readonly mayWriteKnowledgeBase: boolean;
|
|
70
|
+
readonly hasOutputSurface: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
/**
|
|
62
74
|
* Stable representation of a session console event passed into activity
|
|
63
75
|
* + tool-call renderers. Mirrors the host's `SessionConsoleEntry` minus
|
|
@@ -281,13 +293,4 @@ export interface SessionContributions {
|
|
|
281
293
|
readonly mutationBars?: readonly MutationBarContribution[];
|
|
282
294
|
readonly headerChips?: readonly HeaderChipContribution[];
|
|
283
295
|
readonly attachmentClasses?: readonly AttachmentClassContribution[];
|
|
284
|
-
/**
|
|
285
|
-
* Profile descriptors this biome owns. The host matches a session's
|
|
286
|
-
* `profileKey` against these and fans out the descriptor's
|
|
287
|
-
* `capabilities` as `SessionContext.capabilities`, which each
|
|
288
|
-
* contribution's `appliesTo` predicate reads. A biome that ships a
|
|
289
|
-
* profile MUST also ship its descriptor here so the capability vocab
|
|
290
|
-
* stays explicit rather than implicit-from-key-naming.
|
|
291
|
-
*/
|
|
292
|
-
readonly profiles?: readonly SessionProfileDescriptor[];
|
|
293
296
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* Single helper hook the host's session shell calls once per render to
|
|
3
3
|
* build the `SessionContext` it passes into every contribution selector.
|
|
4
4
|
*
|
|
5
|
-
* Inputs are the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `SessionContext`. Memoised by the underlying selectors — callers can
|
|
9
|
-
* pass the result as a dep without worrying about identity churn.
|
|
5
|
+
* Inputs are the host's session fields plus the resolved Agent projection.
|
|
6
|
+
* The helper freezes capability refs and returns a stable `SessionContext`.
|
|
7
|
+
* It never fabricates a profile or capability fallback.
|
|
10
8
|
*
|
|
11
9
|
* Keeping this helper in the SDK (rather than the host) is what lets
|
|
12
10
|
* biomes also build a context — e.g. from inside a slash command
|
|
@@ -14,17 +12,23 @@
|
|
|
14
12
|
*/
|
|
15
13
|
import { useMemo } from 'react';
|
|
16
14
|
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
import type { SessionContext } from '../../index';
|
|
16
|
+
|
|
17
|
+
export interface SessionResolvedAgentInput {
|
|
18
|
+
readonly ref: string;
|
|
19
|
+
readonly requiredCapabilities: readonly string[];
|
|
20
|
+
readonly mayEditRepositories: boolean;
|
|
21
|
+
readonly mayWriteKnowledgeBase: boolean;
|
|
22
|
+
readonly hasOutputSurface: boolean;
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
export interface BuildSessionContextInput {
|
|
23
26
|
readonly sessionId: string;
|
|
24
27
|
readonly orgId: string;
|
|
25
28
|
readonly projectId: string;
|
|
26
29
|
readonly biomeId?: string;
|
|
27
|
-
readonly
|
|
30
|
+
readonly repositoryId?: string;
|
|
31
|
+
readonly agent?: SessionResolvedAgentInput;
|
|
28
32
|
readonly status: string;
|
|
29
33
|
readonly isActive: boolean;
|
|
30
34
|
}
|
|
@@ -41,17 +45,29 @@ export function isStatusActive(status: string): boolean {
|
|
|
41
45
|
return !TERMINAL_STATUSES.has(status);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
export function useSessionContext(
|
|
45
|
-
|
|
48
|
+
export function useSessionContext(
|
|
49
|
+
input: BuildSessionContextInput,
|
|
50
|
+
): SessionContext {
|
|
46
51
|
return useMemo<SessionContext>(
|
|
47
52
|
() => ({
|
|
48
53
|
sessionId: input.sessionId,
|
|
49
54
|
orgId: input.orgId,
|
|
50
55
|
projectId: input.projectId,
|
|
51
|
-
biomeId: input.biomeId
|
|
52
|
-
|
|
56
|
+
...(input.biomeId !== undefined ? { biomeId: input.biomeId } : {}),
|
|
57
|
+
...(input.repositoryId !== undefined
|
|
58
|
+
? { repositoryId: input.repositoryId }
|
|
59
|
+
: {}),
|
|
60
|
+
...(input.agent !== undefined
|
|
61
|
+
? {
|
|
62
|
+
agent: {
|
|
63
|
+
...input.agent,
|
|
64
|
+
requiredCapabilities: Object.freeze(
|
|
65
|
+
new Set(input.agent.requiredCapabilities),
|
|
66
|
+
),
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
: {}),
|
|
53
70
|
status: input.status,
|
|
54
|
-
capabilities: Object.freeze(new Set(descriptor.capabilities)),
|
|
55
71
|
isActive: input.isActive,
|
|
56
72
|
}),
|
|
57
73
|
[
|
|
@@ -59,10 +75,10 @@ export function useSessionContext(input: BuildSessionContextInput): SessionConte
|
|
|
59
75
|
input.orgId,
|
|
60
76
|
input.projectId,
|
|
61
77
|
input.biomeId,
|
|
62
|
-
input.
|
|
78
|
+
input.repositoryId,
|
|
79
|
+
input.agent,
|
|
63
80
|
input.status,
|
|
64
81
|
input.isActive,
|
|
65
|
-
descriptor,
|
|
66
82
|
],
|
|
67
83
|
);
|
|
68
84
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const SessionCapabilities: {
|
|
2
|
-
readonly HasGit: "hasGit";
|
|
3
|
-
readonly HasWorkspaceFiles: "hasWorkspaceFiles";
|
|
4
|
-
readonly SupportsKbPush: "supportsKbPush";
|
|
5
|
-
readonly HasArtifacts: "hasArtifacts";
|
|
6
|
-
readonly SupportsForking: "supportsForking";
|
|
7
|
-
readonly SupportsSharing: "supportsSharing";
|
|
8
|
-
};
|
|
9
|
-
export type SessionCapability = (typeof SessionCapabilities)[keyof typeof SessionCapabilities];
|
|
10
|
-
export interface SessionProfileDescriptor {
|
|
11
|
-
readonly key: string;
|
|
12
|
-
readonly biomeId: string;
|
|
13
|
-
readonly label: string;
|
|
14
|
-
readonly description?: string;
|
|
15
|
-
readonly capabilities: readonly string[];
|
|
16
|
-
}
|
|
17
|
-
export declare function useSessionProfileDescriptor(biomeId: string | undefined, profileKey: string | undefined): SessionProfileDescriptor;
|
|
18
|
-
//# sourceMappingURL=session-profiles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-profiles.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/session-profiles.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB;;;;;;;CAatB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,MAAM,WAAW,wBAAwB;IAKvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAcD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,wBAAwB,CA2B1B"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { biomeRegistry, useBiomeRegistryRevision } from './biome-registry';
|
|
3
|
-
export const SessionCapabilities = {
|
|
4
|
-
HasGit: 'hasGit',
|
|
5
|
-
HasWorkspaceFiles: 'hasWorkspaceFiles',
|
|
6
|
-
SupportsKbPush: 'supportsKbPush',
|
|
7
|
-
HasArtifacts: 'hasArtifacts',
|
|
8
|
-
SupportsForking: 'supportsForking',
|
|
9
|
-
SupportsSharing: 'supportsSharing',
|
|
10
|
-
};
|
|
11
|
-
export function useSessionProfileDescriptor(biomeId, profileKey) {
|
|
12
|
-
const revision = useBiomeRegistryRevision();
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
const fallback = {
|
|
15
|
-
key: profileKey ?? 'unknown',
|
|
16
|
-
biomeId: biomeId ?? 'unknown',
|
|
17
|
-
label: profileKey ?? 'Unknown profile',
|
|
18
|
-
capabilities: [],
|
|
19
|
-
};
|
|
20
|
-
if (!profileKey)
|
|
21
|
-
return fallback;
|
|
22
|
-
let crossPluginMatch;
|
|
23
|
-
for (const biome of biomeRegistry.list()) {
|
|
24
|
-
for (const profile of biome.session?.profiles ?? []) {
|
|
25
|
-
if (profile.key !== profileKey)
|
|
26
|
-
continue;
|
|
27
|
-
if (biomeId !== null &&
|
|
28
|
-
biomeId !== undefined &&
|
|
29
|
-
profile.biomeId === biomeId) {
|
|
30
|
-
return profile;
|
|
31
|
-
}
|
|
32
|
-
crossPluginMatch ??= profile;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return crossPluginMatch ?? fallback;
|
|
36
|
-
}, [revision, biomeId, profileKey]);
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=session-profiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-profiles.js","sourceRoot":"","sources":["../../../src/lib/biome-host/session-profiles.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAU3E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAEjC,MAAM,EAAE,QAAQ;IAEhB,iBAAiB,EAAE,mBAAmB;IAEtC,cAAc,EAAE,gBAAgB;IAEhC,YAAY,EAAE,cAAc;IAE5B,eAAe,EAAE,iBAAiB;IAElC,eAAe,EAAE,iBAAiB;CAC1B,CAAC;AAgCX,MAAM,UAAU,2BAA2B,CACzC,OAA2B,EAC3B,UAA8B;IAE9B,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAC;IAC5C,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,QAAQ,GAA6B;YACzC,GAAG,EAAE,UAAU,IAAI,SAAS;YAC5B,OAAO,EAAE,OAAO,IAAI,SAAS;YAC7B,KAAK,EAAE,UAAU,IAAI,iBAAiB;YACtC,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,IAAI,CAAC,UAAU;YAAE,OAAO,QAAQ,CAAC;QACjC,IAAI,gBAAsD,CAAC;QAC3D,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;YACzC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC;gBACpD,IAAI,OAAO,CAAC,GAAG,KAAK,UAAU;oBAAE,SAAS;gBACzC,IACE,OAAO,KAAK,IAAI;oBAChB,OAAO,KAAK,SAAS;oBACrB,OAAO,CAAC,OAAO,KAAK,OAAO,EAC3B,CAAC;oBACD,OAAO,OAAO,CAAC;gBACjB,CAAC;gBACD,gBAAgB,KAAK,OAAO,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,OAAO,gBAAgB,IAAI,QAAQ,CAAC;IAEtC,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session profile descriptors — coarse capability flags that gate which
|
|
3
|
-
* UI surfaces a session shows. A profile is owned by exactly one biome
|
|
4
|
-
* (matched by `(biomeId, key)`) and declares a set of namespaced
|
|
5
|
-
* capability strings the host fans out as `SessionContext.capabilities`.
|
|
6
|
-
*
|
|
7
|
-
* Biomes consume capabilities through each contribution's `appliesTo`
|
|
8
|
-
* predicate — the host shell itself never branches on a capability
|
|
9
|
-
* string. This keeps the host neutral; a session that doesn't declare
|
|
10
|
-
* `hasGit` simply gets no git-touching contributions because every git
|
|
11
|
-
* contribution gates on `ctx.capabilities.has('hasGit')`.
|
|
12
|
-
*
|
|
13
|
-
* Capability namespacing: well-known capabilities are documented here as
|
|
14
|
-
* constants so first-party biomes agree on a vocabulary; third-party
|
|
15
|
-
* biomes MUST namespace their own capabilities (`<biome-id>:<flag>`)
|
|
16
|
-
* to avoid collisions.
|
|
17
|
-
*/
|
|
18
|
-
import { useMemo } from 'react';
|
|
19
|
-
|
|
20
|
-
import { biomeRegistry, useBiomeRegistryRevision } from './biome-registry';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Well-known capability flags first-party biomes share. Third-party
|
|
24
|
-
* biomes SHOULD prefer namespacing their own (`<biome-id>:<flag>`).
|
|
25
|
-
*
|
|
26
|
-
* Adding a constant here is a contract-stability statement — it
|
|
27
|
-
* documents a flag enough first-party biomes use that we want a stable
|
|
28
|
-
* spelling. Removing one is a breaking change.
|
|
29
|
-
*/
|
|
30
|
-
export const SessionCapabilities = {
|
|
31
|
-
/** Session backs a git workspace; branches, commits, push, PR. */
|
|
32
|
-
HasGit: 'hasGit',
|
|
33
|
-
/** Session emits workspace file mutations (created/edited/deleted). */
|
|
34
|
-
HasWorkspaceFiles: 'hasWorkspaceFiles',
|
|
35
|
-
/** Session can publish artefacts back to the knowledge base. */
|
|
36
|
-
SupportsKbPush: 'supportsKbPush',
|
|
37
|
-
/** Session can open / render in-workspace artefacts (apps, docs). */
|
|
38
|
-
HasArtifacts: 'hasArtifacts',
|
|
39
|
-
/** Session can fork to a new branch. */
|
|
40
|
-
SupportsForking: 'supportsForking',
|
|
41
|
-
/** Session can share its output (deliverable) to other surfaces. */
|
|
42
|
-
SupportsSharing: 'supportsSharing',
|
|
43
|
-
} as const;
|
|
44
|
-
|
|
45
|
-
export type SessionCapability =
|
|
46
|
-
(typeof SessionCapabilities)[keyof typeof SessionCapabilities];
|
|
47
|
-
|
|
48
|
-
export interface SessionProfileDescriptor {
|
|
49
|
-
/**
|
|
50
|
-
* Stable profile key — matches the backend's `Session.profileKey`
|
|
51
|
-
* (or the session manifest slug for newer profiles).
|
|
52
|
-
*/
|
|
53
|
-
readonly key: string;
|
|
54
|
-
/** Biome that owns this profile. */
|
|
55
|
-
readonly biomeId: string;
|
|
56
|
-
/** Displayed label. */
|
|
57
|
-
readonly label: string;
|
|
58
|
-
readonly description?: string;
|
|
59
|
-
/** Capability flags the host fans out as `SessionContext.capabilities`. */
|
|
60
|
-
readonly capabilities: readonly string[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Hook returning the descriptor that matches a session's `(biomeId,
|
|
65
|
-
* profileKey)`. Falls back to a synthetic descriptor with the well-known
|
|
66
|
-
* core capabilities when no biome owns the profile — that's how
|
|
67
|
-
* sessions started before any biome loaded still get usable defaults
|
|
68
|
-
* (today's behaviour).
|
|
69
|
-
*
|
|
70
|
-
* Resolution order:
|
|
71
|
-
* 1. Exact match on `(biomeId, key)`.
|
|
72
|
-
* 2. Exact match on `key` alone (cross-biome profile name).
|
|
73
|
-
* 3. Synthetic fallback (`unknown` biome, empty capabilities).
|
|
74
|
-
*/
|
|
75
|
-
export function useSessionProfileDescriptor(
|
|
76
|
-
biomeId: string | undefined,
|
|
77
|
-
profileKey: string | undefined,
|
|
78
|
-
): SessionProfileDescriptor {
|
|
79
|
-
const revision = useBiomeRegistryRevision();
|
|
80
|
-
return useMemo(() => {
|
|
81
|
-
const fallback: SessionProfileDescriptor = {
|
|
82
|
-
key: profileKey ?? 'unknown',
|
|
83
|
-
biomeId: biomeId ?? 'unknown',
|
|
84
|
-
label: profileKey ?? 'Unknown profile',
|
|
85
|
-
capabilities: [],
|
|
86
|
-
};
|
|
87
|
-
if (!profileKey) return fallback;
|
|
88
|
-
let crossPluginMatch: SessionProfileDescriptor | undefined;
|
|
89
|
-
for (const biome of biomeRegistry.list()) {
|
|
90
|
-
for (const profile of biome.session?.profiles ?? []) {
|
|
91
|
-
if (profile.key !== profileKey) continue;
|
|
92
|
-
if (
|
|
93
|
-
biomeId !== null &&
|
|
94
|
-
biomeId !== undefined &&
|
|
95
|
-
profile.biomeId === biomeId
|
|
96
|
-
) {
|
|
97
|
-
return profile;
|
|
98
|
-
}
|
|
99
|
-
crossPluginMatch ??= profile;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return crossPluginMatch ?? fallback;
|
|
103
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
|
-
}, [revision, biomeId, profileKey]);
|
|
105
|
-
}
|