@assethub/cli 0.1.29 → 0.1.31
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 +282 -8
- package/dist/appEnv.d.ts +20 -0
- package/dist/appEnv.d.ts.map +1 -0
- package/dist/appEnv.js +62 -0
- package/dist/canvasGraphDownload.d.ts +11 -0
- package/dist/canvasGraphDownload.d.ts.map +1 -0
- package/dist/canvasGraphDownload.js +108 -0
- package/dist/execution.d.ts +5 -2
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +11 -12
- package/dist/hooks/command.d.ts +14 -0
- package/dist/hooks/command.d.ts.map +1 -0
- package/dist/hooks/command.js +178 -0
- package/dist/hooks/graph.d.ts +40 -0
- package/dist/hooks/graph.d.ts.map +1 -0
- package/dist/hooks/graph.js +267 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/install.d.ts +43 -0
- package/dist/hooks/install.d.ts.map +1 -0
- package/dist/hooks/install.js +174 -0
- package/dist/hooks/paths.d.ts +31 -0
- package/dist/hooks/paths.d.ts.map +1 -0
- package/dist/hooks/paths.js +101 -0
- package/dist/hooks/redact.d.ts +5 -0
- package/dist/hooks/redact.d.ts.map +1 -0
- package/dist/hooks/redact.js +67 -0
- package/dist/hooks/save.d.ts +60 -0
- package/dist/hooks/save.d.ts.map +1 -0
- package/dist/hooks/save.js +330 -0
- package/dist/hooks/transcript.d.ts +23 -0
- package/dist/hooks/transcript.d.ts.map +1 -0
- package/dist/hooks/transcript.js +74 -0
- package/dist/hooks/trim.d.ts +15 -0
- package/dist/hooks/trim.d.ts.map +1 -0
- package/dist/hooks/trim.js +108 -0
- package/dist/hooks/types.d.ts +56 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +0 -0
- package/dist/hooks/upload.d.ts +52 -0
- package/dist/hooks/upload.d.ts.map +1 -0
- package/dist/hooks/upload.js +252 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1579 -166
- package/dist/nodeMeshBatch.d.ts.map +1 -1
- package/dist/nodeMeshBatch.js +5 -4
- package/dist/productionBatch.d.ts +77 -0
- package/dist/productionBatch.d.ts.map +1 -0
- package/dist/productionBatch.js +204 -0
- package/dist/runProgress.d.ts +4 -0
- package/dist/runProgress.d.ts.map +1 -0
- package/dist/runProgress.js +16 -0
- package/dist/runsUpload/controlEndpoints.d.ts +1 -1
- package/dist/runsUpload/controlEndpoints.d.ts.map +1 -1
- package/dist/runsUpload/controlEndpoints.js +4 -2
- package/dist/runsUpload/uploadRun.d.ts +7 -1
- package/dist/runsUpload/uploadRun.d.ts.map +1 -1
- package/dist/runsUpload/uploadRun.js +7 -4
- package/dist/setupCommand.d.ts +127 -0
- package/dist/setupCommand.d.ts.map +1 -0
- package/dist/setupCommand.js +534 -0
- package/dist/setupHooksBridge.d.ts +8 -0
- package/dist/setupHooksBridge.d.ts.map +1 -0
- package/dist/setupHooksBridge.js +4 -0
- package/dist/update.d.ts +74 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +205 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeMeshBatch.d.ts","sourceRoot":"","sources":["../src/nodeMeshBatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nodeMeshBatch.d.ts","sourceRoot":"","sources":["../src/nodeMeshBatch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAEjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAGL,eAAe,EAEf,cAAc,EAEf,MAAM,gBAAgB,CAAA;AAEvB,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;AACpD,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,QAAQ,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;IACtD,OAAO,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;IACrD,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,aAAa,EACb,aAAa,GAAG,QAAQ,GAAG,SAAS,CACrC,GAAG;IAAC,UAAU,EAAE,eAAe,EAAE,CAAA;CAAC,CAAA;AAwDnC,eAAO,MAAM,oBAAoB,GAC/B,SAAS,OAAO,EAChB,OAAO,IAAI,CACT,aAAa,EACb,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAChD,GAAG;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAC,KACvB,OAAO,CAAC,mBAAmB,CAwC7B,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,KAC5C,OAAO,CAAC,mBAAmB,GAAG,SAAS,CA0DzC,CAAA"}
|
package/dist/nodeMeshBatch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { childOperationId } from '@assethub/api-client';
|
|
1
2
|
import { join } from 'node:path';
|
|
2
3
|
import { readState, writeState } from './canvas.js';
|
|
3
|
-
import { activeExecution,
|
|
4
|
+
import { activeExecution, CliExecutionError, executeRecorded, openExecutionSession, resumeRecorded, hasRecordedOperation, } from './execution.js';
|
|
4
5
|
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
5
6
|
const batchPath = (stateDir, id) => {
|
|
6
7
|
if (!uuid.test(id))
|
|
@@ -46,10 +47,10 @@ export const executeNodeMeshBatch = async (session, input) => {
|
|
|
46
47
|
baseUrl: session.baseUrl,
|
|
47
48
|
ownerId: session.ownerId,
|
|
48
49
|
canvasId: session.canvas.id,
|
|
49
|
-
children: input.children.map(nodeId => ({
|
|
50
|
+
children: await Promise.all(input.children.map(async (nodeId) => ({
|
|
50
51
|
nodeId,
|
|
51
|
-
operationId: childOperationId(input.operationId, nodeId),
|
|
52
|
-
})),
|
|
52
|
+
operationId: await childOperationId(input.operationId, nodeId),
|
|
53
|
+
}))),
|
|
53
54
|
}));
|
|
54
55
|
const path = batchPath(session.stateDir, batch.operationId);
|
|
55
56
|
// Pin the entire target set before any paid dispatch. Per-child receipts retain
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type CanvasExecution, type ExecutionContext } from '@assethub/api-client';
|
|
2
|
+
import { executeRecorded } from './execution.js';
|
|
3
|
+
type Session = Parameters<typeof executeRecorded>[0];
|
|
4
|
+
export type ProductionBatchItem = {
|
|
5
|
+
key: string;
|
|
6
|
+
/** Where the image came from (file name, asset ID or URL). */
|
|
7
|
+
label: string;
|
|
8
|
+
imageIndex: number;
|
|
9
|
+
repeat: number;
|
|
10
|
+
/** A `production.analyze` body without its executionContext. */
|
|
11
|
+
body: Record<string, unknown>;
|
|
12
|
+
/** The attempt key to send next; see `dispatchProductionBatch`. */
|
|
13
|
+
attempt: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pinned before the first paid request: the uploaded sources and every item's
|
|
17
|
+
* body. Rerunning with the operation ID resumes these items instead of
|
|
18
|
+
* uploading and starting again.
|
|
19
|
+
*/
|
|
20
|
+
type ProductionBatchState = {
|
|
21
|
+
version: 1;
|
|
22
|
+
operationId: string;
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
ownerId: string;
|
|
25
|
+
canvasId: number;
|
|
26
|
+
/** The command's inputs as typed; a rerun must match them. */
|
|
27
|
+
request: unknown;
|
|
28
|
+
items: ProductionBatchItem[];
|
|
29
|
+
};
|
|
30
|
+
export type ProductionBatchItemResult = {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
imageIndex: number;
|
|
34
|
+
repeat: number;
|
|
35
|
+
/** Absent while `pending`. */
|
|
36
|
+
operationId?: string;
|
|
37
|
+
attempt: number;
|
|
38
|
+
/** `pending`: the wait ended before this item was started. */
|
|
39
|
+
status: 'pending' | 'dispatched' | 'deferred' | 'failed' | CanvasExecution['status'];
|
|
40
|
+
runId?: string;
|
|
41
|
+
execution?: CanvasExecution;
|
|
42
|
+
reason?: string;
|
|
43
|
+
code?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
};
|
|
46
|
+
export type ProductionBatchSource = {
|
|
47
|
+
flag: 'file' | 'source-id' | 'source-url';
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* One distinct label per image: it names the order and the download folder, so
|
|
52
|
+
* two images must never share one. Files that share a name get their folder.
|
|
53
|
+
*/
|
|
54
|
+
export declare const productionBatchLabels: (sources: readonly ProductionBatchSource[]) => string[];
|
|
55
|
+
export declare const readProductionBatch: (stateDir: string, operationId: string) => Promise<ProductionBatchState | undefined>;
|
|
56
|
+
export declare const runProductionBatch: (session: Session, options: {
|
|
57
|
+
operationId: string;
|
|
58
|
+
request: unknown;
|
|
59
|
+
/** Resolves sources (uploads) and builds the items; skipped on resume. */
|
|
60
|
+
buildItems: () => Promise<ProductionBatchItem[]>;
|
|
61
|
+
agent?: ExecutionContext["agent"];
|
|
62
|
+
parentRunId?: string;
|
|
63
|
+
/** With `wait`, at most `concurrency` of this batch's runs are unfinished at once. */
|
|
64
|
+
wait?: {
|
|
65
|
+
concurrency: number;
|
|
66
|
+
intervalMs: number;
|
|
67
|
+
timeoutMs: number;
|
|
68
|
+
onProgress?: (item: ProductionBatchItemResult) => void;
|
|
69
|
+
};
|
|
70
|
+
}) => Promise<{
|
|
71
|
+
batchOperationId: string;
|
|
72
|
+
canvasId: number;
|
|
73
|
+
items: ProductionBatchItemResult[];
|
|
74
|
+
timedOut: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=productionBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productionBatch.d.ts","sourceRoot":"","sources":["../src/productionBatch.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAkB,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAG/D,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,CAAC,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,mBAAmB,EAAE,CAAA;CAC7B,CAAA;AAED,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U,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,yBAAyB,KAAK,IAAI,CAAA;KACvD,CAAA;CACF,KACA,OAAO,CAAC;IACT,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,yBAAyB,EAAE,CAAA;IAClC,QAAQ,EAAE,OAAO,CAAA;CAClB,CA2JA,CAAA"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { basename, dirname, extname, join } from 'node:path';
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
4
|
+
import { dispatchProductionBatch, } from '@assethub/api-client';
|
|
5
|
+
import { readState, writeState } from './canvas.js';
|
|
6
|
+
import { activeExecution, executeRecorded } from './execution.js';
|
|
7
|
+
import { runProgressLine } from './runProgress.js';
|
|
8
|
+
const stem = (path) => basename(path, extname(path));
|
|
9
|
+
const safeLabel = (label) => label.replace(/[^\w.-]+/g, '_');
|
|
10
|
+
/**
|
|
11
|
+
* One distinct label per image: it names the order and the download folder, so
|
|
12
|
+
* two images must never share one. Files that share a name get their folder.
|
|
13
|
+
*/
|
|
14
|
+
export const productionBatchLabels = (sources) => {
|
|
15
|
+
const base = sources.map(({ flag, value }) => flag === 'file'
|
|
16
|
+
? stem(value)
|
|
17
|
+
: flag === 'source-url'
|
|
18
|
+
? stem(new URL(value).pathname) || value
|
|
19
|
+
: value);
|
|
20
|
+
const count = (labels, label) => labels.filter(entry => entry === label).length;
|
|
21
|
+
const withFolder = base.map((label, index) => {
|
|
22
|
+
const { flag, value } = sources[index];
|
|
23
|
+
return count(base, label) > 1 && flag === 'file'
|
|
24
|
+
? `${basename(dirname(value))}-${label}`
|
|
25
|
+
: label;
|
|
26
|
+
});
|
|
27
|
+
return withFolder
|
|
28
|
+
.map((label, index) => count(withFolder, label) > 1
|
|
29
|
+
? `${label}-${withFolder.slice(0, index + 1).filter(entry => entry === label).length}`
|
|
30
|
+
: label)
|
|
31
|
+
.map(safeLabel);
|
|
32
|
+
};
|
|
33
|
+
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
34
|
+
const statePath = (stateDir, operationId) => {
|
|
35
|
+
if (!uuid.test(operationId))
|
|
36
|
+
throw new Error('Operation ID must be a UUID');
|
|
37
|
+
return join(stateDir, 'production-batches', `${operationId}.json`);
|
|
38
|
+
};
|
|
39
|
+
export const readProductionBatch = async (stateDir, operationId) => {
|
|
40
|
+
const state = (await readState(statePath(stateDir, operationId)));
|
|
41
|
+
if (state === undefined)
|
|
42
|
+
return undefined;
|
|
43
|
+
if (!state ||
|
|
44
|
+
state.version !== 1 ||
|
|
45
|
+
state.operationId !== operationId ||
|
|
46
|
+
typeof state.baseUrl !== 'string' ||
|
|
47
|
+
typeof state.ownerId !== 'string' ||
|
|
48
|
+
!Number.isSafeInteger(state.canvasId) ||
|
|
49
|
+
!Array.isArray(state.items) ||
|
|
50
|
+
!state.items.every(item => item &&
|
|
51
|
+
typeof item.key === 'string' &&
|
|
52
|
+
Number.isSafeInteger(item.attempt) &&
|
|
53
|
+
item.body &&
|
|
54
|
+
typeof item.body === 'object'))
|
|
55
|
+
throw new Error('Invalid saved production batch');
|
|
56
|
+
return state;
|
|
57
|
+
};
|
|
58
|
+
const isTerminal = (execution) => execution.status === 'needs_review' ||
|
|
59
|
+
(!['queued', 'running'].includes(execution.status) &&
|
|
60
|
+
execution.history.status === 'recorded');
|
|
61
|
+
export const runProductionBatch = async (session, options) => {
|
|
62
|
+
const path = statePath(session.stateDir, options.operationId);
|
|
63
|
+
let state = await readProductionBatch(session.stateDir, options.operationId);
|
|
64
|
+
if (state) {
|
|
65
|
+
if (state.baseUrl !== session.baseUrl)
|
|
66
|
+
throw new Error('Saved batch belongs to a different API origin');
|
|
67
|
+
if (state.ownerId !== session.ownerId)
|
|
68
|
+
throw new Error('Saved batch belongs to a different organization');
|
|
69
|
+
if (state.canvasId !== session.canvas.id)
|
|
70
|
+
throw new Error('Saved batch belongs to a different canvas');
|
|
71
|
+
if (!isDeepStrictEqual(state.request, JSON.parse(JSON.stringify(options.request))))
|
|
72
|
+
throw new Error('Operation ID already belongs to a batch with different inputs; rerun it with the same inputs or use a new operation ID');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
state = JSON.parse(JSON.stringify({
|
|
76
|
+
version: 1,
|
|
77
|
+
operationId: options.operationId,
|
|
78
|
+
baseUrl: session.baseUrl,
|
|
79
|
+
ownerId: session.ownerId,
|
|
80
|
+
canvasId: session.canvas.id,
|
|
81
|
+
request: options.request,
|
|
82
|
+
items: await options.buildItems(),
|
|
83
|
+
}));
|
|
84
|
+
await writeState(path, state, { exclusive: true });
|
|
85
|
+
}
|
|
86
|
+
const saved = state;
|
|
87
|
+
activeExecution.batchOperationId = saved.operationId;
|
|
88
|
+
// Workers persist attempts concurrently; write the whole state in order.
|
|
89
|
+
let writes = Promise.resolve();
|
|
90
|
+
const persistAttempt = (key, attempt) => {
|
|
91
|
+
const item = saved.items.find(entry => entry.key === key);
|
|
92
|
+
if (item.attempt === attempt)
|
|
93
|
+
return writes;
|
|
94
|
+
item.attempt = attempt;
|
|
95
|
+
writes = writes.then(() => writeState(path, saved));
|
|
96
|
+
return writes;
|
|
97
|
+
};
|
|
98
|
+
const dispatch = (items, concurrency) => dispatchProductionBatch({
|
|
99
|
+
batchOperationId: saved.operationId,
|
|
100
|
+
items,
|
|
101
|
+
concurrency,
|
|
102
|
+
// Attempts are saved, so a rerun never has to walk past spent keys.
|
|
103
|
+
maxAttempts: 1_000,
|
|
104
|
+
onAttempt: persistAttempt,
|
|
105
|
+
dispatch: ({ key, operationId }) => executeRecorded(session, 'production.analyze', saved.items.find(item => item.key === key).body, { operationId, agent: options.agent, parentRunId: options.parentRunId }),
|
|
106
|
+
});
|
|
107
|
+
const results = new Map();
|
|
108
|
+
const record = (item, outcome) => {
|
|
109
|
+
const { key, label, imageIndex, repeat } = item;
|
|
110
|
+
const base = { key, label, imageIndex, repeat, operationId: outcome.operationId, attempt: outcome.attempt };
|
|
111
|
+
const result = outcome.status === 'dispatched'
|
|
112
|
+
? {
|
|
113
|
+
...base,
|
|
114
|
+
status: 'dispatched',
|
|
115
|
+
runId: outcome.result.execution.runId,
|
|
116
|
+
execution: outcome.result.execution,
|
|
117
|
+
}
|
|
118
|
+
: outcome.status === 'deferred'
|
|
119
|
+
? { ...base, status: 'deferred', reason: outcome.reason, message: outcome.message }
|
|
120
|
+
: { ...base, status: 'failed', ...(outcome.code ? { code: outcome.code } : {}), message: outcome.message };
|
|
121
|
+
results.set(key, result);
|
|
122
|
+
options.wait?.onProgress?.(result);
|
|
123
|
+
return result;
|
|
124
|
+
};
|
|
125
|
+
let timedOut = false;
|
|
126
|
+
if (!options.wait) {
|
|
127
|
+
const outcomes = await dispatch(saved.items, 4);
|
|
128
|
+
outcomes.forEach((outcome, index) => record(saved.items[index], outcome));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const { concurrency, intervalMs, timeoutMs } = options.wait;
|
|
132
|
+
const deadline = Date.now() + timeoutMs;
|
|
133
|
+
const queue = [...saved.items];
|
|
134
|
+
const running = new Map();
|
|
135
|
+
let blockedUntil = 0;
|
|
136
|
+
while (queue.length > 0 || running.size > 0) {
|
|
137
|
+
while (running.size < concurrency && queue.length > 0 && Date.now() >= blockedUntil) {
|
|
138
|
+
const item = queue.shift();
|
|
139
|
+
const [outcome] = await dispatch([item], 1);
|
|
140
|
+
const result = record(item, outcome);
|
|
141
|
+
if (result.status === 'dispatched') {
|
|
142
|
+
if (isTerminal(result.execution)) {
|
|
143
|
+
results.set(item.key, { ...result, status: result.execution.status });
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
running.set(item.key, { runId: result.runId, readErrors: 0 });
|
|
147
|
+
}
|
|
148
|
+
else if (result.status === 'deferred') {
|
|
149
|
+
queue.unshift(item);
|
|
150
|
+
// Retry once one of our runs finishes, or after a pause if none runs.
|
|
151
|
+
blockedUntil = running.size > 0 ? Infinity : Date.now() + intervalMs * 6;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (queue.length === 0 && running.size === 0)
|
|
155
|
+
break;
|
|
156
|
+
if (Date.now() >= deadline) {
|
|
157
|
+
timedOut = true;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
await delay(intervalMs);
|
|
161
|
+
for (const [key, entry] of running) {
|
|
162
|
+
// A transient read error must not abort the batch; give up after 5 in a row.
|
|
163
|
+
let execution;
|
|
164
|
+
try {
|
|
165
|
+
execution = await session.client.v2.getRun(entry.runId);
|
|
166
|
+
entry.readErrors = 0;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (++entry.readErrors >= 5)
|
|
170
|
+
throw error;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
const previous = results.get(key);
|
|
174
|
+
const next = { ...previous, execution, status: isTerminal(execution) ? execution.status : 'dispatched' };
|
|
175
|
+
// Report status changes and, while it runs, each new progress step.
|
|
176
|
+
if (previous.execution?.status !== execution.status ||
|
|
177
|
+
(previous.execution && runProgressLine(previous.execution) !== runProgressLine(execution)))
|
|
178
|
+
options.wait.onProgress?.(next);
|
|
179
|
+
results.set(key, next);
|
|
180
|
+
if (isTerminal(execution)) {
|
|
181
|
+
running.delete(key);
|
|
182
|
+
if (blockedUntil === Infinity)
|
|
183
|
+
blockedUntil = 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (blockedUntil === Infinity && running.size === 0)
|
|
187
|
+
blockedUntil = 0;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
await writes;
|
|
191
|
+
return {
|
|
192
|
+
batchOperationId: saved.operationId,
|
|
193
|
+
canvasId: saved.canvasId,
|
|
194
|
+
items: saved.items.map(item => results.get(item.key) ?? {
|
|
195
|
+
key: item.key,
|
|
196
|
+
label: item.label,
|
|
197
|
+
imageIndex: item.imageIndex,
|
|
198
|
+
repeat: item.repeat,
|
|
199
|
+
attempt: item.attempt,
|
|
200
|
+
status: 'pending',
|
|
201
|
+
}),
|
|
202
|
+
timedOut,
|
|
203
|
+
};
|
|
204
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runProgress.d.ts","sourceRoot":"","sources":["../src/runProgress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AAEzD,yEAAyE;AACzE,eAAO,MAAM,eAAe,GAAI,WAAW,eAAe,KAAG,MAa5D,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// A run's `progress` (V4 Character Assembly runs) as one line for `runs watch`
|
|
2
|
+
// and `--wait`: the step, where it is, and how many parts are busy. PURE.
|
|
3
|
+
/** The run's status, or for a run with progress its one-line summary. */
|
|
4
|
+
export const runProgressLine = (execution) => {
|
|
5
|
+
const progress = execution.progress;
|
|
6
|
+
if (!progress)
|
|
7
|
+
return execution.status;
|
|
8
|
+
const counts = new Map();
|
|
9
|
+
for (const part of progress.parts)
|
|
10
|
+
if (part.state !== 'ready' && part.state !== 'waiting')
|
|
11
|
+
counts.set(part.stateText, (counts.get(part.stateText) ?? 0) + 1);
|
|
12
|
+
const busy = [...counts].map(([text, count]) => `${count} ${text.toLowerCase()}`);
|
|
13
|
+
return busy.length
|
|
14
|
+
? `${progress.summary} · ${busy.join(', ')}`
|
|
15
|
+
: progress.summary;
|
|
16
|
+
};
|
|
@@ -24,7 +24,7 @@ export type ControlRunUploadUrls = {
|
|
|
24
24
|
/** HEAD (does the pool already hold these bytes?) / PUT (send them). */
|
|
25
25
|
blob: (graphId: string, blobKey: string) => string;
|
|
26
26
|
};
|
|
27
|
-
export declare const controlRunUploadUrls: (baseUrl: string) => ControlRunUploadUrls;
|
|
27
|
+
export declare const controlRunUploadUrls: (baseUrl: string, apiPrefix?: string) => ControlRunUploadUrls;
|
|
28
28
|
/**
|
|
29
29
|
* Server-enforced ceilings, checked locally so a doomed run is rejected before
|
|
30
30
|
* the first byte leaves rather than after N blobs have already landed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlEndpoints.d.ts","sourceRoot":"","sources":["../../src/runsUpload/controlEndpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uEAAuE;AACvE,eAAO,MAAM,6BAA6B,mCAAmC,CAAA;AAI7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACrC,wEAAwE;IACxE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"controlEndpoints.d.ts","sourceRoot":"","sources":["../../src/runsUpload/controlEndpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uEAAuE;AACvE,eAAO,MAAM,6BAA6B,mCAAmC,CAAA;AAI7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACrC,wEAAwE;IACxE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,YAAW,MAAsC,KAChD,oBAYF,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAAkB,CAAA;AACrD,eAAO,MAAM,sBAAsB,QAAkB,CAAA;AAErD,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,QAAkB,CAAA;AAC1D,eAAO,MAAM,8BAA8B,QAAmB,CAAA;AAC9D,eAAO,MAAM,2BAA2B,QAAa,CAAA;AAErD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAC9B,sEAAsE;;IAEtE,iEAAiE;;IAEjE,oFAAoF;;;IAGpF,mFAAmF;;CAE3E,CAAA;AAEV;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAA"}
|
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
/** Change this one line if the backend lands on a different prefix. */
|
|
18
18
|
export const CONTROL_RUN_UPLOAD_API_PREFIX = '/api/v2/production/run-uploads';
|
|
19
19
|
const trimTrailingSlash = (value) => value.replace(/\/+$/, '');
|
|
20
|
-
export const controlRunUploadUrls = (baseUrl) => {
|
|
20
|
+
export const controlRunUploadUrls = (baseUrl, apiPrefix = CONTROL_RUN_UPLOAD_API_PREFIX) => {
|
|
21
21
|
// Matches @assethub/api-client's own URL construction: trim the trailing
|
|
22
22
|
// slash and append, so a base URL carrying a path prefix keeps it.
|
|
23
|
-
|
|
23
|
+
// `apiPrefix` lets another store with the same wire contract (coding-agent
|
|
24
|
+
// sessions) reuse this upload loop.
|
|
25
|
+
const prefix = `${trimTrailingSlash(baseUrl)}${apiPrefix}`;
|
|
24
26
|
return {
|
|
25
27
|
graphs: `${prefix}/graphs`,
|
|
26
28
|
snapshot: graphId => `${prefix}/graphs/${encodeURIComponent(graphId)}/snapshot`,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ControlRunUploadUrls } from './controlEndpoints.js';
|
|
1
2
|
import { type PlannedBlob, type RunUploadPlan } from './buildRunUpload.js';
|
|
2
3
|
export type RunUploadProgressEvent = {
|
|
3
4
|
kind: 'register';
|
|
@@ -35,10 +36,15 @@ export type UploadRunInput = {
|
|
|
35
36
|
plan: RunUploadPlan;
|
|
36
37
|
baseUrl: string;
|
|
37
38
|
apiKey: string;
|
|
39
|
+
/** Sent as X-AssetHub-Workspace; a personal key is refused without it. */
|
|
38
40
|
workspaceId?: string;
|
|
39
41
|
fetchImpl?: typeof fetch;
|
|
40
42
|
skipRegister?: boolean;
|
|
41
43
|
onProgress?: (event: RunUploadProgressEvent) => void;
|
|
44
|
+
/** Upload to another store with the same contract. Defaults to Production Control. */
|
|
45
|
+
urls?: ControlRunUploadUrls;
|
|
46
|
+
/** Extra top-level fields for the registration body (e.g. `session`). */
|
|
47
|
+
registrationExtra?: Record<string, unknown>;
|
|
42
48
|
};
|
|
43
|
-
export declare const uploadRun: ({ plan, baseUrl, apiKey, workspaceId, fetchImpl, skipRegister, onProgress, }: UploadRunInput) => Promise<RunUploadResult>;
|
|
49
|
+
export declare const uploadRun: ({ plan, baseUrl, apiKey, workspaceId, fetchImpl, skipRegister, onProgress, urls, registrationExtra, }: UploadRunInput) => Promise<RunUploadResult>;
|
|
44
50
|
//# sourceMappingURL=uploadRun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadRun.d.ts","sourceRoot":"","sources":["../../src/runsUpload/uploadRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uploadRun.d.ts","sourceRoot":"","sources":["../../src/runsUpload/uploadRun.ts"],"names":[],"mappings":"AAmBA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAGrF,MAAM,MAAM,sBAAsB,GAC9B;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACnC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;CAAC,GAC/F;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,OAAO,CAAA;IAC3C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAA;IACpD,sFAAsF;IACtF,IAAI,CAAC,EAAE,oBAAoB,CAAA;IAC3B,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,SAAS,GAAU,uGAU7B,cAAc,KAAG,OAAO,CAAC,eAAe,CA6F1C,CAAA"}
|
|
@@ -17,17 +17,20 @@ import { readFile } from 'node:fs/promises';
|
|
|
17
17
|
import { createHash } from 'node:crypto';
|
|
18
18
|
import { CONTROL_ERROR_CODES, CONTROL_NOT_ENTITLED_STATUS, controlRunUploadUrls, } from './controlEndpoints.js';
|
|
19
19
|
import { RunUploadError } from './runUploadError.js';
|
|
20
|
-
export const uploadRun = async ({ plan, baseUrl, apiKey, workspaceId, fetchImpl = globalThis.fetch.bind(globalThis), skipRegister = false, onProgress = () => { }, }) => {
|
|
21
|
-
const urls = controlRunUploadUrls(baseUrl);
|
|
20
|
+
export const uploadRun = async ({ plan, baseUrl, apiKey, workspaceId, fetchImpl = globalThis.fetch.bind(globalThis), skipRegister = false, onProgress = () => { }, urls = controlRunUploadUrls(baseUrl), registrationExtra, }) => {
|
|
22
21
|
// Built once, never logged, never placed in a URL or a query string.
|
|
23
|
-
const authHeaders = {
|
|
22
|
+
const authHeaders = {
|
|
23
|
+
authorization: `Bearer ${apiKey}`,
|
|
24
|
+
...(workspaceId ? { 'x-assethub-workspace': workspaceId } : {}),
|
|
25
|
+
};
|
|
24
26
|
let registered = false;
|
|
25
27
|
if (!skipRegister) {
|
|
26
28
|
onProgress({ kind: 'register', graphId: plan.graphId });
|
|
27
29
|
await request(fetchImpl, urls.graphs, {
|
|
28
30
|
method: 'POST',
|
|
29
31
|
headers: { ...authHeaders, 'content-type': 'application/json' },
|
|
30
|
-
|
|
32
|
+
// Extra fields may add to the registration, never replace what the plan registers.
|
|
33
|
+
body: JSON.stringify({ ...registrationExtra, ...plan.registration }),
|
|
31
34
|
});
|
|
32
35
|
registered = true;
|
|
33
36
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { API_KEY_ENV } from './appEnv.js';
|
|
2
|
+
import type { InstallHooks } from './setupHooksBridge.js';
|
|
3
|
+
export type StepStatus = 'ok' | 'fail' | 'skip';
|
|
4
|
+
export type SetupStep = {
|
|
5
|
+
name: string;
|
|
6
|
+
status: StepStatus;
|
|
7
|
+
detail: string;
|
|
8
|
+
};
|
|
9
|
+
export type SetupResult = {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
dryRun: boolean;
|
|
12
|
+
profile: string;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
workspaceId?: string;
|
|
15
|
+
steps: SetupStep[];
|
|
16
|
+
nextStep: string;
|
|
17
|
+
exportLine?: string;
|
|
18
|
+
};
|
|
19
|
+
export type SetupOptions = {
|
|
20
|
+
client: 'claude' | 'codex' | 'both';
|
|
21
|
+
workspace?: string;
|
|
22
|
+
apiKeyStdin: boolean;
|
|
23
|
+
/** An API key given as --api-key (always wins) or found in ASSETHUB_API_KEY (used when no saved key works). */
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
apiKeySource?: 'flag' | 'env';
|
|
26
|
+
noHook: boolean;
|
|
27
|
+
/** `--no-app-env`: leave launchd alone even on macOS. */
|
|
28
|
+
noAppEnv?: boolean;
|
|
29
|
+
/** Explicit consent to record and upload agent sessions (`--save-sessions`). */
|
|
30
|
+
saveSessions: boolean;
|
|
31
|
+
dryRun: boolean;
|
|
32
|
+
yes: boolean;
|
|
33
|
+
printEnv: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type SetupAuth = {
|
|
36
|
+
apiKey: string;
|
|
37
|
+
baseUrl: string;
|
|
38
|
+
profile: string;
|
|
39
|
+
workspaceId?: string;
|
|
40
|
+
};
|
|
41
|
+
export type SetupWorkspace = {
|
|
42
|
+
id: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
};
|
|
45
|
+
type DoctorReport = {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
checks: {
|
|
48
|
+
name: string;
|
|
49
|
+
status: string;
|
|
50
|
+
message?: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
export type SetupDeps = {
|
|
54
|
+
interactive: boolean;
|
|
55
|
+
installHooks: InstallHooks;
|
|
56
|
+
codexHome: string;
|
|
57
|
+
now: () => Date;
|
|
58
|
+
hasWorkingKey: () => Promise<boolean>;
|
|
59
|
+
login: (input: {
|
|
60
|
+
apiKey?: string;
|
|
61
|
+
}) => Promise<void>;
|
|
62
|
+
promptApiKey: () => Promise<string>;
|
|
63
|
+
resolveAuth: () => Promise<SetupAuth>;
|
|
64
|
+
discoverWorkspace: (auth: SetupAuth) => Promise<string | undefined>;
|
|
65
|
+
useWorkspace: (id: string) => Promise<void>;
|
|
66
|
+
listWorkspaces: () => Promise<SetupWorkspace[]>;
|
|
67
|
+
pickWorkspace: (items: SetupWorkspace[]) => Promise<string>;
|
|
68
|
+
confirm: (question: string) => Promise<boolean>;
|
|
69
|
+
/** Opt-in question that defaults to no. */
|
|
70
|
+
confirmOptIn: (question: string) => Promise<boolean>;
|
|
71
|
+
/** Whether this login may save and upload coding-agent sessions (internal accounts for now). */
|
|
72
|
+
canSaveSessions: (auth: SetupAuth) => Promise<boolean>;
|
|
73
|
+
diagnose: () => Promise<DoctorReport>;
|
|
74
|
+
findBinary: (name: string) => Promise<string | undefined>;
|
|
75
|
+
run: (file: string, args: string[]) => Promise<{
|
|
76
|
+
code: number;
|
|
77
|
+
output: string;
|
|
78
|
+
}>;
|
|
79
|
+
readFileIfExists: (path: string) => Promise<string | undefined>;
|
|
80
|
+
writeFileEnsuringDir: (path: string, content: string) => Promise<void>;
|
|
81
|
+
backupFile: (from: string, to: string) => Promise<void>;
|
|
82
|
+
log: (line: string) => void;
|
|
83
|
+
platform: NodeJS.Platform;
|
|
84
|
+
home: string;
|
|
85
|
+
/** argv the macOS LaunchAgent runs at login: node, this CLI, `env load --profile <name>`. */
|
|
86
|
+
launchAgentProgram: string[];
|
|
87
|
+
};
|
|
88
|
+
export declare const redactKey: (key: string) => string;
|
|
89
|
+
export declare const mergeCodexSection: (existing: string, section: string) => string;
|
|
90
|
+
export declare const extractCodexSection: (content: string) => string;
|
|
91
|
+
export { API_KEY_ENV };
|
|
92
|
+
export declare const claudeServerConfig: (baseUrl: string, workspaceId?: string) => {
|
|
93
|
+
type: string;
|
|
94
|
+
url: string;
|
|
95
|
+
headers: {
|
|
96
|
+
'X-AssetHub-Workspace'?: string | undefined;
|
|
97
|
+
Authorization: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export declare const claudeAddArgs: (baseUrl: string, workspaceId?: string) => string[];
|
|
101
|
+
export declare const runSetup: (options: SetupOptions, deps: SetupDeps) => Promise<SetupResult>;
|
|
102
|
+
export declare const formatSetupSummary: (result: SetupResult) => string;
|
|
103
|
+
export declare const findOnPath: (name: string, pathValue?: string) => Promise<string | undefined>;
|
|
104
|
+
export declare const runProcess: (file: string, args: string[]) => Promise<{
|
|
105
|
+
code: number;
|
|
106
|
+
output: string;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const defaultFileDeps: () => {
|
|
109
|
+
platform: NodeJS.Platform;
|
|
110
|
+
home: string;
|
|
111
|
+
codexHome: string;
|
|
112
|
+
now: () => Date;
|
|
113
|
+
findBinary: (name: string) => Promise<string | undefined>;
|
|
114
|
+
run: (file: string, args: string[]) => Promise<{
|
|
115
|
+
code: number;
|
|
116
|
+
output: string;
|
|
117
|
+
}>;
|
|
118
|
+
readFileIfExists: (path: string) => Promise<string | undefined>;
|
|
119
|
+
writeFileEnsuringDir: (path: string, content: string) => Promise<void>;
|
|
120
|
+
backupFile: (from: string, to: string) => Promise<void>;
|
|
121
|
+
};
|
|
122
|
+
export declare const promptLine: (question: string) => Promise<string>;
|
|
123
|
+
export declare const promptHidden: (question: string) => Promise<string>;
|
|
124
|
+
export declare const pickFromList: (items: SetupWorkspace[]) => Promise<string>;
|
|
125
|
+
export declare const confirmYes: (question: string) => Promise<boolean>;
|
|
126
|
+
export declare const confirmNo: (question: string) => Promise<boolean>;
|
|
127
|
+
//# sourceMappingURL=setupCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupCommand.d.ts","sourceRoot":"","sources":["../src/setupCommand.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAwE,MAAM,aAAa,CAAA;AAG9G,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAEvD,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAC/C,MAAM,MAAM,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