@zonease/aiworker-cli 0.13.1 → 0.14.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 +3 -0
- package/aiworker-bun.js +252 -245
- package/official-apps/aiworker-hr/dist/host-mounted.js +22 -5
- package/official-apps/aiworker-hr/dist/index.js +6 -2
- package/official-apps/aiworker-hr/dist/standalone.js +6 -2
- package/official-apps/aiworker-hr/skills/candidate-profile/SKILL.md +32 -0
- package/official-apps/aiworker-hr/skills/evidence-screening/SKILL.md +32 -0
- package/official-apps/aiworker-hr/skills/hiring-risk-review/SKILL.md +33 -0
- package/official-apps/aiworker-hr/skills/interview-brief/SKILL.md +31 -0
- package/official-apps/aiworker-hr/skills/profile-update-proposal/SKILL.md +29 -0
- package/official-apps/aiworker-hr/src/host-mounted.ts +17 -3
- package/official-apps/aiworker-qa/dist/host-mounted.js +22 -5
- package/official-apps/aiworker-qa/dist/index.js +6 -2
- package/official-apps/aiworker-qa/dist/standalone.js +6 -2
- package/official-apps/aiworker-qa/src/host-mounted.ts +17 -3
- package/package.json +1 -1
- package/web/worker/assets/index-CX4fPJXV.js +18 -0
- package/web/worker/assets/{index-K-y56wrL.css → index-xCuCRnvM.css} +1 -1
- package/web/worker/assets/people-workbench-DM7Dw1QO.js +1 -0
- package/web/worker/index.html +2 -2
- package/web/worker/assets/index-YNnnk64n.js +0 -18
- package/web/worker/assets/people-workbench-BzWwSc2I.js +0 -1
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -15450,7 +15454,11 @@ function serveHostMounted(port = Number(Bun.env.PORT ?? 0)) {
|
|
|
15450
15454
|
const hostUrl = request.headers.get("x-aiworker-host-url") ?? Bun.env.AIWORKER_HOST_URL;
|
|
15451
15455
|
if (!hostUrl)
|
|
15452
15456
|
return Response.json({ appId: hrSoulAppManifest2.id, broker: "not-configured", permissions: [] });
|
|
15453
|
-
const client = createSoulAppClient({
|
|
15457
|
+
const client = createSoulAppClient({
|
|
15458
|
+
appId: hrSoulAppManifest2.id,
|
|
15459
|
+
baseUrl: hostUrl,
|
|
15460
|
+
mountToken: request.headers.get("x-aiworker-mount-token") ?? undefined
|
|
15461
|
+
});
|
|
15454
15462
|
return Response.json(await client.broker.permissions.list());
|
|
15455
15463
|
}
|
|
15456
15464
|
if (url.pathname === "/protocol/capabilities") {
|
|
@@ -15570,7 +15578,11 @@ async function persistPeopleProfileDraft(request) {
|
|
|
15570
15578
|
return { ok: true };
|
|
15571
15579
|
const draftKey = `drafts/people-profile/${context.workspaceId ?? "app"}`;
|
|
15572
15580
|
const workspaceRef = context.workspaceId ?? "app";
|
|
15573
|
-
const client = createSoulAppClient({
|
|
15581
|
+
const client = createSoulAppClient({
|
|
15582
|
+
appId: hrSoulAppManifest2.id,
|
|
15583
|
+
baseUrl: context.hostUrl,
|
|
15584
|
+
mountToken: context.mountToken
|
|
15585
|
+
});
|
|
15574
15586
|
try {
|
|
15575
15587
|
await client.broker.storage.put(draftKey, {
|
|
15576
15588
|
appId: hrSoulAppManifest2.id,
|
|
@@ -15628,7 +15640,11 @@ async function queryBrokerPeopleProfileSearch(request, query) {
|
|
|
15628
15640
|
const context = readMountContext(request);
|
|
15629
15641
|
if (!context?.hostUrl)
|
|
15630
15642
|
return null;
|
|
15631
|
-
const client = createSoulAppClient({
|
|
15643
|
+
const client = createSoulAppClient({
|
|
15644
|
+
appId: hrSoulAppManifest2.id,
|
|
15645
|
+
baseUrl: context.hostUrl,
|
|
15646
|
+
mountToken: context.mountToken
|
|
15647
|
+
});
|
|
15632
15648
|
try {
|
|
15633
15649
|
const result = await client.broker.search.query(query, brokerScope(context));
|
|
15634
15650
|
return Array.isArray(result.items) ? result.items : null;
|
|
@@ -15648,6 +15664,7 @@ function readMountContext(request) {
|
|
|
15648
15664
|
return {
|
|
15649
15665
|
brokerUrl: typeof parsed.brokerUrl === "string" ? parsed.brokerUrl : undefined,
|
|
15650
15666
|
hostUrl: request.headers.get("x-aiworker-host-url") ?? undefined,
|
|
15667
|
+
mountToken: request.headers.get("x-aiworker-mount-token") ?? undefined,
|
|
15651
15668
|
operatorId: typeof parsed.operatorId === "string" ? parsed.operatorId : null,
|
|
15652
15669
|
sessionId: typeof parsed.sessionId === "string" ? parsed.sessionId : null,
|
|
15653
15670
|
surface: surface ? {
|
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: candidate-profile
|
|
3
|
+
description: Build and update a source-backed Candidate People Profile for hiring review.
|
|
4
|
+
capabilities:
|
|
5
|
+
- hr-profile
|
|
6
|
+
- recruiting
|
|
7
|
+
- evidence-review
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Candidate Profile
|
|
11
|
+
|
|
12
|
+
Use this skill when the workspace profile represents a candidate or candidate
|
|
13
|
+
pool member.
|
|
14
|
+
|
|
15
|
+
## Profile Contract
|
|
16
|
+
|
|
17
|
+
- Treat `README.md` as the accepted Candidate Profile.
|
|
18
|
+
- Treat files under `artifacts/` as proposed profile changes until review.
|
|
19
|
+
- Keep confirmed facts, missing evidence, weak signals, and next HR actions
|
|
20
|
+
separate.
|
|
21
|
+
- Do not infer protected-class attributes, personal judgments, or employment
|
|
22
|
+
commitments.
|
|
23
|
+
|
|
24
|
+
## Output Shape
|
|
25
|
+
|
|
26
|
+
For proposed updates, write a markdown artifact with:
|
|
27
|
+
|
|
28
|
+
1. Current candidate summary
|
|
29
|
+
2. Role-relevant evidence
|
|
30
|
+
3. Missing or conflicting evidence
|
|
31
|
+
4. Hiring risks and compliance notes
|
|
32
|
+
5. Human reviewer next actions
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evidence-screening
|
|
3
|
+
description: Screen HR evidence for source quality, role relevance, missing facts, and risk.
|
|
4
|
+
capabilities:
|
|
5
|
+
- hr-evidence
|
|
6
|
+
- candidate-screen
|
|
7
|
+
- risk-review
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Evidence Screening
|
|
11
|
+
|
|
12
|
+
Use this skill to evaluate resumes, ATS packets, interview notes, employee
|
|
13
|
+
records, or lifecycle touchpoints before they influence a People Profile.
|
|
14
|
+
|
|
15
|
+
## Screening Standard
|
|
16
|
+
|
|
17
|
+
- Tie every positive or negative signal to source evidence.
|
|
18
|
+
- Mark weak, stale, missing, or conflicting evidence explicitly.
|
|
19
|
+
- Separate role-related criteria from unsupported personal judgments.
|
|
20
|
+
- Keep raw sensitive evidence out of durable profile history unless reviewed.
|
|
21
|
+
- Prefer descriptor references over copying private evidence bodies.
|
|
22
|
+
|
|
23
|
+
## Output Shape
|
|
24
|
+
|
|
25
|
+
Create an evidence matrix with:
|
|
26
|
+
|
|
27
|
+
1. Evidence source
|
|
28
|
+
2. Role or lifecycle relevance
|
|
29
|
+
3. Confidence
|
|
30
|
+
4. Missing information
|
|
31
|
+
5. Risk note
|
|
32
|
+
6. Recommended human follow-up
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hiring-risk-review
|
|
3
|
+
description: Review HR profile proposals for compliance, privacy, bias, and unsupported claims.
|
|
4
|
+
capabilities:
|
|
5
|
+
- hiring-risk
|
|
6
|
+
- compliance-review
|
|
7
|
+
- privacy-review
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Hiring Risk Review
|
|
11
|
+
|
|
12
|
+
Use this skill before a proposed HR artifact is promoted into the accepted
|
|
13
|
+
People Profile.
|
|
14
|
+
|
|
15
|
+
## Risk Review Rules
|
|
16
|
+
|
|
17
|
+
- Flag protected-class inference, proxy signals, and unsupported personal
|
|
18
|
+
judgments.
|
|
19
|
+
- Flag copied sensitive evidence that should stay behind a descriptor or source
|
|
20
|
+
reference.
|
|
21
|
+
- Flag employment commitments, compensation claims, or hiring decisions that are
|
|
22
|
+
not explicitly human-approved.
|
|
23
|
+
- Separate blocking risks from advisory improvements.
|
|
24
|
+
|
|
25
|
+
## Output Shape
|
|
26
|
+
|
|
27
|
+
Return:
|
|
28
|
+
|
|
29
|
+
1. Verdict recommendation: pass, warn, fail, or needs_review
|
|
30
|
+
2. Blocking findings
|
|
31
|
+
3. Advisory findings
|
|
32
|
+
4. Privacy and evidence retention notes
|
|
33
|
+
5. Required human decision before profile promotion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: interview-brief
|
|
3
|
+
description: Draft evidence-backed interview briefs, focus areas, and scorecard guidance.
|
|
4
|
+
capabilities:
|
|
5
|
+
- interview-planning
|
|
6
|
+
- recruiting
|
|
7
|
+
- scorecard
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Interview Brief
|
|
11
|
+
|
|
12
|
+
Use this skill when preparing an interview plan from a Candidate Profile or
|
|
13
|
+
candidate evidence packet.
|
|
14
|
+
|
|
15
|
+
## Interview Guidance
|
|
16
|
+
|
|
17
|
+
- Use role-relevant evidence and open questions from the profile.
|
|
18
|
+
- Turn weak or missing evidence into interview focus areas.
|
|
19
|
+
- Avoid protected-class inference and unsupported personal conclusions.
|
|
20
|
+
- Keep the final hiring decision explicitly human-owned.
|
|
21
|
+
|
|
22
|
+
## Output Shape
|
|
23
|
+
|
|
24
|
+
Draft:
|
|
25
|
+
|
|
26
|
+
1. Interview objective
|
|
27
|
+
2. Evidence-backed focus areas
|
|
28
|
+
3. Questions mapped to role criteria
|
|
29
|
+
4. Scorecard guidance
|
|
30
|
+
5. Risks or missing evidence to verify
|
|
31
|
+
6. Reviewer notes for the human panel
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: profile-update-proposal
|
|
3
|
+
description: Convert HR session evidence into a reviewable profile update proposal.
|
|
4
|
+
capabilities:
|
|
5
|
+
- hr-profile
|
|
6
|
+
- artifact-proposal
|
|
7
|
+
- review-prep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Profile Update Proposal
|
|
11
|
+
|
|
12
|
+
Use this skill when a session should produce a proposed change for the accepted
|
|
13
|
+
People Profile.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- Read `README.md` first to understand the accepted profile baseline.
|
|
18
|
+
- Write proposed changes under `artifacts/<sessionId>/`.
|
|
19
|
+
- Do not update `README.md` directly unless the operator explicitly asks for a
|
|
20
|
+
reviewed profile revision workflow.
|
|
21
|
+
- Preserve source references, open questions, and human decision ownership.
|
|
22
|
+
|
|
23
|
+
## Proposal Checklist
|
|
24
|
+
|
|
25
|
+
- What changed since the accepted profile?
|
|
26
|
+
- Which claims are backed by explicit evidence?
|
|
27
|
+
- Which facts are still missing?
|
|
28
|
+
- Which risks need HR or legal review?
|
|
29
|
+
- What exact review decision is needed before promotion?
|
|
@@ -8,6 +8,7 @@ import { hrReferenceSoulApp, hrSoulAppManifest } from './index'
|
|
|
8
8
|
interface MountContext {
|
|
9
9
|
brokerUrl?: string
|
|
10
10
|
hostUrl?: string
|
|
11
|
+
mountToken?: string
|
|
11
12
|
operatorId?: string | null
|
|
12
13
|
sessionId?: string | null
|
|
13
14
|
surface?: {
|
|
@@ -64,7 +65,11 @@ export function serveHostMounted(port = Number(Bun.env.PORT ?? 0)) {
|
|
|
64
65
|
const hostUrl = request.headers.get('x-aiworker-host-url') ?? Bun.env.AIWORKER_HOST_URL
|
|
65
66
|
if (!hostUrl)
|
|
66
67
|
return Response.json({ appId: hrSoulAppManifest.id, broker: 'not-configured', permissions: [] })
|
|
67
|
-
const client = createSoulAppClient({
|
|
68
|
+
const client = createSoulAppClient({
|
|
69
|
+
appId: hrSoulAppManifest.id,
|
|
70
|
+
baseUrl: hostUrl,
|
|
71
|
+
mountToken: request.headers.get('x-aiworker-mount-token') ?? undefined,
|
|
72
|
+
})
|
|
68
73
|
return Response.json(await client.broker.permissions.list())
|
|
69
74
|
}
|
|
70
75
|
if (url.pathname === '/protocol/capabilities') {
|
|
@@ -192,7 +197,11 @@ async function persistPeopleProfileDraft(request: Request): Promise<{ message: s
|
|
|
192
197
|
|
|
193
198
|
const draftKey = `drafts/people-profile/${context.workspaceId ?? 'app'}`
|
|
194
199
|
const workspaceRef = context.workspaceId ?? 'app'
|
|
195
|
-
const client = createSoulAppClient({
|
|
200
|
+
const client = createSoulAppClient({
|
|
201
|
+
appId: hrSoulAppManifest.id,
|
|
202
|
+
baseUrl: context.hostUrl,
|
|
203
|
+
mountToken: context.mountToken,
|
|
204
|
+
})
|
|
196
205
|
try {
|
|
197
206
|
await client.broker.storage.put(draftKey, {
|
|
198
207
|
appId: hrSoulAppManifest.id,
|
|
@@ -255,7 +264,11 @@ async function queryBrokerPeopleProfileSearch(request: Request, query: string):
|
|
|
255
264
|
if (!context?.hostUrl)
|
|
256
265
|
return null
|
|
257
266
|
|
|
258
|
-
const client = createSoulAppClient({
|
|
267
|
+
const client = createSoulAppClient({
|
|
268
|
+
appId: hrSoulAppManifest.id,
|
|
269
|
+
baseUrl: context.hostUrl,
|
|
270
|
+
mountToken: context.mountToken,
|
|
271
|
+
})
|
|
259
272
|
try {
|
|
260
273
|
const result = await client.broker.search.query(query, brokerScope(context)) as BrokerSearchResult
|
|
261
274
|
return Array.isArray(result.items) ? result.items : null
|
|
@@ -277,6 +290,7 @@ function readMountContext(request: Request): MountContext | null {
|
|
|
277
290
|
return {
|
|
278
291
|
brokerUrl: typeof parsed.brokerUrl === 'string' ? parsed.brokerUrl : undefined,
|
|
279
292
|
hostUrl: request.headers.get('x-aiworker-host-url') ?? undefined,
|
|
293
|
+
mountToken: request.headers.get('x-aiworker-mount-token') ?? undefined,
|
|
280
294
|
operatorId: typeof parsed.operatorId === 'string' ? parsed.operatorId : null,
|
|
281
295
|
sessionId: typeof parsed.sessionId === 'string' ? parsed.sessionId : null,
|
|
282
296
|
surface: surface
|
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -15434,7 +15438,11 @@ function serveHostMounted(port = Number(Bun.env.PORT ?? 0)) {
|
|
|
15434
15438
|
const hostUrl = request.headers.get("x-aiworker-host-url") ?? Bun.env.AIWORKER_HOST_URL;
|
|
15435
15439
|
if (!hostUrl)
|
|
15436
15440
|
return Response.json({ appId: qaSoulAppManifest2.id, broker: "not-configured", permissions: [] });
|
|
15437
|
-
const client = createSoulAppClient({
|
|
15441
|
+
const client = createSoulAppClient({
|
|
15442
|
+
appId: qaSoulAppManifest2.id,
|
|
15443
|
+
baseUrl: hostUrl,
|
|
15444
|
+
mountToken: request.headers.get("x-aiworker-mount-token") ?? undefined
|
|
15445
|
+
});
|
|
15438
15446
|
return Response.json(await client.broker.permissions.list());
|
|
15439
15447
|
}
|
|
15440
15448
|
if (url.pathname === "/protocol/capabilities") {
|
|
@@ -15548,7 +15556,11 @@ async function persistReleaseGateDraft(request) {
|
|
|
15548
15556
|
return { ok: true };
|
|
15549
15557
|
const draftKey = `drafts/release-gate/${context.workspaceId ?? "app"}`;
|
|
15550
15558
|
const workspaceRef = context.workspaceId ?? "app";
|
|
15551
|
-
const client = createSoulAppClient({
|
|
15559
|
+
const client = createSoulAppClient({
|
|
15560
|
+
appId: qaSoulAppManifest2.id,
|
|
15561
|
+
baseUrl: context.hostUrl,
|
|
15562
|
+
mountToken: context.mountToken
|
|
15563
|
+
});
|
|
15552
15564
|
try {
|
|
15553
15565
|
await client.broker.storage.put(draftKey, {
|
|
15554
15566
|
appId: qaSoulAppManifest2.id,
|
|
@@ -15606,7 +15618,11 @@ async function queryBrokerReleaseSearch(request, query) {
|
|
|
15606
15618
|
const context = readMountContext(request);
|
|
15607
15619
|
if (!context?.hostUrl)
|
|
15608
15620
|
return null;
|
|
15609
|
-
const client = createSoulAppClient({
|
|
15621
|
+
const client = createSoulAppClient({
|
|
15622
|
+
appId: qaSoulAppManifest2.id,
|
|
15623
|
+
baseUrl: context.hostUrl,
|
|
15624
|
+
mountToken: context.mountToken
|
|
15625
|
+
});
|
|
15610
15626
|
try {
|
|
15611
15627
|
const result = await client.broker.search.query(query, brokerScope(context));
|
|
15612
15628
|
return Array.isArray(result.items) ? result.items : null;
|
|
@@ -15626,6 +15642,7 @@ function readMountContext(request) {
|
|
|
15626
15642
|
return {
|
|
15627
15643
|
brokerUrl: typeof parsed.brokerUrl === "string" ? parsed.brokerUrl : undefined,
|
|
15628
15644
|
hostUrl: request.headers.get("x-aiworker-host-url") ?? undefined,
|
|
15645
|
+
mountToken: request.headers.get("x-aiworker-mount-token") ?? undefined,
|
|
15629
15646
|
operatorId: typeof parsed.operatorId === "string" ? parsed.operatorId : null,
|
|
15630
15647
|
sessionId: typeof parsed.sessionId === "string" ? parsed.sessionId : null,
|
|
15631
15648
|
surface: surface ? {
|
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -14791,13 +14791,17 @@ function createSoulAppManifest(input, options = {}) {
|
|
|
14791
14791
|
function createSoulAppClient(options) {
|
|
14792
14792
|
const fetcher = options.fetch ?? fetch;
|
|
14793
14793
|
const prefix = options.baseUrl?.replace(/\/$/, "") ?? "";
|
|
14794
|
-
const headers =
|
|
14794
|
+
const headers = {};
|
|
14795
|
+
if (options.token)
|
|
14796
|
+
headers.authorization = `Bearer ${options.token}`;
|
|
14797
|
+
if (options.mountToken)
|
|
14798
|
+
headers["x-aiworker-mount-token"] = options.mountToken;
|
|
14795
14799
|
async function json(route, init) {
|
|
14796
14800
|
const res = await fetcher(`${prefix}${route}`, {
|
|
14797
14801
|
...init,
|
|
14798
14802
|
headers: {
|
|
14799
14803
|
...init?.body ? { "content-type": "application/json" } : {},
|
|
14800
|
-
...headers,
|
|
14804
|
+
...Object.keys(headers).length ? headers : {},
|
|
14801
14805
|
...init?.headers
|
|
14802
14806
|
}
|
|
14803
14807
|
});
|
|
@@ -8,6 +8,7 @@ import { qaReferenceSoulApp, qaSoulAppManifest } from './index'
|
|
|
8
8
|
interface MountContext {
|
|
9
9
|
brokerUrl?: string
|
|
10
10
|
hostUrl?: string
|
|
11
|
+
mountToken?: string
|
|
11
12
|
operatorId?: string | null
|
|
12
13
|
sessionId?: string | null
|
|
13
14
|
surface?: {
|
|
@@ -64,7 +65,11 @@ export function serveHostMounted(port = Number(Bun.env.PORT ?? 0)) {
|
|
|
64
65
|
const hostUrl = request.headers.get('x-aiworker-host-url') ?? Bun.env.AIWORKER_HOST_URL
|
|
65
66
|
if (!hostUrl)
|
|
66
67
|
return Response.json({ appId: qaSoulAppManifest.id, broker: 'not-configured', permissions: [] })
|
|
67
|
-
const client = createSoulAppClient({
|
|
68
|
+
const client = createSoulAppClient({
|
|
69
|
+
appId: qaSoulAppManifest.id,
|
|
70
|
+
baseUrl: hostUrl,
|
|
71
|
+
mountToken: request.headers.get('x-aiworker-mount-token') ?? undefined,
|
|
72
|
+
})
|
|
68
73
|
return Response.json(await client.broker.permissions.list())
|
|
69
74
|
}
|
|
70
75
|
if (url.pathname === '/protocol/capabilities') {
|
|
@@ -186,7 +191,11 @@ async function persistReleaseGateDraft(request: Request): Promise<{ message: str
|
|
|
186
191
|
|
|
187
192
|
const draftKey = `drafts/release-gate/${context.workspaceId ?? 'app'}`
|
|
188
193
|
const workspaceRef = context.workspaceId ?? 'app'
|
|
189
|
-
const client = createSoulAppClient({
|
|
194
|
+
const client = createSoulAppClient({
|
|
195
|
+
appId: qaSoulAppManifest.id,
|
|
196
|
+
baseUrl: context.hostUrl,
|
|
197
|
+
mountToken: context.mountToken,
|
|
198
|
+
})
|
|
190
199
|
try {
|
|
191
200
|
await client.broker.storage.put(draftKey, {
|
|
192
201
|
appId: qaSoulAppManifest.id,
|
|
@@ -249,7 +258,11 @@ async function queryBrokerReleaseSearch(request: Request, query: string): Promis
|
|
|
249
258
|
if (!context?.hostUrl)
|
|
250
259
|
return null
|
|
251
260
|
|
|
252
|
-
const client = createSoulAppClient({
|
|
261
|
+
const client = createSoulAppClient({
|
|
262
|
+
appId: qaSoulAppManifest.id,
|
|
263
|
+
baseUrl: context.hostUrl,
|
|
264
|
+
mountToken: context.mountToken,
|
|
265
|
+
})
|
|
253
266
|
try {
|
|
254
267
|
const result = await client.broker.search.query(query, brokerScope(context)) as BrokerSearchResult
|
|
255
268
|
return Array.isArray(result.items) ? result.items : null
|
|
@@ -271,6 +284,7 @@ function readMountContext(request: Request): MountContext | null {
|
|
|
271
284
|
return {
|
|
272
285
|
brokerUrl: typeof parsed.brokerUrl === 'string' ? parsed.brokerUrl : undefined,
|
|
273
286
|
hostUrl: request.headers.get('x-aiworker-host-url') ?? undefined,
|
|
287
|
+
mountToken: request.headers.get('x-aiworker-mount-token') ?? undefined,
|
|
274
288
|
operatorId: typeof parsed.operatorId === 'string' ? parsed.operatorId : null,
|
|
275
289
|
sessionId: typeof parsed.sessionId === 'string' ? parsed.sessionId : null,
|
|
276
290
|
surface: surface
|