@aui.io/apollo 0.1.32 → 0.1.34
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 +2 -2
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js +3 -4
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +185 -39
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js +6 -3
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +170 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +52 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +52 -32
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +35 -26
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.d.ts +28 -16
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.js +17 -17
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.d.ts +12 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js +69 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +4 -10
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +18 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.js +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +8 -5
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +6 -3
- package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/advisor.d.ts +37 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/advisor.js +86 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/advisor.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.d.ts +37 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.js +52 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +36 -30
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +81 -29
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.d.ts +3 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +10 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.d.ts +7 -2
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js +4 -4
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.d.ts +5 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.js +7 -2
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.d.ts +11 -4
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.js +28 -10
- package/node_modules/@aui.io/apollo-core/dist/src/skills/agents-page.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/skills/install.d.ts +24 -2
- package/node_modules/@aui.io/apollo-core/dist/src/skills/install.js +53 -4
- package/node_modules/@aui.io/apollo-core/dist/src/skills/install.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/data.d.ts +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +3 -5
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +4 -4
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { HttpClient } from "./client-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* builder-api's headless authoring verbs (docs/headless-authoring-design.md):
|
|
4
|
+
* stateless gate runs over a tree shipped inline — no session, no rows, the
|
|
5
|
+
* response is the whole product. The gates here run on the SERVICE's engine
|
|
6
|
+
* (the builder's own wheel), not the checkout's runtime pin: they are the
|
|
7
|
+
* builder's opinion of the tree, the same one a `/build` turn would hold.
|
|
8
|
+
*/
|
|
9
|
+
/** Certification replays the whole suite offline — slow by design, like a
|
|
10
|
+
* message send (REPORTS-27). A floor, not a ceiling: `--timeout` still wins. */
|
|
11
|
+
export declare const CERTIFY_TIMEOUT_MS = 300000;
|
|
12
|
+
/**
|
|
13
|
+
* `{path: content}` for the whole checkout — `src/**` the program,
|
|
14
|
+
* `build/**` the proof material. Text rides plain; binary rides `{b64}`.
|
|
15
|
+
*/
|
|
16
|
+
export type BuilderTree = Record<string, string | {
|
|
17
|
+
b64: string;
|
|
18
|
+
}>;
|
|
19
|
+
export interface BuilderFinding {
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
/** `runtime.compile.orphans` census, verbatim. Only the fields the console
|
|
24
|
+
* renders are named; a tree that failed to parse has `parse_errors` and no
|
|
25
|
+
* `rows`. */
|
|
26
|
+
export interface OrphanCensus {
|
|
27
|
+
rows?: Record<string, {
|
|
28
|
+
declared: number;
|
|
29
|
+
consumed: number;
|
|
30
|
+
excluded: string[];
|
|
31
|
+
orphans: string[];
|
|
32
|
+
}>;
|
|
33
|
+
distinct_orphans?: string[];
|
|
34
|
+
parse_errors?: unknown[];
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
/** `runtime.compile.era_census` census, verbatim. */
|
|
38
|
+
export interface EraCensus {
|
|
39
|
+
resolved?: string | null;
|
|
40
|
+
offenders?: {
|
|
41
|
+
value?: string | null;
|
|
42
|
+
refusal?: string;
|
|
43
|
+
}[];
|
|
44
|
+
unfenceable?: {
|
|
45
|
+
value?: string | null;
|
|
46
|
+
refusal?: string;
|
|
47
|
+
}[];
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
export interface BuilderValidation {
|
|
51
|
+
valid: boolean;
|
|
52
|
+
errors: BuilderFinding[];
|
|
53
|
+
warnings: BuilderFinding[];
|
|
54
|
+
/** id / version / config_fingerprint — `{}` when the tree does not load. */
|
|
55
|
+
program: {
|
|
56
|
+
id?: string;
|
|
57
|
+
version?: string;
|
|
58
|
+
config_fingerprint?: string;
|
|
59
|
+
};
|
|
60
|
+
orphans: OrphanCensus;
|
|
61
|
+
era_census: EraCensus;
|
|
62
|
+
}
|
|
63
|
+
export interface ScenarioFailure {
|
|
64
|
+
name: string;
|
|
65
|
+
reasons: string[];
|
|
66
|
+
}
|
|
67
|
+
/** The eval runner's verdict in its own vocabulary. A refusal (misplaced
|
|
68
|
+
* suite, red validation, no suite) is a failed report whose `program_errors`
|
|
69
|
+
* say why — the shape never changes on the caller. */
|
|
70
|
+
export interface BuilderCertification {
|
|
71
|
+
passed: boolean;
|
|
72
|
+
total: number;
|
|
73
|
+
passed_count: number;
|
|
74
|
+
failures: ScenarioFailure[];
|
|
75
|
+
program_errors: string[];
|
|
76
|
+
uncovered: Record<string, string[]>;
|
|
77
|
+
routing: Record<string, unknown>;
|
|
78
|
+
surface: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
/** One question for the advisor over one tree. `files` rides EVERY call —
|
|
81
|
+
* follow-ups included — so the advisor sees the current checkout, never a
|
|
82
|
+
* stale pin; `advisor_session_id` (from a prior answer) keeps the thread. */
|
|
83
|
+
export interface AdvisorAsk {
|
|
84
|
+
instruction: string;
|
|
85
|
+
files: BuilderTree;
|
|
86
|
+
/** Extra material for the advisor's workspace (base64; archives extract). */
|
|
87
|
+
uploads?: {
|
|
88
|
+
name: string;
|
|
89
|
+
data: string;
|
|
90
|
+
}[];
|
|
91
|
+
model?: string;
|
|
92
|
+
max_usd?: number;
|
|
93
|
+
advisor_session_id?: string;
|
|
94
|
+
}
|
|
95
|
+
/** The 202 — the thread to keep and the turn to poll. */
|
|
96
|
+
export interface AdvisorStarted {
|
|
97
|
+
advisor_session_id: string;
|
|
98
|
+
turn_id: string;
|
|
99
|
+
}
|
|
100
|
+
/** The poll view. `answer` and `usage` stay null while the turn runs; an
|
|
101
|
+
* advisor turn settles as `answered` (a failed turn's answer is the failure
|
|
102
|
+
* story). */
|
|
103
|
+
export interface AdvisorView {
|
|
104
|
+
advisor_session_id: string;
|
|
105
|
+
turn_id: string;
|
|
106
|
+
status: string;
|
|
107
|
+
answer: string | null;
|
|
108
|
+
usage: Record<string, unknown> | null;
|
|
109
|
+
}
|
|
110
|
+
/** One build over one pushed agent. No files ride in — the service pulls
|
|
111
|
+
* the agent's bundle itself; `version_tag` names the base (absent: the
|
|
112
|
+
* agent's current pin). */
|
|
113
|
+
export interface BuildRequest {
|
|
114
|
+
agent_id: string;
|
|
115
|
+
instruction: string;
|
|
116
|
+
version_tag?: string;
|
|
117
|
+
/** The push message — lands on the draft revision like a commit line. */
|
|
118
|
+
message?: string;
|
|
119
|
+
model?: string;
|
|
120
|
+
/** Run the evaluation suite on the settled tree before approving. */
|
|
121
|
+
evaluate?: boolean;
|
|
122
|
+
/** Flip the agent's active pointer to the pushed revision. */
|
|
123
|
+
publish?: boolean;
|
|
124
|
+
max_usd?: number;
|
|
125
|
+
}
|
|
126
|
+
/** The 202 — `build_id` doubles as the session id, so every session surface
|
|
127
|
+
* (diff, events, artifacts) works on it while the build runs and after. */
|
|
128
|
+
export interface BuildStarted {
|
|
129
|
+
build_id: string;
|
|
130
|
+
session_id: string;
|
|
131
|
+
turn_id: string;
|
|
132
|
+
}
|
|
133
|
+
/** The poll view. `status` is the BUILD's verdict — `running` until the
|
|
134
|
+
* driver settles it as `completed` (pushed), `refused` (a gate said no) or
|
|
135
|
+
* `failed` (infra story in `error`); the step payloads fill in as they land. */
|
|
136
|
+
export interface BuildView {
|
|
137
|
+
build_id: string;
|
|
138
|
+
session_id: string;
|
|
139
|
+
turn_id: string;
|
|
140
|
+
status: string;
|
|
141
|
+
phase: string;
|
|
142
|
+
turn_status: string | null;
|
|
143
|
+
answer: string | null;
|
|
144
|
+
findings: BuilderFinding[] | null;
|
|
145
|
+
certification: BuilderCertification | null;
|
|
146
|
+
evaluation: {
|
|
147
|
+
evaluation_id: string;
|
|
148
|
+
status: string;
|
|
149
|
+
verdict?: string | null;
|
|
150
|
+
pass_scenarios?: number | null;
|
|
151
|
+
total_scenarios?: number | null;
|
|
152
|
+
} | null;
|
|
153
|
+
version_tag: string | null;
|
|
154
|
+
revision_id: string | null;
|
|
155
|
+
published: Record<string, unknown> | null;
|
|
156
|
+
error: string | null;
|
|
157
|
+
}
|
|
158
|
+
export declare class BuilderApiClient {
|
|
159
|
+
private readonly http;
|
|
160
|
+
constructor(http: HttpClient);
|
|
161
|
+
validateTree(files: BuilderTree): Promise<BuilderValidation>;
|
|
162
|
+
certifyTree(files: BuilderTree, scenarios?: Record<string, unknown>[]): Promise<BuilderCertification>;
|
|
163
|
+
/** Enqueue one advisor turn (202 immediately — the answer comes by poll). */
|
|
164
|
+
advise(ask: AdvisorAsk): Promise<AdvisorStarted>;
|
|
165
|
+
adviceView(turnId: string): Promise<AdvisorView>;
|
|
166
|
+
/** Enqueue one build (202 immediately — the verdict comes by poll). The
|
|
167
|
+
* idempotency key makes a network retry the SAME build, not a second one. */
|
|
168
|
+
startBuild(build: BuildRequest, idempotencyKey: string): Promise<BuildStarted>;
|
|
169
|
+
buildView(buildId: string): Promise<BuildView>;
|
|
170
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* builder-api's headless authoring verbs (docs/headless-authoring-design.md):
|
|
3
|
+
* stateless gate runs over a tree shipped inline — no session, no rows, the
|
|
4
|
+
* response is the whole product. The gates here run on the SERVICE's engine
|
|
5
|
+
* (the builder's own wheel), not the checkout's runtime pin: they are the
|
|
6
|
+
* builder's opinion of the tree, the same one a `/build` turn would hold.
|
|
7
|
+
*/
|
|
8
|
+
/** Certification replays the whole suite offline — slow by design, like a
|
|
9
|
+
* message send (REPORTS-27). A floor, not a ceiling: `--timeout` still wins. */
|
|
10
|
+
export const CERTIFY_TIMEOUT_MS = 300_000;
|
|
11
|
+
export class BuilderApiClient {
|
|
12
|
+
http;
|
|
13
|
+
constructor(http) {
|
|
14
|
+
this.http = http;
|
|
15
|
+
}
|
|
16
|
+
validateTree(files) {
|
|
17
|
+
return this.http.request("/v1/builder/validate", {
|
|
18
|
+
method: "POST",
|
|
19
|
+
body: { files },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
certifyTree(files, scenarios) {
|
|
23
|
+
return this.http.request("/v1/builder/certify", {
|
|
24
|
+
method: "POST",
|
|
25
|
+
body: { files, ...(scenarios ? { scenarios } : {}) },
|
|
26
|
+
timeoutMs: CERTIFY_TIMEOUT_MS,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Enqueue one advisor turn (202 immediately — the answer comes by poll). */
|
|
30
|
+
advise(ask) {
|
|
31
|
+
return this.http.request("/v1/builder/advisor", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: ask,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
adviceView(turnId) {
|
|
37
|
+
return this.http.request(`/v1/builder/advisor/${turnId}`);
|
|
38
|
+
}
|
|
39
|
+
/** Enqueue one build (202 immediately — the verdict comes by poll). The
|
|
40
|
+
* idempotency key makes a network retry the SAME build, not a second one. */
|
|
41
|
+
startBuild(build, idempotencyKey) {
|
|
42
|
+
return this.http.request("/v1/builder/build", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: build,
|
|
45
|
+
headers: { "Idempotency-Key": idempotencyKey },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
buildView(buildId) {
|
|
49
|
+
return this.http.request(`/v1/builder/build/${buildId}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=builder-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-api.js","sourceRoot":"","sources":["../../../src/api/builder-api.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;iFACiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAgJ1C,MAAM,OAAO,gBAAgB;IACS;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,YAAY,CAAC,KAAkB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE;YAC/C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,KAAK,EAAE;SAChB,CAAC,CAAC;IACL,CAAC;IAEM,WAAW,CAChB,KAAkB,EAClB,SAAqC;QAErC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;YACpD,SAAS,EAAE,kBAAkB;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,6EAA6E;IACtE,MAAM,CAAC,GAAe;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG;SACV,CAAC,CAAC;IACL,CAAC;IAEM,UAAU,CAAC,MAAc;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;kFAC8E;IACvE,UAAU,CAAC,KAAmB,EAAE,cAAsB;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IAEM,SAAS,CAAC,OAAe;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -41,8 +41,7 @@ export interface Thread {
|
|
|
41
41
|
id: string;
|
|
42
42
|
title?: string | null;
|
|
43
43
|
agent?: AgentOverride;
|
|
44
|
-
|
|
45
|
-
turns?: number | null;
|
|
44
|
+
created_by: string;
|
|
46
45
|
created_at: string;
|
|
47
46
|
updated_at: string;
|
|
48
47
|
[key: string]: unknown;
|
|
@@ -59,6 +58,13 @@ export interface SkillFile {
|
|
|
59
58
|
}
|
|
60
59
|
export interface AgentsMd {
|
|
61
60
|
content: string;
|
|
61
|
+
/**
|
|
62
|
+
* Which page this is — echoed by engines that ship per-audience pages.
|
|
63
|
+
* Absent on older engines, which ignore the query and always serve the
|
|
64
|
+
* authoring page; a headless caller MUST check this before trusting the
|
|
65
|
+
* content.
|
|
66
|
+
*/
|
|
67
|
+
audience?: string;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
64
70
|
* A send is synchronous on the wire — the response IS the agent's turn, and
|
|
@@ -82,19 +88,24 @@ export declare class RuntimeApiClient {
|
|
|
82
88
|
environment: string;
|
|
83
89
|
}): Promise<Thread>;
|
|
84
90
|
getThread(threadId: string): Promise<Thread>;
|
|
85
|
-
listThreads(userId: string,
|
|
91
|
+
listThreads(userId: string, options?: {
|
|
92
|
+
size?: number;
|
|
93
|
+
after?: string;
|
|
94
|
+
before?: string;
|
|
95
|
+
}): Promise<Thread[]>;
|
|
86
96
|
/**
|
|
87
97
|
* Threads bound to an agent, newest first — the listing the runtime intends
|
|
88
98
|
* UIs to use (the per-user route above stays for tooling). Filters compose:
|
|
89
|
-
* owner, version tag, creation window.
|
|
99
|
+
* owner, version tag, creation window. Keyset: `after`/`before` + `size`.
|
|
90
100
|
*/
|
|
91
101
|
listAgentThreads(agentId: string, filters?: {
|
|
92
102
|
userId?: string;
|
|
93
103
|
versionTag?: string;
|
|
94
104
|
startTime?: string;
|
|
95
105
|
endTime?: string;
|
|
96
|
-
page?: number;
|
|
97
106
|
size?: number;
|
|
107
|
+
after?: string;
|
|
108
|
+
before?: string;
|
|
98
109
|
}): Promise<Thread[]>;
|
|
99
110
|
listMessages(threadId: string): Promise<Message[]>;
|
|
100
111
|
threadTrace(threadId: string): Promise<RuntimeTrace[]>;
|
|
@@ -103,13 +114,15 @@ export declare class RuntimeApiClient {
|
|
|
103
114
|
listSkills(): Promise<SkillIndexItem[]>;
|
|
104
115
|
getSkill(skillId: string, file?: string): Promise<SkillFile>;
|
|
105
116
|
/**
|
|
106
|
-
* The checkout's
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* older than the endpoint
|
|
117
|
+
* The checkout's standing page — the engine's own lifecycle page by
|
|
118
|
+
* default (the same bytes the builder appends after its instructions), or
|
|
119
|
+
* the self-contained headless brief for `audience: "headless"`. Not a
|
|
120
|
+
* skill: it belongs at the checkout root, so it has its own endpoint
|
|
121
|
+
* rather than a slot in the skills index. Engines older than the endpoint
|
|
122
|
+
* answer 404; engines older than the headless page ignore the query — see
|
|
123
|
+
* `AgentsMd.audience`.
|
|
111
124
|
*/
|
|
112
|
-
getAgentsMd(): Promise<AgentsMd>;
|
|
125
|
+
getAgentsMd(audience?: "headless"): Promise<AgentsMd>;
|
|
113
126
|
getProgramSchemas(file?: string): Promise<Record<string, unknown>>;
|
|
114
127
|
validateProgram(bundle: Record<string, unknown>): Promise<{
|
|
115
128
|
valid: boolean;
|
|
@@ -125,32 +138,39 @@ export declare class RuntimeApiClient {
|
|
|
125
138
|
id?: string;
|
|
126
139
|
version?: string;
|
|
127
140
|
};
|
|
141
|
+
runtime_version?: string;
|
|
142
|
+
reports?: Record<string, unknown>;
|
|
128
143
|
}>;
|
|
129
|
-
/** The
|
|
130
|
-
*
|
|
131
|
-
certifyProgram(bundle: Record<string, unknown>): Promise<{
|
|
132
|
-
ran: boolean;
|
|
133
|
-
passed: number;
|
|
134
|
-
total: number;
|
|
135
|
-
report: string;
|
|
136
|
-
failures: string[];
|
|
137
|
-
errors: {
|
|
138
|
-
code: string;
|
|
139
|
-
message: string;
|
|
140
|
-
}[];
|
|
141
|
-
}>;
|
|
142
|
-
/** The demand-ledger audit: declared vs served vs dark needs. A report, never
|
|
143
|
-
* a push gate. */
|
|
144
|
+
/** The demand-ledger audit: what callers ask, and what this bundle does about
|
|
145
|
+
* it. An unserved need is the RESULT, never a 4xx — same posture as validate. */
|
|
144
146
|
needsProgram(bundle: Record<string, unknown>): Promise<{
|
|
145
147
|
measured: boolean;
|
|
146
|
-
declared
|
|
147
|
-
served
|
|
148
|
-
dark
|
|
148
|
+
declared?: number;
|
|
149
|
+
served?: number;
|
|
150
|
+
dark?: number;
|
|
149
151
|
served_ratio?: number | null;
|
|
150
152
|
dark_number?: number | null;
|
|
151
|
-
report
|
|
152
|
-
refused
|
|
153
|
-
errors
|
|
153
|
+
report?: string;
|
|
154
|
+
refused?: string[];
|
|
155
|
+
errors?: {
|
|
156
|
+
code: string;
|
|
157
|
+
message: string;
|
|
158
|
+
}[];
|
|
159
|
+
}>;
|
|
160
|
+
/** The behavioural counterpart to validate: run the bundle's own scenario
|
|
161
|
+
* suite against it, graded by the runtime floor. Read-only on the server. */
|
|
162
|
+
certifyProgram(bundle: Record<string, unknown>, scenarios?: unknown[]): Promise<{
|
|
163
|
+
ran: boolean;
|
|
164
|
+
passed: number;
|
|
165
|
+
total: number;
|
|
166
|
+
report?: string;
|
|
167
|
+
failures?: string[];
|
|
168
|
+
results?: {
|
|
169
|
+
name: string;
|
|
170
|
+
passed: boolean;
|
|
171
|
+
reasons?: string[];
|
|
172
|
+
}[];
|
|
173
|
+
errors?: {
|
|
154
174
|
code: string;
|
|
155
175
|
message: string;
|
|
156
176
|
}[];
|
|
@@ -25,40 +25,47 @@ export class RuntimeApiClient {
|
|
|
25
25
|
return this.http.request("/api/v1/tasks", {
|
|
26
26
|
method: "POST",
|
|
27
27
|
body: {
|
|
28
|
-
task_origin: { type: "
|
|
28
|
+
task_origin: { type: "cli", environment: input.environment },
|
|
29
29
|
agent: {
|
|
30
30
|
agent_id: input.agentId,
|
|
31
31
|
version_id: input.versionId,
|
|
32
32
|
version_tag: input.versionTag,
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
created_by: input.userId,
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
getThread(threadId) {
|
|
39
39
|
return this.http.request(`/api/v1/tasks/${threadId}`);
|
|
40
40
|
}
|
|
41
|
-
listThreads(userId,
|
|
42
|
-
|
|
43
|
-
query: {
|
|
41
|
+
async listThreads(userId, options = {}) {
|
|
42
|
+
const listing = await this.http.request(`/api/v1/users/${encodeURIComponent(userId)}/tasks`, {
|
|
43
|
+
query: {
|
|
44
|
+
size: options.size ?? 25,
|
|
45
|
+
...(options.after ? { after: options.after } : {}),
|
|
46
|
+
...(options.before ? { before: options.before } : {}),
|
|
47
|
+
},
|
|
44
48
|
});
|
|
49
|
+
return listing.items;
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* Threads bound to an agent, newest first — the listing the runtime intends
|
|
48
53
|
* UIs to use (the per-user route above stays for tooling). Filters compose:
|
|
49
|
-
* owner, version tag, creation window.
|
|
54
|
+
* owner, version tag, creation window. Keyset: `after`/`before` + `size`.
|
|
50
55
|
*/
|
|
51
|
-
listAgentThreads(agentId, filters = {}) {
|
|
52
|
-
|
|
56
|
+
async listAgentThreads(agentId, filters = {}) {
|
|
57
|
+
const listing = await this.http.request(`/api/v1/agents/${encodeURIComponent(agentId)}/tasks`, {
|
|
53
58
|
query: {
|
|
54
|
-
page: filters.page ?? 1,
|
|
55
59
|
size: filters.size ?? 25,
|
|
56
|
-
...(filters.
|
|
60
|
+
...(filters.after ? { after: filters.after } : {}),
|
|
61
|
+
...(filters.before ? { before: filters.before } : {}),
|
|
62
|
+
...(filters.userId ? { created_by: filters.userId } : {}),
|
|
57
63
|
...(filters.versionTag ? { version_tag: filters.versionTag } : {}),
|
|
58
64
|
...(filters.startTime ? { start_time: filters.startTime } : {}),
|
|
59
65
|
...(filters.endTime ? { end_time: filters.endTime } : {}),
|
|
60
66
|
},
|
|
61
67
|
});
|
|
68
|
+
return listing.items;
|
|
62
69
|
}
|
|
63
70
|
listMessages(threadId) {
|
|
64
71
|
return this.http.request(`/messaging/v1/threads/${threadId}/messages`);
|
|
@@ -81,14 +88,16 @@ export class RuntimeApiClient {
|
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
|
-
* The checkout's
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* older than the endpoint
|
|
91
|
+
* The checkout's standing page — the engine's own lifecycle page by
|
|
92
|
+
* default (the same bytes the builder appends after its instructions), or
|
|
93
|
+
* the self-contained headless brief for `audience: "headless"`. Not a
|
|
94
|
+
* skill: it belongs at the checkout root, so it has its own endpoint
|
|
95
|
+
* rather than a slot in the skills index. Engines older than the endpoint
|
|
96
|
+
* answer 404; engines older than the headless page ignore the query — see
|
|
97
|
+
* `AgentsMd.audience`.
|
|
89
98
|
*/
|
|
90
|
-
getAgentsMd() {
|
|
91
|
-
return this.http.request("/api/v1/agents-md");
|
|
99
|
+
getAgentsMd(audience) {
|
|
100
|
+
return this.http.request("/api/v1/agents-md", { query: { audience } });
|
|
92
101
|
}
|
|
93
102
|
getProgramSchemas(file) {
|
|
94
103
|
return this.http.request("/api/v1/programs/schema", {
|
|
@@ -101,20 +110,20 @@ export class RuntimeApiClient {
|
|
|
101
110
|
body: { bundle },
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
|
-
/** The
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
return this.http.request("/api/v1/programs/
|
|
113
|
+
/** The demand-ledger audit: what callers ask, and what this bundle does about
|
|
114
|
+
* it. An unserved need is the RESULT, never a 4xx — same posture as validate. */
|
|
115
|
+
needsProgram(bundle) {
|
|
116
|
+
return this.http.request("/api/v1/programs/needs", {
|
|
108
117
|
method: "POST",
|
|
109
118
|
body: { bundle },
|
|
110
119
|
});
|
|
111
120
|
}
|
|
112
|
-
/** The
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
return this.http.request("/api/v1/programs/
|
|
121
|
+
/** The behavioural counterpart to validate: run the bundle's own scenario
|
|
122
|
+
* suite against it, graded by the runtime floor. Read-only on the server. */
|
|
123
|
+
certifyProgram(bundle, scenarios) {
|
|
124
|
+
return this.http.request("/api/v1/programs/certify", {
|
|
116
125
|
method: "POST",
|
|
117
|
-
body: { bundle },
|
|
126
|
+
body: { bundle, ...(scenarios === undefined ? {} : { scenarios }) },
|
|
118
127
|
});
|
|
119
128
|
}
|
|
120
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-api.js","sourceRoot":"","sources":["../../../src/api/runtime-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-api.js","sourceRoot":"","sources":["../../../src/api/runtime-api.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* return metadata plus a masked `preview`, never the value. Connections
|
|
5
5
|
* reference them as `{{vault.NAME}}`, resolved server-side at runtime.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Agent-owned secrets are keyed by `agent_id` directly — no scope object on
|
|
8
|
+
* the wire. Only SHARED secrets (project/org) still speak the legacy v1
|
|
9
|
+
* scope vocabulary (a project is an "ACCOUNT"). That translation lives HERE
|
|
10
|
+
* and only here — everything above this module says agent / project / org.
|
|
10
11
|
*/
|
|
11
12
|
import type { HttpClient } from "./client-types.js";
|
|
12
13
|
/** Console-side scope vocabulary; most specific name wins at resolution. */
|
|
@@ -18,21 +19,26 @@ export interface VaultScopeIds {
|
|
|
18
19
|
projectId?: string;
|
|
19
20
|
orgId?: string;
|
|
20
21
|
}
|
|
21
|
-
/** Wire shape of a secret's scope (v1 vocabulary — do not export
|
|
22
|
+
/** Wire shape of a SHARED secret's scope (v1 vocabulary — do not export
|
|
23
|
+
* wider). Writes only ever send ACCOUNT or ORGANIZATION; agent-owned secrets
|
|
24
|
+
* carry a top-level `agent_id` and no scope at all. Reads on legacy records
|
|
25
|
+
* may still surface other scope types — treat anything unknown as agent. */
|
|
22
26
|
export interface VaultScope {
|
|
23
|
-
type: "
|
|
24
|
-
network_id?: string | null;
|
|
27
|
+
type: "ACCOUNT" | "ORGANIZATION";
|
|
25
28
|
account_id?: string | null;
|
|
26
29
|
organization_id?: string | null;
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
|
-
* Wire scope for a write
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
+
* Wire scope for a write — `undefined` at the agent level, where the secret
|
|
33
|
+
* is keyed by top-level `agent_id` instead. Extra ids are harmless — the
|
|
34
|
+
* server keys the secret by `type` plus its matching id. Callers validate
|
|
35
|
+
* that the id matching `level` is present.
|
|
32
36
|
*/
|
|
33
|
-
export declare function vaultScopeFor(level: VaultScopeLevel, ids: VaultScopeIds): VaultScope;
|
|
34
|
-
/** Console-side level of a wire scope ("agent" / "project" / "org").
|
|
35
|
-
|
|
37
|
+
export declare function vaultScopeFor(level: VaultScopeLevel, ids: VaultScopeIds): VaultScope | undefined;
|
|
38
|
+
/** Console-side level of a wire scope ("agent" / "project" / "org").
|
|
39
|
+
* Anything that is not a shared ACCOUNT/ORGANIZATION scope — legacy NETWORK
|
|
40
|
+
* records or scope-less agent-owned secrets — reads as agent-level. */
|
|
41
|
+
export declare function vaultScopeLevelOf(scope: VaultScope | null | undefined): VaultScopeLevel;
|
|
36
42
|
/** Body for `POST /v1/vault/secrets` — create and rotate are one upsert. */
|
|
37
43
|
export interface VaultSecretCreate {
|
|
38
44
|
/** UPPER_SNAKE_CASE reference name (`{{vault.NAME}}`). */
|
|
@@ -40,7 +46,10 @@ export interface VaultSecretCreate {
|
|
|
40
46
|
/** Raw value. Write-only — no read ever returns it. */
|
|
41
47
|
value: string;
|
|
42
48
|
description?: string;
|
|
43
|
-
scope
|
|
49
|
+
/** Owning agent — agent-level secrets send this INSTEAD of a scope. */
|
|
50
|
+
agent_id?: string;
|
|
51
|
+
/** Shared-secret scope (project/org). Never sent alongside `agent_id`. */
|
|
52
|
+
scope?: VaultScope;
|
|
44
53
|
created_by: string;
|
|
45
54
|
updated_by: string;
|
|
46
55
|
}
|
|
@@ -50,7 +59,8 @@ export interface VaultSecret {
|
|
|
50
59
|
name: string;
|
|
51
60
|
preview: string;
|
|
52
61
|
description?: string | null;
|
|
53
|
-
|
|
62
|
+
agent_id?: string | null;
|
|
63
|
+
scope?: VaultScope | null;
|
|
54
64
|
scope_id?: string | null;
|
|
55
65
|
version: number;
|
|
56
66
|
is_visible: boolean;
|
|
@@ -67,8 +77,10 @@ export declare class VaultClient {
|
|
|
67
77
|
/** Upsert by (name, scope): first call creates, repeats rotate. */
|
|
68
78
|
upsertSecret(body: VaultSecretCreate): Promise<VaultSecret>;
|
|
69
79
|
/**
|
|
70
|
-
* List secrets visible from
|
|
71
|
-
*
|
|
80
|
+
* List secrets visible from the current context (masked). When an agent
|
|
81
|
+
* is selected, `agent_id` fetches its stamped secrets with one indexed
|
|
82
|
+
* lookup (the server lets it override the scope filters); otherwise the
|
|
83
|
+
* project/org ids drive the shared-scope chain view.
|
|
72
84
|
*/
|
|
73
85
|
listSecrets(ids: VaultScopeIds): Promise<VaultSecret[]>;
|
|
74
86
|
/** Delete by id — the server answers 409 while connections reference it. */
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/** Console-side scope vocabulary; most specific name wins at resolution. */
|
|
2
2
|
export const vaultScopeLevels = ["agent", "project", "org"];
|
|
3
3
|
/**
|
|
4
|
-
* Wire scope for a write
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Wire scope for a write — `undefined` at the agent level, where the secret
|
|
5
|
+
* is keyed by top-level `agent_id` instead. Extra ids are harmless — the
|
|
6
|
+
* server keys the secret by `type` plus its matching id. Callers validate
|
|
7
|
+
* that the id matching `level` is present.
|
|
7
8
|
*/
|
|
8
9
|
export function vaultScopeFor(level, ids) {
|
|
9
10
|
if (level === "agent") {
|
|
10
|
-
return
|
|
11
|
-
type: "NETWORK",
|
|
12
|
-
network_id: ids.agentId,
|
|
13
|
-
...(ids.projectId ? { account_id: ids.projectId } : {}),
|
|
14
|
-
...(ids.orgId ? { organization_id: ids.orgId } : {}),
|
|
15
|
-
};
|
|
11
|
+
return undefined;
|
|
16
12
|
}
|
|
17
13
|
if (level === "project") {
|
|
18
14
|
return {
|
|
@@ -23,13 +19,15 @@ export function vaultScopeFor(level, ids) {
|
|
|
23
19
|
}
|
|
24
20
|
return { type: "ORGANIZATION", organization_id: ids.orgId };
|
|
25
21
|
}
|
|
26
|
-
/** Console-side level of a wire scope ("agent" / "project" / "org").
|
|
22
|
+
/** Console-side level of a wire scope ("agent" / "project" / "org").
|
|
23
|
+
* Anything that is not a shared ACCOUNT/ORGANIZATION scope — legacy NETWORK
|
|
24
|
+
* records or scope-less agent-owned secrets — reads as agent-level. */
|
|
27
25
|
export function vaultScopeLevelOf(scope) {
|
|
28
|
-
if (scope
|
|
29
|
-
return "agent";
|
|
30
|
-
if (scope.type === "ACCOUNT")
|
|
26
|
+
if (scope?.type === "ACCOUNT")
|
|
31
27
|
return "project";
|
|
32
|
-
|
|
28
|
+
if (scope?.type === "ORGANIZATION")
|
|
29
|
+
return "org";
|
|
30
|
+
return "agent";
|
|
33
31
|
}
|
|
34
32
|
export class VaultClient {
|
|
35
33
|
http;
|
|
@@ -44,13 +42,15 @@ export class VaultClient {
|
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
|
-
* List secrets visible from
|
|
48
|
-
*
|
|
45
|
+
* List secrets visible from the current context (masked). When an agent
|
|
46
|
+
* is selected, `agent_id` fetches its stamped secrets with one indexed
|
|
47
|
+
* lookup (the server lets it override the scope filters); otherwise the
|
|
48
|
+
* project/org ids drive the shared-scope chain view.
|
|
49
49
|
*/
|
|
50
50
|
listSecrets(ids) {
|
|
51
51
|
return this.http.request("/v1/vault/secrets", {
|
|
52
52
|
query: {
|
|
53
|
-
|
|
53
|
+
agent_id: ids.agentId,
|
|
54
54
|
account_id: ids.projectId,
|
|
55
55
|
organization_id: ids.orgId,
|
|
56
56
|
},
|