orizu 0.5.42 → 0.5.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-directory.d.ts.map +1 -1
- package/dist/account-directory.js +4 -22
- package/dist/artifact-archive.d.ts.map +1 -1
- package/dist/artifact-archive.js +2 -0
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +2 -0
- package/dist/hosted-boot.d.ts.map +1 -1
- package/dist/hosted-boot.js +44 -7
- package/dist/hosted-live-channel.d.ts +6 -0
- package/dist/hosted-live-channel.d.ts.map +1 -1
- package/dist/hosted-live-channel.js +27 -10
- package/dist/hosted-loop.d.ts +8 -1
- package/dist/hosted-loop.d.ts.map +1 -1
- package/dist/hosted-loop.js +27 -0
- package/dist/hosted-run-event-sink.d.ts +16 -0
- package/dist/hosted-run-event-sink.d.ts.map +1 -1
- package/dist/hosted-run-event-sink.js +102 -3
- package/dist/hosted-session-seed.d.ts +38 -0
- package/dist/hosted-session-seed.d.ts.map +1 -1
- package/dist/hosted-session-seed.js +69 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/repository-backup-core.d.ts.map +1 -1
- package/dist/repository-backup-core.js +2 -0
- package/dist/request-outcome.d.ts +5 -0
- package/dist/request-outcome.d.ts.map +1 -0
- package/dist/request-outcome.js +27 -0
- package/dist/score-save-workflow.d.ts +26 -0
- package/dist/score-save-workflow.d.ts.map +1 -0
- package/dist/score-save-workflow.js +120 -0
- package/dist/skill-installer.d.ts.map +1 -1
- package/dist/skill-installer.js +2 -0
- package/dist/team-create-workflow.d.ts.map +1 -1
- package/dist/team-create-workflow.js +2 -25
- package/dist/team-member-change-workflow.d.ts +25 -0
- package/dist/team-member-change-workflow.d.ts.map +1 -0
- package/dist/team-member-change-workflow.js +132 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +2 -0
- package/package.json +1 -1
- package/src/account-directory.ts +4 -31
- package/src/artifact-archive.ts +2 -0
- package/src/credentials.ts +2 -0
- package/src/hosted-boot.ts +45 -7
- package/src/hosted-live-channel.ts +31 -0
- package/src/hosted-loop.ts +34 -0
- package/src/hosted-run-event-sink.ts +111 -3
- package/src/hosted-session-seed.ts +83 -0
- package/src/index.ts +17 -21
- package/src/repository-backup-core.ts +2 -0
- package/src/request-outcome.ts +28 -0
- package/src/score-save-workflow.ts +132 -0
- package/src/skill-installer.ts +2 -0
- package/src/team-create-workflow.ts +2 -25
- package/src/team-member-change-workflow.ts +146 -0
- package/src/workspace.ts +2 -0
|
@@ -43,5 +43,43 @@ export interface SeedSessionCopyInput {
|
|
|
43
43
|
export declare function seedSessionCopy(input: SeedSessionCopyInput): Promise<{
|
|
44
44
|
seeded: boolean;
|
|
45
45
|
}>;
|
|
46
|
+
type SeedExecAsync = (cmd: string, args: string[], opts?: {
|
|
47
|
+
cwd?: string;
|
|
48
|
+
}) => Promise<SeedExecResult>;
|
|
49
|
+
export interface CloneTeamIntoWorkTreeInput {
|
|
50
|
+
exec: SeedExec;
|
|
51
|
+
/** Runs a command without blocking, so the check, the clone and the push
|
|
52
|
+
* can overlap with each other and with the rest of the boot. */
|
|
53
|
+
execAsync: SeedExecAsync;
|
|
54
|
+
sessionRemote: string;
|
|
55
|
+
sessionGitConfig: string[];
|
|
56
|
+
resolveTeam: () => Promise<{
|
|
57
|
+
remote: string;
|
|
58
|
+
gitConfig: string[];
|
|
59
|
+
}>;
|
|
60
|
+
/** A path owned only by this clone; cleared before and after use. */
|
|
61
|
+
scratchDir: string;
|
|
62
|
+
/** The boot's working folder: absent or empty. */
|
|
63
|
+
workTree: string;
|
|
64
|
+
}
|
|
65
|
+
export type CloneTeamIntoWorkTreeResult = {
|
|
66
|
+
cloned: false;
|
|
67
|
+
}
|
|
68
|
+
/** `filled` settles once the background push into the session copy ends:
|
|
69
|
+
* true when the copy now has main. It never rejects. */
|
|
70
|
+
| {
|
|
71
|
+
cloned: true;
|
|
72
|
+
filled: Promise<boolean>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* ORI-2512: a team boot of an empty session copy makes its working folder
|
|
76
|
+
* from ONE clone of the team copy, with the session copy as its push remote,
|
|
77
|
+
* and fills the session copy by pushing in the background. The session copy
|
|
78
|
+
* is checked at the same time as the clone; a copy that already has branches
|
|
79
|
+
* belongs to an earlier boot of this session, so the clone is dropped and the
|
|
80
|
+
* caller clones the session copy as usual. The clone keeps the whole history:
|
|
81
|
+
* an empty copy refuses a push from a shallow clone.
|
|
82
|
+
*/
|
|
83
|
+
export declare function cloneTeamIntoWorkTree(input: CloneTeamIntoWorkTreeInput): Promise<CloneTeamIntoWorkTreeResult>;
|
|
46
84
|
export {};
|
|
47
85
|
//# sourceMappingURL=hosted-session-seed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-session-seed.d.ts","sourceRoot":"","sources":["../src/hosted-session-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,yBAAyB,wDAAwD,CAAA;AAE9F,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AACD,KAAK,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,cAAc,CAAA;AAExF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B;mFAC+E;IAC/E,WAAW,EAAE,MAAM,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,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E,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;AAEtG,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,QAAQ,CAAA;IACd;qEACiE;IACjE,SAAS,EAAE,aAAa,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,WAAW,EAAE,MAAM,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;IACnE,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE;AACnB;yDACyD;GACvD;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAA;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkDnH"}
|
|
@@ -76,3 +76,72 @@ export async function seedSessionCopy(input) {
|
|
|
76
76
|
input.exec('rm', ['-rf', '--', input.scratchDir]);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* ORI-2512: a team boot of an empty session copy makes its working folder
|
|
81
|
+
* from ONE clone of the team copy, with the session copy as its push remote,
|
|
82
|
+
* and fills the session copy by pushing in the background. The session copy
|
|
83
|
+
* is checked at the same time as the clone; a copy that already has branches
|
|
84
|
+
* belongs to an earlier boot of this session, so the clone is dropped and the
|
|
85
|
+
* caller clones the session copy as usual. The clone keeps the whole history:
|
|
86
|
+
* an empty copy refuses a push from a shallow clone.
|
|
87
|
+
*/
|
|
88
|
+
export async function cloneTeamIntoWorkTree(input) {
|
|
89
|
+
const clear = () => input.exec('rm', ['-rf', '--', input.scratchDir]);
|
|
90
|
+
const listing = input.execAsync('git', [...withConfig(input.sessionGitConfig), 'ls-remote', '--heads', input.sessionRemote]);
|
|
91
|
+
const cloning = (async () => {
|
|
92
|
+
const origin = await input.resolveTeam();
|
|
93
|
+
const cleared = clear();
|
|
94
|
+
if (cleared.status !== 0)
|
|
95
|
+
throw failure('clearing the seed scratch', cleared);
|
|
96
|
+
return input.execAsync('git', [...withConfig(origin.gitConfig), 'clone', '--quiet', '--single-branch', '--branch', 'main', origin.remote, input.scratchDir]);
|
|
97
|
+
})();
|
|
98
|
+
const settled = cloning.then(() => undefined, () => undefined);
|
|
99
|
+
let listed;
|
|
100
|
+
try {
|
|
101
|
+
listed = await listing;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
await settled;
|
|
105
|
+
clear();
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
// A copy with saved work: answer now. The unneeded clone ends on its own
|
|
109
|
+
// and its scratch is cleared then.
|
|
110
|
+
if (listed.status === 0 && listed.stdout.trim().length > 0) {
|
|
111
|
+
void settled.then(clear);
|
|
112
|
+
return { cloned: false };
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const fetched = await cloning;
|
|
116
|
+
if (listed.status !== 0)
|
|
117
|
+
throw failure('reading the session copy', listed);
|
|
118
|
+
if (fetched.status !== 0)
|
|
119
|
+
throw failure('reading the team copy', fetched);
|
|
120
|
+
const pointed = input.exec('git', ['-C', input.scratchDir, 'remote', 'set-url', 'origin', input.sessionRemote]);
|
|
121
|
+
if (pointed.status !== 0)
|
|
122
|
+
throw failure('pointing the working folder at the session copy', pointed);
|
|
123
|
+
// The runtime image may ship the folder empty; `mv` needs it gone.
|
|
124
|
+
input.exec('rmdir', ['--', input.workTree]);
|
|
125
|
+
// A folder that is still there (not empty, or a mount point) would make
|
|
126
|
+
// `mv` put the clone inside it.
|
|
127
|
+
const remaining = input.exec('test', ['-e', input.workTree]);
|
|
128
|
+
if (remaining.status === 0)
|
|
129
|
+
throw failure('making the working folder', { status: 1, stdout: '', stderr: `${input.workTree} is not empty` });
|
|
130
|
+
const moved = input.exec('mv', ['--', input.scratchDir, input.workTree]);
|
|
131
|
+
if (moved.status !== 0)
|
|
132
|
+
throw failure('making the working folder', moved);
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
clear();
|
|
136
|
+
}
|
|
137
|
+
const filled = input.execAsync('git', ['-C', input.workTree, ...withConfig(input.sessionGitConfig), 'push', '--quiet', 'origin', 'refs/heads/main:refs/heads/main'])
|
|
138
|
+
.then(async (pushed) => {
|
|
139
|
+
if (pushed.status === 0)
|
|
140
|
+
return true;
|
|
141
|
+
// Another boot, or the agent's own first save, may have filled it first.
|
|
142
|
+
const listed = await input.execAsync('git', [...withConfig(input.sessionGitConfig), 'ls-remote', '--heads', input.sessionRemote]);
|
|
143
|
+
return listed.status === 0 && listed.stdout.trim().length > 0;
|
|
144
|
+
})
|
|
145
|
+
.catch(() => false);
|
|
146
|
+
return { cloned: true, filled };
|
|
147
|
+
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAwLA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,GAAI,iBAAiB,MAAM;;;EACJ,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAwLA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,GAAI,iBAAiB,MAAM;;;EACJ,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAwtCtD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA0B1G;AAED,eAAO,MAAM,iBAAiB,SAAU,CAAA;AACxC,eAAO,MAAM,uBAAuB,QAAkB,CAAA;AACtD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAexH;AAmMD,wBAAsB,IAAI,CAAC,OAAO,WAAwB,iBAiiBzD;AA6DD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEhF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -578,9 +578,13 @@ async function submitScoreResults() {
|
|
|
578
578
|
console.warn(scoreInput.aggregateWarning);
|
|
579
579
|
}
|
|
580
580
|
const aggregatePayload = scoreInput.aggregate || {};
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
581
|
+
const { sendScoreSave } = await import('./score-save-workflow.js');
|
|
582
|
+
const data = await sendScoreSave({
|
|
583
|
+
command: 'submit',
|
|
584
|
+
path: `/api/cli/scores/submit?project=${encodeURIComponent(project)}`,
|
|
585
|
+
project,
|
|
586
|
+
scorerVersionId,
|
|
587
|
+
saves: true,
|
|
584
588
|
body: JSON.stringify({
|
|
585
589
|
...aggregatePayload,
|
|
586
590
|
...instructionSetProvenanceFields(project),
|
|
@@ -593,11 +597,7 @@ async function submitScoreResults() {
|
|
|
593
597
|
candidateId: candidateId || undefined,
|
|
594
598
|
resultsJsonl: scoreInput.resultsJsonl,
|
|
595
599
|
}),
|
|
596
|
-
});
|
|
597
|
-
if (!response.ok) {
|
|
598
|
-
throw new Error(`Failed to submit score: ${await response.text()}`);
|
|
599
|
-
}
|
|
600
|
-
const data = await parseJsonResponse(response, 'Score submit');
|
|
600
|
+
}, authedFetch);
|
|
601
601
|
if (hasJsonFlag()) {
|
|
602
602
|
printJson(data);
|
|
603
603
|
return;
|
|
@@ -706,9 +706,13 @@ async function execScorer() {
|
|
|
706
706
|
}
|
|
707
707
|
const instructionSetProvenance = instructionSetProvenanceFields(project);
|
|
708
708
|
const isNoSubmit = hasArg('--no-submit');
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
709
|
+
const { sendScoreSave } = await import('./score-save-workflow.js');
|
|
710
|
+
const data = await sendScoreSave({
|
|
711
|
+
command: 'exec',
|
|
712
|
+
path: `/api/cli/scorers/exec?project=${encodeURIComponent(project)}`,
|
|
713
|
+
project,
|
|
714
|
+
scorerVersionId,
|
|
715
|
+
saves: !isNoSubmit,
|
|
712
716
|
body: JSON.stringify({
|
|
713
717
|
scorerVersionId,
|
|
714
718
|
subjectPromptVersionId: subjectPromptVersionId || undefined,
|
|
@@ -724,11 +728,7 @@ async function execScorer() {
|
|
|
724
728
|
dependencyResultsJsonl: readDependencyResultAssignments(getArg('--dependency-results')),
|
|
725
729
|
...instructionSetProvenance,
|
|
726
730
|
}),
|
|
727
|
-
});
|
|
728
|
-
if (!response.ok) {
|
|
729
|
-
throw new Error(`Failed to execute scorer: ${await response.text()}`);
|
|
730
|
-
}
|
|
731
|
-
const data = await parseJsonResponse(response, 'Scorer exec');
|
|
731
|
+
}, authedFetch);
|
|
732
732
|
const noSubmitOutput = isNoSubmit
|
|
733
733
|
? noSubmitScorerOutput(data, instructionSetProvenance)
|
|
734
734
|
: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-backup-core.d.ts","sourceRoot":"","sources":["../src/repository-backup-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repository-backup-core.d.ts","sourceRoot":"","sources":["../src/repository-backup-core.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAY3D,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAML,KAAK,2BAA2B,EAEhC,KAAK,wCAAwC,EAC7C,KAAK,0BAA0B,EAE/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI9B,MAAM,mCAAmC,CAAA;AAE1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,kCAAkC,QACvB,CAAA;AACxB,eAAO,MAAM,mCAAmC,KAAK,CAAA;AAErD,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,sBAAsB,CAoB1E,CAAA;AAEJ,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,qBAAqB,EAAE,CAAA;IAC7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EAAE,0BAA0B,CAAA;IACpC;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,eAAe,CAAA;IAC/B,mBAAmB,EAAE,0BAA0B,CAAA;IAC/C,kBAAkB,EAAE,0BAA0B,CAAA;CAC/C;AAED,MAAM,WAAW,iCAAiC;IAChD;;;OAGG;IACH,wBAAwB,EAAE,wCAAwC,CAAA;IAClE,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAA;IACjE,iBAAiB,EAAE,iCAAiC,CAAA;IACpD;;;OAGG;IACH,cAAc,EAAE,CACd,YAAY,EAAE,oCAAoC,EAClD,QAAQ,EAAE,wBAAwB,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAA;CACnB;AAED,MAAM,WAAW,mCAAmC;IAClD,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAw1BD,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,0BAA0B,GAChC,IAAI,CAIN;AAu8BD,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,mCAAmC,CAAC,CA8C9C;AAED,wBAAsB,8BAA8B,CAAC,eAAe,EAClE,KAAK,EAAE,mCAAmC,CAAC,eAAe,CAAC,GAC1D,OAAO,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC,CA+VpD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The app's own `{ error }` message, or null when the reply isn't the app's JSON. */
|
|
2
|
+
export declare function appErrorOf(response: Response): Promise<string | null>;
|
|
3
|
+
/** The code when the request never reached a server, otherwise null. */
|
|
4
|
+
export declare function unreachedCode(error: unknown): string | null;
|
|
5
|
+
//# sourceMappingURL=request-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-outcome.d.ts","sourceRoot":"","sources":["../src/request-outcome.ts"],"names":[],"mappings":"AAKA,sFAAsF;AACtF,wBAAsB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAO3E;AAKD,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ3D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isJsonErrorResponsePayload } from './error-response.js';
|
|
2
|
+
// The request never reached a server, so nothing can have been written.
|
|
3
|
+
const UNREACHED_CODES = new Set(['ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN']);
|
|
4
|
+
/** The app's own `{ error }` message, or null when the reply isn't the app's JSON. */
|
|
5
|
+
export async function appErrorOf(response) {
|
|
6
|
+
try {
|
|
7
|
+
const payload = await response.json();
|
|
8
|
+
return isJsonErrorResponsePayload(response, payload) ? payload.error : null;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// fetch reports a refused connection as `fetch failed` with the reason in
|
|
15
|
+
// `cause`. For a name with several addresses (localhost) the cause is an
|
|
16
|
+
// AggregateError that carries the same code itself.
|
|
17
|
+
/** The code when the request never reached a server, otherwise null. */
|
|
18
|
+
export function unreachedCode(error) {
|
|
19
|
+
let current = error;
|
|
20
|
+
for (let depth = 0; depth < 4 && current !== null && typeof current === 'object'; depth += 1) {
|
|
21
|
+
const { code, cause } = current;
|
|
22
|
+
if (typeof code === 'string' && UNREACHED_CODES.has(code))
|
|
23
|
+
return code;
|
|
24
|
+
current = cause;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const COMMANDS: {
|
|
2
|
+
readonly submit: {
|
|
3
|
+
readonly label: "Score submit";
|
|
4
|
+
readonly failed: "Failed to submit score";
|
|
5
|
+
};
|
|
6
|
+
readonly exec: {
|
|
7
|
+
readonly label: "Scorer exec";
|
|
8
|
+
readonly failed: "Failed to execute scorer";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export interface ScoreSave {
|
|
12
|
+
command: keyof typeof COMMANDS;
|
|
13
|
+
/** The route path with its query, as sent. */
|
|
14
|
+
path: string;
|
|
15
|
+
body: string;
|
|
16
|
+
project: string;
|
|
17
|
+
scorerVersionId: string;
|
|
18
|
+
/** False for `scorers exec --no-submit`, which saves nothing. */
|
|
19
|
+
saves: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Sends one request; calls `onRequestStart` just before anything goes out. */
|
|
22
|
+
export type ScoreSaveRequest = (path: string, init: RequestInit, onRequestStart?: () => void) => Promise<Response>;
|
|
23
|
+
/** `orizu scores submit` and `orizu scorers exec`: the reply, or an error saying whether the score may be saved. */
|
|
24
|
+
export declare function sendScoreSave(save: ScoreSave, request: ScoreSaveRequest): Promise<Record<string, unknown>>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=score-save-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score-save-workflow.d.ts","sourceRoot":"","sources":["../src/score-save-workflow.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,QAAQ;;;;;;;;;CAGJ,CAAA;AASV,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,OAAO,QAAQ,CAAA;IAC9B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,iEAAiE;IACjE,KAAK,EAAE,OAAO,CAAA;CACf;AAED,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AA0FlH,oHAAoH;AACpH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAMhH"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import diagnostics from 'node:diagnostics_channel';
|
|
2
|
+
import { Cause, Effect, Exit, Result, Schema } from 'effect';
|
|
3
|
+
import { datasetTransferTimeoutMs } from './dataset-transfer-policy.js';
|
|
4
|
+
import { extractErrorMessage } from './error-response.js';
|
|
5
|
+
import { appErrorOf, unreachedCode } from './request-outcome.js';
|
|
6
|
+
// Loaded only through `await import(...)`, like the dataset workflows.
|
|
7
|
+
const COMMANDS = {
|
|
8
|
+
submit: { label: 'Score submit', failed: 'Failed to submit score' },
|
|
9
|
+
exec: { label: 'Scorer exec', failed: 'Failed to execute scorer' },
|
|
10
|
+
};
|
|
11
|
+
// What the server says when it cannot tell whether the run was saved.
|
|
12
|
+
const SERVER_MAY_BE_SAVED = 'Score run may already be saved';
|
|
13
|
+
// Node's fetch publishes this once a request's whole body has been written.
|
|
14
|
+
const BODY_SENT = 'undici:request:bodySent';
|
|
15
|
+
const SavedReply = Schema.Struct({ scoreRun: Schema.Struct({ id: Schema.NonEmptyString }) });
|
|
16
|
+
const scoreMayBeSaved = (save) => `The score may already be saved: run \`orizu scorers detail ${save.scorerVersionId} --project ${save.project}\` and check its newest score runs before running this again.`;
|
|
17
|
+
// The run may be saved when the server says so, when the reply was lost, late
|
|
18
|
+
// or unreadable after the request was sent, when a 5xx did not come from the
|
|
19
|
+
// app (a gateway giving up while the app kept working), or when the reply has
|
|
20
|
+
// no run. Any other error reply is a clear refusal.
|
|
21
|
+
class ScoreSaveFailure extends Error {
|
|
22
|
+
mayBeSaved;
|
|
23
|
+
_tag = 'ScoreSaveFailure';
|
|
24
|
+
constructor(message, mayBeSaved) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.mayBeSaved = mayBeSaved;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// One request, never retried: a retry after an unknown outcome could save a
|
|
30
|
+
// second run. The deadline starts once the whole body has been sent, so a
|
|
31
|
+
// large upload on a slow link takes as long as it did before.
|
|
32
|
+
function scoreSave(save, request, timeoutMs) {
|
|
33
|
+
const { label, failed } = COMMANDS[save.command];
|
|
34
|
+
return Effect.suspend(() => {
|
|
35
|
+
let sent = false;
|
|
36
|
+
let timedOut = false;
|
|
37
|
+
return Effect.tryPromise({
|
|
38
|
+
try: async (signal) => {
|
|
39
|
+
const controller = new AbortController();
|
|
40
|
+
const abort = () => controller.abort();
|
|
41
|
+
let timer;
|
|
42
|
+
// Started (again, after a sign-in refresh) when this request's body has been sent.
|
|
43
|
+
const onBodySent = (message) => {
|
|
44
|
+
const sentRequest = message.request;
|
|
45
|
+
if (sentRequest?.method !== 'POST' || sentRequest.path !== save.path)
|
|
46
|
+
return;
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
timer = setTimeout(() => { timedOut = true; controller.abort(); }, timeoutMs);
|
|
49
|
+
};
|
|
50
|
+
diagnostics.subscribe(BODY_SENT, onBodySent);
|
|
51
|
+
if (signal.aborted)
|
|
52
|
+
abort();
|
|
53
|
+
else
|
|
54
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
55
|
+
try {
|
|
56
|
+
const response = await request(save.path, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: { 'Content-Type': 'application/json' },
|
|
59
|
+
body: save.body,
|
|
60
|
+
signal: controller.signal,
|
|
61
|
+
}, () => { sent = true; });
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const appError = await appErrorOf(response.clone());
|
|
64
|
+
const detail = await extractErrorMessage(response);
|
|
65
|
+
if (appError === SERVER_MAY_BE_SAVED)
|
|
66
|
+
throw new ScoreSaveFailure(appError, true);
|
|
67
|
+
if (response.status < 400 || (response.status >= 500 && appError === null)) {
|
|
68
|
+
throw new ScoreSaveFailure(`${label} got no clear answer (status ${response.status}).`, true);
|
|
69
|
+
}
|
|
70
|
+
throw new ScoreSaveFailure(detail.startsWith(failed) ? detail : `${failed}: ${detail}`, false);
|
|
71
|
+
}
|
|
72
|
+
// Reading the body can still fail or stall; that stays under the deadline.
|
|
73
|
+
const text = await response.text();
|
|
74
|
+
let data;
|
|
75
|
+
try {
|
|
76
|
+
data = JSON.parse(text);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
data = undefined;
|
|
80
|
+
}
|
|
81
|
+
const usable = save.saves
|
|
82
|
+
? Result.isSuccess(Schema.decodeUnknownResult(SavedReply)(data))
|
|
83
|
+
: typeof data === 'object' && data !== null && !Array.isArray(data);
|
|
84
|
+
if (!usable) {
|
|
85
|
+
throw new ScoreSaveFailure(`${label} returned an unexpected response (status ${response.status}).`, true);
|
|
86
|
+
}
|
|
87
|
+
return data;
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
diagnostics.unsubscribe(BODY_SENT, onBodySent);
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
signal.removeEventListener('abort', abort);
|
|
93
|
+
controller.abort();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
catch: cause => {
|
|
97
|
+
if (cause instanceof ScoreSaveFailure)
|
|
98
|
+
return cause;
|
|
99
|
+
if (timedOut)
|
|
100
|
+
return new ScoreSaveFailure(`${label} exceeded its deadline.`, sent);
|
|
101
|
+
const unreached = unreachedCode(cause);
|
|
102
|
+
if (unreached)
|
|
103
|
+
return new ScoreSaveFailure(`${failed}: could not reach the server (${unreached}).`, false);
|
|
104
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
105
|
+
if (!sent || message.startsWith('ORIZU_AUTH_CONTEXT_CHANGED:'))
|
|
106
|
+
return new ScoreSaveFailure(message, false);
|
|
107
|
+
// Also reached when a sign-in refresh fails after a 401: still told to
|
|
108
|
+
// check, so say only that the save did not finish.
|
|
109
|
+
return new ScoreSaveFailure(`${label} did not finish: ${message}`, true);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** `orizu scores submit` and `orizu scorers exec`: the reply, or an error saying whether the score may be saved. */
|
|
115
|
+
export async function sendScoreSave(save, request) {
|
|
116
|
+
const exit = await Effect.runPromiseExit(scoreSave(save, request, datasetTransferTimeoutMs()).pipe(Effect.mapError(failure => new Error(failure.mayBeSaved && save.saves ? `${failure.message}\n${scoreMayBeSaved(save)}` : failure.message))));
|
|
117
|
+
if (Exit.isSuccess(exit))
|
|
118
|
+
return exit.value;
|
|
119
|
+
throw Cause.squash(exit.cause);
|
|
120
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-installer.d.ts","sourceRoot":"","sources":["../src/skill-installer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skill-installer.d.ts","sourceRoot":"","sources":["../src/skill-installer.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,UAAU,UAAU,CAAA;AAIjC,eAAO,MAAM,mBAAmB,6BAA6B,CAAA;AAC7D,eAAO,MAAM,iBAAiB,2BAA2B,CAAA;AAEzD,eAAO,MAAM,qBAAqB,uNAcxB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAA;AAErE,eAAO,MAAM,mBAAmB,2BAA2B,CAAA;AAE3D,eAAO,MAAM,oBAAoB,sFASvB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;AAEnE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AASvD,MAAM,WAAW,mB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AAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAEzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IAGpE,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAGvC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAA;CACvD;AAiFD,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,eAAe,CAuBtF;AAiJD,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,yBAAyB,GAClC;IAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;IAAC,QAAQ,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAc5E"}
|
package/dist/skill-installer.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Reads the bundled skill (the repository copy when run from source) and the install targets it is given.
|
|
2
|
+
// @tia-reads: skills/orizu
|
|
1
3
|
import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, realpathSync, renameSync, rmdirSync, rmSync, symlinkSync, unlinkSync, writeFileSync, } from 'fs';
|
|
2
4
|
import { dirname, isAbsolute, join, relative, resolve, sep } from 'path';
|
|
3
5
|
import { fileURLToPath } from 'url';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team-create-workflow.d.ts","sourceRoot":"","sources":["../src/team-create-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"team-create-workflow.d.ts","sourceRoot":"","sources":["../src/team-create-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAA;AAe5D,QAAA,MAAM,WAAW;;;;;;;EAOf,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAEzD,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AA0EnH,+GAA+G;AAC/G,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAM3G"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Cause, Effect, Exit, Result, Schema } from 'effect';
|
|
2
2
|
import { datasetTransferTimeoutMs } from './dataset-transfer-policy.js';
|
|
3
|
-
import { extractErrorMessage
|
|
3
|
+
import { extractErrorMessage } from './error-response.js';
|
|
4
|
+
import { appErrorOf, unreachedCode } from './request-outcome.js';
|
|
4
5
|
// Loaded only through `await import(...)`, like the dataset workflows.
|
|
5
6
|
const FAILED = 'Failed to create team';
|
|
6
7
|
// What the server says when it cannot tell whether the team was saved.
|
|
7
8
|
const SERVER_MAY_BE_CREATED = 'Team may already be created. Check your teams before creating it again.';
|
|
8
|
-
// The request never reached a server, so nothing can have been created.
|
|
9
|
-
const UNREACHED_CODES = new Set(['ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN']);
|
|
10
9
|
const teamMayBeCreated = (name) => `The team may already be created: run \`orizu teams list\` and look for "${name}" before creating it again.`;
|
|
11
10
|
const CreateReply = Schema.Struct({
|
|
12
11
|
team: Schema.Struct({
|
|
@@ -28,28 +27,6 @@ class TeamCreateFailure extends Error {
|
|
|
28
27
|
this.mayBeCreated = mayBeCreated;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
async function appErrorOf(response) {
|
|
32
|
-
try {
|
|
33
|
-
const payload = await response.json();
|
|
34
|
-
return isJsonErrorResponsePayload(response, payload) ? payload.error : null;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// fetch reports a refused connection as `fetch failed` with the reason in
|
|
41
|
-
// `cause`. For a name with several addresses (localhost) the cause is an
|
|
42
|
-
// AggregateError that carries the same code itself.
|
|
43
|
-
function unreachedCode(error) {
|
|
44
|
-
let current = error;
|
|
45
|
-
for (let depth = 0; depth < 4 && current !== null && typeof current === 'object'; depth += 1) {
|
|
46
|
-
const { code, cause } = current;
|
|
47
|
-
if (typeof code === 'string' && UNREACHED_CODES.has(code))
|
|
48
|
-
return code;
|
|
49
|
-
current = cause;
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
30
|
// One request, never retried: a retry after an unknown outcome could make a
|
|
54
31
|
// second team, or be refused as a duplicate of the first.
|
|
55
32
|
function teamCreate(name, request, timeoutMs) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** A new role for the member with this email, or their removal from the team. */
|
|
2
|
+
export type TeamMemberChange = {
|
|
3
|
+
readonly kind: 'role';
|
|
4
|
+
readonly teamSlug: string;
|
|
5
|
+
readonly email: string;
|
|
6
|
+
readonly role: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'remove';
|
|
9
|
+
readonly teamSlug: string;
|
|
10
|
+
readonly email: string;
|
|
11
|
+
};
|
|
12
|
+
/** Sends one request; calls `onRequestStart` just before anything goes out. */
|
|
13
|
+
export type TeamMemberChangeRequest = (path: string, init: RequestInit, onRequestStart?: () => void) => Promise<Response>;
|
|
14
|
+
interface ListedMember {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly email: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `orizu teams members role` and `orizu teams members remove`: looks up the
|
|
20
|
+
* member by email, then changes them with one request. Returns the member, or
|
|
21
|
+
* throws an error saying whether the change may already have happened.
|
|
22
|
+
*/
|
|
23
|
+
export declare function changeTeamMemberWithDeadline(change: TeamMemberChange, lookup: () => Promise<ListedMember[]>, request: TeamMemberChangeRequest): Promise<ListedMember>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=team-member-change-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-member-change-workflow.d.ts","sourceRoot":"","sources":["../src/team-member-change-workflow.ts"],"names":[],"mappings":"AASA,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAElF,+EAA+E;AAC/E,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEzH,UAAU,YAAY;IAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AA+GtE;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,EACrC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,YAAY,CAAC,CAQvB"}
|