@madewithremy/admin 0.1.56 → 0.1.58
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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/client.d.ts +199 -0
- package/dist/config.d.ts +8 -0
- package/dist/ctx.d.ts +36 -0
- package/dist/errors.d.ts +68 -0
- package/dist/http.d.ts +68 -0
- package/dist/index.d.ts +7 -9434
- package/dist/index.js +6 -6
- package/dist/index.js.map +7 -1
- package/dist/ops/agent.d.ts +44 -0
- package/dist/ops/analytics.d.ts +285 -0
- package/dist/ops/apps.d.ts +33 -0
- package/dist/ops/crashes.d.ts +86 -0
- package/dist/ops/cron.d.ts +40 -0
- package/dist/ops/data.d.ts +68 -0
- package/dist/ops/dataSourceConnectors.d.ts +80 -0
- package/dist/ops/dataSourceEvals.d.ts +208 -0
- package/dist/ops/dataSourceJobs.d.ts +141 -0
- package/dist/ops/dataSourceMappers.d.ts +125 -0
- package/dist/ops/dataSources.d.ts +654 -0
- package/dist/ops/db.d.ts +81 -0
- package/dist/ops/diagnostics.d.ts +42 -0
- package/dist/ops/domains.d.ts +250 -0
- package/dist/ops/email.d.ts +305 -0
- package/dist/ops/events.d.ts +56 -0
- package/dist/ops/feedback.d.ts +24 -0
- package/dist/ops/files.d.ts +166 -0
- package/dist/ops/infra.d.ts +163 -0
- package/dist/ops/issues.d.ts +160 -0
- package/dist/ops/jewels.d.ts +249 -0
- package/dist/ops/methods.d.ts +60 -0
- package/dist/ops/prerender.d.ts +74 -0
- package/dist/ops/previews.d.ts +52 -0
- package/dist/ops/qaRecordings.d.ts +68 -0
- package/dist/ops/releases.d.ts +193 -0
- package/dist/ops/requests.d.ts +73 -0
- package/dist/ops/secrets.d.ts +69 -0
- package/dist/ops/settings.d.ts +45 -0
- package/dist/ops/tasks.d.ts +47 -0
- package/dist/ops/usage.d.ts +40 -0
- package/dist/ops/users.d.ts +59 -0
- package/dist/ops/voice.d.ts +178 -0
- package/dist/output.d.ts +19 -0
- package/dist/parseJsonConfig.d.ts +41 -0
- package/dist/poll.d.ts +38 -0
- package/dist/prod.js +24 -21
- package/dist/runningMethod.d.ts +25 -0
- package/dist/sleep.d.ts +12 -0
- package/dist/types/agent.d.ts +95 -0
- package/dist/types/analytics.d.ts +225 -0
- package/dist/types/apps.d.ts +39 -0
- package/dist/types/crashes.d.ts +81 -0
- package/dist/types/cron.d.ts +68 -0
- package/dist/types/data.d.ts +38 -0
- package/dist/types/dataSourceConnectors.d.ts +59 -0
- package/dist/types/dataSourceEvals.d.ts +225 -0
- package/dist/types/dataSourceJobs.d.ts +283 -0
- package/dist/types/dataSourceMappers.d.ts +204 -0
- package/dist/types/dataSourceReaders.d.ts +102 -0
- package/dist/types/dataSources.d.ts +627 -0
- package/dist/types/db.d.ts +63 -0
- package/dist/types/diagnostics.d.ts +96 -0
- package/dist/types/domains.d.ts +277 -0
- package/dist/types/email.d.ts +400 -0
- package/dist/types/events.d.ts +54 -0
- package/dist/types/feedback.d.ts +11 -0
- package/dist/types/files.d.ts +150 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/infra.d.ts +188 -0
- package/dist/types/issues.d.ts +106 -0
- package/dist/types/jewels.d.ts +336 -0
- package/dist/types/methods.d.ts +34 -0
- package/dist/types/prerender.d.ts +59 -0
- package/dist/types/previews.d.ts +39 -0
- package/dist/types/progress.d.ts +31 -0
- package/dist/types/qaRecordings.d.ts +51 -0
- package/dist/types/releases.d.ts +233 -0
- package/dist/types/requests.d.ts +114 -0
- package/dist/types/secrets.d.ts +52 -0
- package/dist/types/settings.d.ts +79 -0
- package/dist/types/tasks.d.ts +99 -0
- package/dist/types/usage.d.ts +29 -0
- package/dist/types/users.d.ts +61 -0
- package/dist/types/voice.d.ts +197 -0
- package/dist/upload.d.ts +11 -0
- package/package.json +7 -10
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response types for the provisioned-infrastructure management API.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from the api (apps/api/src/):
|
|
5
|
+
* roles/http/routes/Apps/manage/provisionedResources.ts
|
|
6
|
+
* customerApps/AppDedicatedResources/types.ts
|
|
7
|
+
* customerApps/AppDedicatedResources/offerings/define.ts
|
|
8
|
+
*/
|
|
9
|
+
import type { OperationProgress } from './progress.js';
|
|
10
|
+
/** Where a resource is in its lifecycle. Written only by the platform. */
|
|
11
|
+
export type InfraPhase = 'requested' | 'provisioning' | 'active' | 'hibernating' | 'hibernated' | 'resuming' | 'decommissioning' | 'destroyed' | 'failed';
|
|
12
|
+
/** What the owner asked for. Written only by the owner's actions. */
|
|
13
|
+
export type InfraDesiredState = 'active' | 'hibernated' | 'destroyed';
|
|
14
|
+
/**
|
|
15
|
+
* What the platform last saw of an active resource's instance. `rebuilding`
|
|
16
|
+
* is a serving instance onto which one or more placed sources are being copied
|
|
17
|
+
* back from durable storage (a new pod found their index empty); searches on
|
|
18
|
+
* those sources answer `index_warming` with the copy's progress until it lands.
|
|
19
|
+
*/
|
|
20
|
+
export type InfraHealth = 'ready' | 'not-ready' | 'missing' | 'rebuilding'
|
|
21
|
+
/** Serving in Qdrant's low-memory mode after repeated out-of-memory restarts, until memory settles. */
|
|
22
|
+
| 'degraded';
|
|
23
|
+
/** A leasable product from the platform catalog. Prices are cogs + margin. */
|
|
24
|
+
export interface InfraOffering {
|
|
25
|
+
id: string;
|
|
26
|
+
kind: 'retrieval';
|
|
27
|
+
/** User-facing size, e.g. "Small". */
|
|
28
|
+
label: string;
|
|
29
|
+
/** User-facing capacity, e.g. "Up to ~34M chunks at 2560 dimensions (~48M at 1024, ~26M at 4096)". */
|
|
30
|
+
description: string;
|
|
31
|
+
hourlyPriceDollars: number;
|
|
32
|
+
/** Hourly × 730. */
|
|
33
|
+
monthlyPriceDollars: number;
|
|
34
|
+
/** Zero: a hibernated resource holds nothing; its sources' documents stay in the platform's own store. */
|
|
35
|
+
hibernatedHourlyPriceDollars: number;
|
|
36
|
+
hibernatedMonthlyPriceDollars: number;
|
|
37
|
+
/**
|
|
38
|
+
* What the size holds: its disk and RAM, and the chunks that comes to at
|
|
39
|
+
* each embedding dimension on offer, keyed by dimension ("2560"). A chunk
|
|
40
|
+
* embedded at 2560 dimensions takes two and a half times a 1024-dimension
|
|
41
|
+
* one, so a resource's room depends on what is placed on it.
|
|
42
|
+
*/
|
|
43
|
+
capacity: {
|
|
44
|
+
diskGiB: number;
|
|
45
|
+
memoryGiB: number;
|
|
46
|
+
chunksByDimensions: Record<string, number>;
|
|
47
|
+
};
|
|
48
|
+
capabilities: {
|
|
49
|
+
hibernate: boolean;
|
|
50
|
+
};
|
|
51
|
+
retired: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface InfraResource {
|
|
54
|
+
id: string;
|
|
55
|
+
appId: string;
|
|
56
|
+
name: string;
|
|
57
|
+
kind: 'retrieval';
|
|
58
|
+
offeringId: string;
|
|
59
|
+
offering: InfraOffering | null;
|
|
60
|
+
phase: InfraPhase;
|
|
61
|
+
desiredState: InfraDesiredState;
|
|
62
|
+
/** Data sources placed on this resource. Destroy is refused while > 0. */
|
|
63
|
+
attachedSources: number;
|
|
64
|
+
lastError: string | null;
|
|
65
|
+
/** Null until the instance exists (requested, hibernated, destroyed). */
|
|
66
|
+
health: InfraHealth | null;
|
|
67
|
+
/**
|
|
68
|
+
* What the instance is doing right now, while a transition is under way
|
|
69
|
+
* ("Waiting for capacity", "Starting Qdrant", "Scaling down"); null when nothing is.
|
|
70
|
+
*/
|
|
71
|
+
detail: string | null;
|
|
72
|
+
/**
|
|
73
|
+
* The same in the one progress shape, with numbers where there are any: a
|
|
74
|
+
* rebuild of the sources placed here (documents, rate, ETA), an index build
|
|
75
|
+
* the optimizer is behind on (vectors), or a transition's step. Null when the
|
|
76
|
+
* resource is simply serving.
|
|
77
|
+
*/
|
|
78
|
+
progress: OperationProgress | null;
|
|
79
|
+
/**
|
|
80
|
+
* What the sources placed here take on the instance, estimated from their
|
|
81
|
+
* chunk counts at their dimensions, against what the size can hold
|
|
82
|
+
* (`usableDiskBytes`). `storedBytes` is the vectors and payload the instance
|
|
83
|
+
* itself reports (null until it has); the indexes and WAL sit on top of it,
|
|
84
|
+
* so it runs under the estimate. Null when the offering is unknown.
|
|
85
|
+
*/
|
|
86
|
+
footprint: {
|
|
87
|
+
chunks: number;
|
|
88
|
+
estimatedDiskBytes: number;
|
|
89
|
+
storedBytes: number | null;
|
|
90
|
+
measuredAt: string | null;
|
|
91
|
+
usableDiskBytes: number;
|
|
92
|
+
} | null;
|
|
93
|
+
/**
|
|
94
|
+
* The instance's resident memory against the limit it is killed at, as
|
|
95
|
+
* last sampled; null until the platform has observed the instance.
|
|
96
|
+
*/
|
|
97
|
+
memory: {
|
|
98
|
+
residentBytes: number;
|
|
99
|
+
limitBytes: number;
|
|
100
|
+
sampledAt: string;
|
|
101
|
+
} | null;
|
|
102
|
+
/**
|
|
103
|
+
* How often the instance has restarted and why it last stopped (`OOMKilled`,
|
|
104
|
+
* `Error`); null until observed. `infra logs` carries each restart as a line.
|
|
105
|
+
*/
|
|
106
|
+
restarts: {
|
|
107
|
+
count: number;
|
|
108
|
+
lastReason: string | null;
|
|
109
|
+
lastAt: string | null;
|
|
110
|
+
} | null;
|
|
111
|
+
/**
|
|
112
|
+
* The size this resource is being resized to, while a resize is under way;
|
|
113
|
+
* null otherwise. A resize passes through `hibernated` and back to the phase
|
|
114
|
+
* it started from.
|
|
115
|
+
*/
|
|
116
|
+
resizingTo: InfraOffering | null;
|
|
117
|
+
/**
|
|
118
|
+
* What this resource has actually been charged, from the ledger's own
|
|
119
|
+
* writes, with the hours at each rate beside it. Rates are on `offering`.
|
|
120
|
+
*/
|
|
121
|
+
billing: {
|
|
122
|
+
activeHours: number;
|
|
123
|
+
hibernatedHours: number;
|
|
124
|
+
billedDollars: number;
|
|
125
|
+
lastBilledAt: string | null;
|
|
126
|
+
};
|
|
127
|
+
activatedAt: string | null;
|
|
128
|
+
hibernatedAt: string | null;
|
|
129
|
+
destroyedAt: string | null;
|
|
130
|
+
phaseChangedAt: string;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
}
|
|
134
|
+
export interface InfraEvent {
|
|
135
|
+
id: string;
|
|
136
|
+
fromPhase: InfraPhase | null;
|
|
137
|
+
toPhase: InfraPhase;
|
|
138
|
+
/** `user:<id>` or `system`. */
|
|
139
|
+
actor: string;
|
|
140
|
+
reason: string | null;
|
|
141
|
+
createdAt: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* One line of the platform's narration of a resource: a step reported while
|
|
145
|
+
* a transition ran ("Waiting for capacity", "Starting Qdrant"), a rebuild it
|
|
146
|
+
* started ("Instance replaced; checking each placed source's index on it"), a
|
|
147
|
+
* failed attempt, or a failure with what Kubernetes said about the pod at the
|
|
148
|
+
* time (`data`). Not the instance's own stdout.
|
|
149
|
+
*/
|
|
150
|
+
export interface InfraLogLine {
|
|
151
|
+
id: string;
|
|
152
|
+
phase: InfraPhase;
|
|
153
|
+
level: 'info' | 'warn' | 'error';
|
|
154
|
+
message: string;
|
|
155
|
+
data: {
|
|
156
|
+
podEvents: string[];
|
|
157
|
+
logTail: string[];
|
|
158
|
+
} | null;
|
|
159
|
+
createdAt: string;
|
|
160
|
+
}
|
|
161
|
+
/** GET /infra */
|
|
162
|
+
export interface InfraListResult {
|
|
163
|
+
resources: InfraResource[];
|
|
164
|
+
offerings: InfraOffering[];
|
|
165
|
+
/** False on hosts that cannot provision; `provision` will be refused. */
|
|
166
|
+
provisioningAvailable: boolean;
|
|
167
|
+
}
|
|
168
|
+
/** GET /infra/:id */
|
|
169
|
+
export interface InfraGetResult {
|
|
170
|
+
resource: InfraResource;
|
|
171
|
+
events: InfraEvent[];
|
|
172
|
+
/** The newest 200 narration lines, oldest first; `logs()` pages further. */
|
|
173
|
+
logs: InfraLogLine[];
|
|
174
|
+
attachedSources: {
|
|
175
|
+
id: string;
|
|
176
|
+
slug: string;
|
|
177
|
+
name: string | null;
|
|
178
|
+
}[];
|
|
179
|
+
}
|
|
180
|
+
/** GET /infra/:id/logs */
|
|
181
|
+
export interface InfraLogsResult {
|
|
182
|
+
/** Oldest first. */
|
|
183
|
+
logs: InfraLogLine[];
|
|
184
|
+
}
|
|
185
|
+
/** POST /infra, /infra/:id/{hibernate,resume,destroy,rename,resize} */
|
|
186
|
+
export interface InfraResourceResult {
|
|
187
|
+
resource: InfraResource;
|
|
188
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result types for the `issues` CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from the api (apps/api/src/):
|
|
5
|
+
* roles/http/routes/Apps/manage/issues.ts
|
|
6
|
+
* customerApps/AppIssues/dao/AppIssuesDao.ts
|
|
7
|
+
* customerApps/AppIssues/dao/AppIssueCommentsDao.ts
|
|
8
|
+
*/
|
|
9
|
+
export type IssueStatus = 'open' | 'closed';
|
|
10
|
+
/**
|
|
11
|
+
* 'user' = workspace member; 'agent' = Remy agent; 'app' = another app's
|
|
12
|
+
* backend; 'system' = server-set activity events; 'sdk' = end-user report.
|
|
13
|
+
*
|
|
14
|
+
* Authorship is this × `originAppId`: 'agent' with an origin is another app's
|
|
15
|
+
* agent, 'app' with an origin is its backend, 'agent' alone is the app's own.
|
|
16
|
+
*/
|
|
17
|
+
export type IssueAuthorKind = 'user' | 'agent' | 'system' | 'sdk' | 'app';
|
|
18
|
+
export type IssueEventType = 'closed' | 'reopened';
|
|
19
|
+
/** One issue row (V2AppIssue from V2AppIssuesDao). */
|
|
20
|
+
export interface IssueRow {
|
|
21
|
+
id: string;
|
|
22
|
+
appId: string;
|
|
23
|
+
/** Friendly per-app sequential number, e.g. 42. */
|
|
24
|
+
number: number;
|
|
25
|
+
title: string;
|
|
26
|
+
body: string;
|
|
27
|
+
/** Open label set. Replaced the closed bug/idea/task `kind` enum. */
|
|
28
|
+
labels: string[];
|
|
29
|
+
status: IssueStatus;
|
|
30
|
+
authorKind: IssueAuthorKind;
|
|
31
|
+
authorUserId: string | null;
|
|
32
|
+
/** The app that filed this, when another app did; null otherwise. */
|
|
33
|
+
originAppId: string | null;
|
|
34
|
+
/** Free-form reporter label for 'sdk'-authored (end-user) reports; null otherwise. */
|
|
35
|
+
reporter: string | null;
|
|
36
|
+
releaseId: string | null;
|
|
37
|
+
commitSha: string | null;
|
|
38
|
+
/** Full source blob for error/crash-linked issues (e.g. { kind, key, releaseId }). */
|
|
39
|
+
linkedSignal: unknown | null;
|
|
40
|
+
/** Namespaced grouping key (`<sourceKind>:<key>`) used for open-issue dedup. */
|
|
41
|
+
sourceKey: string | null;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
closedAt: string | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* One thread entry — either a prose comment or a structured activity event
|
|
48
|
+
* (e.g. closed, reopened). (V2AppIssueComment from V2AppIssueCommentsDao)
|
|
49
|
+
*/
|
|
50
|
+
export interface IssueCommentRow {
|
|
51
|
+
id: string;
|
|
52
|
+
issueId: string;
|
|
53
|
+
appId: string;
|
|
54
|
+
entryType: 'comment' | 'event';
|
|
55
|
+
eventType: IssueEventType | null;
|
|
56
|
+
eventMeta: unknown | null;
|
|
57
|
+
body: string;
|
|
58
|
+
authorKind: IssueAuthorKind;
|
|
59
|
+
authorUserId: string | null;
|
|
60
|
+
/** The app that wrote this entry, when another app did; null otherwise. */
|
|
61
|
+
originAppId: string | null;
|
|
62
|
+
/** Free-form blob an agent-authored entry may carry; null otherwise. */
|
|
63
|
+
metadata: unknown | null;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* issues list → GET /_internal/v2/apps/:appId/issues
|
|
69
|
+
* issues filed → GET /_internal/v2/apps/:appId/issues/filed
|
|
70
|
+
*/
|
|
71
|
+
export interface IssuesListResult {
|
|
72
|
+
issues: IssueRow[];
|
|
73
|
+
/** Opaque keyset cursor; pass as ?cursor= to fetch the next page. */
|
|
74
|
+
nextCursor: string | null;
|
|
75
|
+
}
|
|
76
|
+
/** issues get → GET /_internal/v2/apps/:appId/issues/:number */
|
|
77
|
+
export interface IssuesGetResult {
|
|
78
|
+
issue: IssueRow;
|
|
79
|
+
comments: IssueCommentRow[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* issues create → POST /_internal/v2/apps/:appId/issues
|
|
83
|
+
*
|
|
84
|
+
* `deduped` is present only when a `source` was supplied on the request:
|
|
85
|
+
* true if an open issue for the same source already existed (no new row
|
|
86
|
+
* created), false if this is a fresh issue.
|
|
87
|
+
*/
|
|
88
|
+
export interface IssuesCreateResult {
|
|
89
|
+
issue: IssueRow;
|
|
90
|
+
deduped?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** issues comment → POST /_internal/v2/apps/:appId/issues/:number/comments */
|
|
93
|
+
export interface IssuesCommentResult {
|
|
94
|
+
comment: IssueCommentRow;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* issues close / reopen / edit →
|
|
98
|
+
* POST /_internal/v2/apps/:appId/issues/:number/update
|
|
99
|
+
*/
|
|
100
|
+
export interface IssuesUpdateResult {
|
|
101
|
+
issue: IssueRow;
|
|
102
|
+
}
|
|
103
|
+
/** issues delete → POST /_internal/v2/apps/:appId/issues/:number/delete */
|
|
104
|
+
export interface IssuesDeleteResult {
|
|
105
|
+
ok: true;
|
|
106
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result types for the `jewels` CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from the api (apps/api/src/):
|
|
5
|
+
* roles/http/routes/Apps/manage/jewels.ts
|
|
6
|
+
* customerApps/AppJewels/dao/JewelPairsDao.ts
|
|
7
|
+
* customerApps/AppModelTraining/dao/TrainingRunsDao.ts
|
|
8
|
+
* customerApps/AppJewels/dao/JewelProposalsDao.ts
|
|
9
|
+
* customerApps/AppJewels/resolveQueueItem.ts
|
|
10
|
+
* customerApps/AppModelTraining/training.ts
|
|
11
|
+
* customerApps/AppModelTraining/gradeTrainingRun.ts
|
|
12
|
+
* customerApps/AppModelTraining/datasetExport.ts
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* `expired` is platform-assigned only: a pending arrival proposal whose
|
|
16
|
+
* attributionWindow closed with no human action to grade against.
|
|
17
|
+
*/
|
|
18
|
+
export type JewelVerdict = 'agree' | 'disagree' | 'skip' | 'expired';
|
|
19
|
+
export type TrainingRunStatus = 'queued' | 'running' | 'complete' | 'failed';
|
|
20
|
+
export type DatasetFile = 'sft-train' | 'sft-eval' | 'preference' | 'eval-disagreements';
|
|
21
|
+
/**
|
|
22
|
+
* Slim pair columns returned by list views — excludes the pair JSONB payload.
|
|
23
|
+
* (V2JewelPairSummary from V2JewelPairsDao)
|
|
24
|
+
*/
|
|
25
|
+
export interface JewelPairSummaryRow {
|
|
26
|
+
id: string;
|
|
27
|
+
appId: string;
|
|
28
|
+
releaseId: string | null;
|
|
29
|
+
methodId: string;
|
|
30
|
+
mode: string;
|
|
31
|
+
/** null when the run failed before grading. */
|
|
32
|
+
verdict: JewelVerdict | null;
|
|
33
|
+
/** The jewel's reasoning prose, extracted for list views. */
|
|
34
|
+
reasoning: string | null;
|
|
35
|
+
/** 'infra' | 'subject' | 'propose' | null */
|
|
36
|
+
errorPhase: string | null;
|
|
37
|
+
runDurationMs: number | null;
|
|
38
|
+
humanRequestId: string;
|
|
39
|
+
jewelRequestId: string;
|
|
40
|
+
humanUserId: string | null;
|
|
41
|
+
jewelUserId: string | null;
|
|
42
|
+
requestSource: string | null;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Full pair row — summary columns plus the complete JewelPairRecord.
|
|
47
|
+
* (V2JewelPair from V2JewelPairsDao)
|
|
48
|
+
*/
|
|
49
|
+
export interface JewelPairRow extends JewelPairSummaryRow {
|
|
50
|
+
/** The full JewelPairRecord (or an infra-error marker). Dynamic model IO. */
|
|
51
|
+
pair: Record<string, any>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One entry in a run's append-only event log.
|
|
55
|
+
* 'status' entries narrate the run for humans; 'loss' entries carry the
|
|
56
|
+
* live training curve. (TrainingLogEntry from V2TrainingRunsDao)
|
|
57
|
+
*/
|
|
58
|
+
export type TrainingLogEntry = {
|
|
59
|
+
ts: number;
|
|
60
|
+
kind: 'status';
|
|
61
|
+
phase: string;
|
|
62
|
+
message: string;
|
|
63
|
+
metadata?: Record<string, any>;
|
|
64
|
+
} | {
|
|
65
|
+
ts: number;
|
|
66
|
+
kind: 'loss';
|
|
67
|
+
step: number;
|
|
68
|
+
loss: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Training run row. (V2TrainingRun from V2TrainingRunsDao)
|
|
72
|
+
*
|
|
73
|
+
* `log` is only populated on single-run reads (`jewels run`); list responses
|
|
74
|
+
* serialize it as [].
|
|
75
|
+
*/
|
|
76
|
+
export interface TrainingRunRow {
|
|
77
|
+
id: string;
|
|
78
|
+
appId: string;
|
|
79
|
+
methodId: string;
|
|
80
|
+
status: TrainingRunStatus;
|
|
81
|
+
baseModel: string;
|
|
82
|
+
/** LoRA/fine-tuning parameters (epochs, rank, learningRate). */
|
|
83
|
+
tuning: Record<string, any>;
|
|
84
|
+
/** Dataset build summary — per-file counts and exclusion buckets. */
|
|
85
|
+
datasetSummary: Record<string, any>;
|
|
86
|
+
datasetPrefix: string;
|
|
87
|
+
adapterKey: string | null;
|
|
88
|
+
/** Dynamic run report (grading, predictions, candidates after completion). */
|
|
89
|
+
report: Record<string, any> | null;
|
|
90
|
+
/**
|
|
91
|
+
* Latest trainer heartbeat (phase/step/loss + a server-stamped `at`);
|
|
92
|
+
* frozen at last value once the run reaches a terminal state.
|
|
93
|
+
*/
|
|
94
|
+
progress: Record<string, any> | null;
|
|
95
|
+
/** Append-only event log — only populated on single-run reads. */
|
|
96
|
+
log: TrainingLogEntry[];
|
|
97
|
+
error: string | null;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
startedAt: string | null;
|
|
100
|
+
finishedAt: string | null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The jewel's own grade results for a run's held-out predictions.
|
|
104
|
+
* agree/(agree+disagree) matches the pairs dashboard's agreement formula.
|
|
105
|
+
* (TrainingRunGrading from gradeTrainingRun.ts)
|
|
106
|
+
*/
|
|
107
|
+
export interface JewelsGrading {
|
|
108
|
+
/** agree / (agree + disagree) — skips and ungraded excluded, like the ledger. */
|
|
109
|
+
agreement: number | null;
|
|
110
|
+
agree: number;
|
|
111
|
+
disagree: number;
|
|
112
|
+
skip: number;
|
|
113
|
+
/** Rows the grader could not judge (infra failures). */
|
|
114
|
+
ungraded: number;
|
|
115
|
+
/** Whether any row dispatched the jewel's custom grade function (vs deep-equal). */
|
|
116
|
+
customGrade: boolean;
|
|
117
|
+
gradedAt: string;
|
|
118
|
+
infraErrors?: string[];
|
|
119
|
+
/** The untrained base's agreement on the same held-out set (lift baseline). */
|
|
120
|
+
baseAgreement?: number | null;
|
|
121
|
+
baseAgree?: number;
|
|
122
|
+
baseDisagree?: number;
|
|
123
|
+
}
|
|
124
|
+
/** (DatasetSummary from datasetExport.ts) */
|
|
125
|
+
export interface JewelsDatasetSummary {
|
|
126
|
+
appId: string;
|
|
127
|
+
methodId: string;
|
|
128
|
+
window: {
|
|
129
|
+
start: string | null;
|
|
130
|
+
end: string | null;
|
|
131
|
+
};
|
|
132
|
+
/** Graded pairs seen in the window (every exclusion bucket below sums back). */
|
|
133
|
+
gradedPairs: number;
|
|
134
|
+
files: Record<DatasetFile, {
|
|
135
|
+
rows: number;
|
|
136
|
+
bytes: number;
|
|
137
|
+
}>;
|
|
138
|
+
excluded: {
|
|
139
|
+
/** Not a decision moment (grade said so). */
|
|
140
|
+
skip: number;
|
|
141
|
+
/** Proposed, nobody acted — unconsumed is not wrong (PU-learning). */
|
|
142
|
+
expired: number;
|
|
143
|
+
/** The run failed before grading. */
|
|
144
|
+
ungraded: number;
|
|
145
|
+
/** Auto commits — no independent human signal. */
|
|
146
|
+
auto: number;
|
|
147
|
+
/**
|
|
148
|
+
* Pairs a file wanted but whose jewel never attached a trace.
|
|
149
|
+
* This is the trace-coverage nag.
|
|
150
|
+
*/
|
|
151
|
+
traceless: number;
|
|
152
|
+
/** Traces attached but no longer retrievable. */
|
|
153
|
+
traceMissing: number;
|
|
154
|
+
/**
|
|
155
|
+
* Corrections whose captured completion couldn't be re-rendered with
|
|
156
|
+
* the human's decision swapped in.
|
|
157
|
+
*/
|
|
158
|
+
preferenceUnrenderable: number;
|
|
159
|
+
};
|
|
160
|
+
/** Agreement pairs with a usable trace / all agreement pairs. */
|
|
161
|
+
traceCoverage: number | null;
|
|
162
|
+
splitEvalFraction: number;
|
|
163
|
+
}
|
|
164
|
+
/** jewels overview → GET /_internal/v2/apps/:appId/jewels/overview */
|
|
165
|
+
export interface JewelsOverviewResult {
|
|
166
|
+
window: {
|
|
167
|
+
start: string;
|
|
168
|
+
end: string;
|
|
169
|
+
};
|
|
170
|
+
methods: Array<{
|
|
171
|
+
methodId: string;
|
|
172
|
+
name: string;
|
|
173
|
+
autonomy: string | null;
|
|
174
|
+
/** Canary/cost dial — EXPECTED coverage equals sampleRate. */
|
|
175
|
+
sampleRate: number;
|
|
176
|
+
hasJewel: boolean;
|
|
177
|
+
jewelRoles: unknown[];
|
|
178
|
+
/** Pending approval-queue depth; 0 for non-approve-mode methods. */
|
|
179
|
+
queuedCount: number;
|
|
180
|
+
pairs?: {
|
|
181
|
+
total: number;
|
|
182
|
+
agree: number;
|
|
183
|
+
disagree: number;
|
|
184
|
+
skip: number;
|
|
185
|
+
expired: number;
|
|
186
|
+
ungraded: number;
|
|
187
|
+
};
|
|
188
|
+
/** agree / (agree + disagree); null when no graded pairs in window. */
|
|
189
|
+
agreementRate?: number | null;
|
|
190
|
+
humanInvocations?: number;
|
|
191
|
+
coverage?: number | null;
|
|
192
|
+
lastPairAt?: string | null;
|
|
193
|
+
training?: {
|
|
194
|
+
active: {
|
|
195
|
+
runId: string;
|
|
196
|
+
status: TrainingRunStatus;
|
|
197
|
+
progress: Record<string, any> | null;
|
|
198
|
+
createdAt: string;
|
|
199
|
+
} | null;
|
|
200
|
+
lastRun: {
|
|
201
|
+
runId: string;
|
|
202
|
+
status: TrainingRunStatus;
|
|
203
|
+
error: string | null;
|
|
204
|
+
finishedAt: string | null;
|
|
205
|
+
} | null;
|
|
206
|
+
latestModel: {
|
|
207
|
+
runId: string;
|
|
208
|
+
baseModel: string;
|
|
209
|
+
agreement: number | null;
|
|
210
|
+
evalRows: number | null;
|
|
211
|
+
trainRows: number | null;
|
|
212
|
+
trainLoss: number | null;
|
|
213
|
+
finishedAt: string | null;
|
|
214
|
+
} | null;
|
|
215
|
+
};
|
|
216
|
+
}>;
|
|
217
|
+
totals: {
|
|
218
|
+
pairs: number;
|
|
219
|
+
agree: number;
|
|
220
|
+
disagree: number;
|
|
221
|
+
skip: number;
|
|
222
|
+
expired: number;
|
|
223
|
+
ungraded: number;
|
|
224
|
+
agreementRate: number | null;
|
|
225
|
+
shadowedMethods: number;
|
|
226
|
+
totalMethods: number;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** jewels pairs → GET /_internal/v2/apps/:appId/jewels/pairs */
|
|
230
|
+
export interface JewelsPairsResult {
|
|
231
|
+
pairs: JewelPairSummaryRow[];
|
|
232
|
+
nextCursor: string | null;
|
|
233
|
+
}
|
|
234
|
+
/** jewels pair <pairId> → GET /_internal/v2/apps/:appId/jewels/pairs/:pairId */
|
|
235
|
+
export interface JewelsPairResult {
|
|
236
|
+
pair: JewelPairRow;
|
|
237
|
+
/**
|
|
238
|
+
* Hydrated model transcripts (propose + grade phases). Objects that could
|
|
239
|
+
* not be fetched degrade to `{ id, phase, missing: true }` rather than a 500.
|
|
240
|
+
* The trace content beyond id/phase/missing is dynamic model IO.
|
|
241
|
+
*/
|
|
242
|
+
traces: Array<{
|
|
243
|
+
id: string;
|
|
244
|
+
phase: 'propose' | 'grade';
|
|
245
|
+
missing?: true;
|
|
246
|
+
[key: string]: unknown;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
/** jewels queue → GET /_internal/v2/apps/:appId/jewels/queue */
|
|
250
|
+
export interface JewelsQueueResult {
|
|
251
|
+
items: Array<{
|
|
252
|
+
id: string;
|
|
253
|
+
methodId: string;
|
|
254
|
+
/** The triggering subject — input fields the jewel was asked to decide on. */
|
|
255
|
+
subject: Record<string, unknown>;
|
|
256
|
+
/** The jewel's proposed output (dynamic model IO). */
|
|
257
|
+
proposed: unknown | null;
|
|
258
|
+
/** The jewel's reasoning prose. */
|
|
259
|
+
reasoning: unknown | null;
|
|
260
|
+
jewelRequestId: string | null;
|
|
261
|
+
proposedAt: string;
|
|
262
|
+
expiresAt: string;
|
|
263
|
+
}>;
|
|
264
|
+
}
|
|
265
|
+
/** One bucket in a timeseries response. (JewelTimeseriesBucket from V2JewelPairsDao) */
|
|
266
|
+
export interface JewelsTimeseriesBucket {
|
|
267
|
+
bucketStart: string;
|
|
268
|
+
agree: number;
|
|
269
|
+
disagree: number;
|
|
270
|
+
skip: number;
|
|
271
|
+
expired: number;
|
|
272
|
+
ungraded: number;
|
|
273
|
+
total: number;
|
|
274
|
+
}
|
|
275
|
+
/** jewels timeseries → GET /_internal/v2/apps/:appId/jewels/timeseries */
|
|
276
|
+
export interface JewelsTimeseriesResult {
|
|
277
|
+
start: string;
|
|
278
|
+
end: string;
|
|
279
|
+
intervalSec: number;
|
|
280
|
+
methods: Array<{
|
|
281
|
+
methodId: string;
|
|
282
|
+
buckets: JewelsTimeseriesBucket[];
|
|
283
|
+
}>;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* jewels resolve → POST /_internal/v2/apps/:appId/jewels/queue/resolve
|
|
287
|
+
*
|
|
288
|
+
* resolution is one of 'approved' | 'edited' | 'dismissed'.
|
|
289
|
+
* output is the method's return value (approve only; dynamic model IO).
|
|
290
|
+
*/
|
|
291
|
+
export interface JewelsResolveResult {
|
|
292
|
+
resolution: string;
|
|
293
|
+
output?: unknown;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* jewels dryrun → POST /_internal/v2/apps/:appId/jewels/:methodId/dryrun
|
|
297
|
+
*
|
|
298
|
+
* record is the JewelPairRecord from the live jewel's eval run.
|
|
299
|
+
* Dynamic model IO; includes mode, proposed, reasoning, error if any.
|
|
300
|
+
*/
|
|
301
|
+
export interface JewelsDryrunResult {
|
|
302
|
+
record: unknown;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* jewels export (no --file) → GET /_internal/v2/apps/:appId/jewels/export
|
|
306
|
+
*
|
|
307
|
+
* With --file the command uses apiRaw (streaming JSONL) and needs no result type.
|
|
308
|
+
*/
|
|
309
|
+
export interface JewelsExportResult {
|
|
310
|
+
summary: JewelsDatasetSummary;
|
|
311
|
+
}
|
|
312
|
+
/** jewels train → POST /_internal/v2/apps/:appId/jewels/train */
|
|
313
|
+
export interface JewelsTrainResult {
|
|
314
|
+
run: TrainingRunRow;
|
|
315
|
+
/** Dataset report: per-file row counts and every exclusion bucket. */
|
|
316
|
+
summary: Record<string, any>;
|
|
317
|
+
}
|
|
318
|
+
/** jewels runs → GET /_internal/v2/apps/:appId/jewels/training-runs */
|
|
319
|
+
export interface JewelsRunsResult {
|
|
320
|
+
runs: TrainingRunRow[];
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* jewels run <runId> → GET /_internal/v2/apps/:appId/jewels/training-runs/:runId
|
|
324
|
+
*
|
|
325
|
+
* Also used for the --wait polling loop in `jewels train`.
|
|
326
|
+
*/
|
|
327
|
+
export interface JewelsRunResult {
|
|
328
|
+
run: TrainingRunRow;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* jewels grade <runId> →
|
|
332
|
+
* POST /_internal/v2/apps/:appId/jewels/training-runs/:runId/grade
|
|
333
|
+
*/
|
|
334
|
+
export interface JewelsGradeResult {
|
|
335
|
+
grading: JewelsGrading;
|
|
336
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response types for the methods command group.
|
|
3
|
+
*
|
|
4
|
+
* 'methods list' uses DashboardResult from ./releases.ts (both commands call
|
|
5
|
+
* GET /dashboard and read liveRelease).
|
|
6
|
+
*
|
|
7
|
+
* Sources in the api (apps/api/src/):
|
|
8
|
+
* POST /methods/:methodId/invoke
|
|
9
|
+
* → roles/http/routes/Apps/serve/methods/handleInvoke.ts
|
|
10
|
+
* POST /methods/:methodId/invoke-as
|
|
11
|
+
* → roles/http/routes/Apps/manage/invokeMethodAs.ts
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Non-streaming response from POST .../methods/:methodId/invoke and
|
|
15
|
+
* POST .../methods/:methodId/invoke-as.
|
|
16
|
+
*
|
|
17
|
+
* Common fields are present on both routes. Route-specific extras:
|
|
18
|
+
* invoke: $dev is set to true when running against a dev session.
|
|
19
|
+
* invoke-as: $impersonated carries the applied userId / roles.
|
|
20
|
+
*/
|
|
21
|
+
export interface MethodsInvokeResult {
|
|
22
|
+
/** Method return value; shape is method-specific. */
|
|
23
|
+
output: unknown;
|
|
24
|
+
$releaseId: string;
|
|
25
|
+
$methodId: string;
|
|
26
|
+
$durationMs: number;
|
|
27
|
+
/** Present when the invocation ran against a dev release session. */
|
|
28
|
+
$dev?: true;
|
|
29
|
+
/** Present only on invoke-as: the impersonation context that was applied. */
|
|
30
|
+
$impersonated?: {
|
|
31
|
+
userId?: string;
|
|
32
|
+
roles?: string[];
|
|
33
|
+
};
|
|
34
|
+
}
|