@ref0/cli 0.12.0 → 0.12.1
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/main.mjs +18 -9
- package/package.json +2 -2
package/dist/main.mjs
CHANGED
|
@@ -6660,12 +6660,15 @@ const RequestOrganization = Schema.Struct({
|
|
|
6660
6660
|
/**
|
|
6661
6661
|
* The result collected with the machine's two proofs: each included folder's identity and grant,
|
|
6662
6662
|
* its agent's owner name and organizations, and excluded paths. Confirmation checks each saved
|
|
6663
|
-
* grant's live deadline in the Owner DO.
|
|
6663
|
+
* grant's live deadline in the Owner DO. Once a yes connected and the machine hasn't sent its
|
|
6664
|
+
* answer code, waiting says until when: `confirmBy`, when ref0 revokes each grant the machine
|
|
6665
|
+
* hasn't confirmed.
|
|
6664
6666
|
*/
|
|
6665
6667
|
const RequestState = Schema.Union([
|
|
6666
6668
|
Schema.Struct({
|
|
6667
6669
|
state: Schema.Literal("waiting"),
|
|
6668
|
-
expiresAt: Timestamp
|
|
6670
|
+
expiresAt: Timestamp,
|
|
6671
|
+
confirmBy: Schema.optionalKey(Timestamp)
|
|
6669
6672
|
}),
|
|
6670
6673
|
Schema.Struct({
|
|
6671
6674
|
state: Schema.Literal("connected"),
|
|
@@ -21400,7 +21403,7 @@ const grantForAgent = Effect.fnUntraced(function* (owner, agent) {
|
|
|
21400
21403
|
* an update installs anew. Node, run from source, loads JSON only with the `type` attribute,
|
|
21401
21404
|
* and only as a default export.
|
|
21402
21405
|
*/
|
|
21403
|
-
const cliVersion = "0.12.
|
|
21406
|
+
const cliVersion = "0.12.1";
|
|
21404
21407
|
//#endregion
|
|
21405
21408
|
//#region src/harness/hook-protocol.ts
|
|
21406
21409
|
/**
|
|
@@ -21785,10 +21788,10 @@ const requestAttachment = Effect.fnUntraced(function* (asked) {
|
|
|
21785
21788
|
const withSecret = HttpApiMiddleware.layerClient(ApprovalSecret, ({ request, next }) => next(HttpClientRequest.bearerToken(request, collecting.secret)));
|
|
21786
21789
|
const collector = yield* ref0Client(config.api).pipe(Effect.provide(Layer.merge(anonymousCredential, withSecret)), Effect.provideService(HttpClient.HttpClient, http));
|
|
21787
21790
|
const params = { approval: started.approval };
|
|
21788
|
-
const collect =
|
|
21791
|
+
const collect = (answerCode) => collector.machineAttachments.collect({
|
|
21789
21792
|
params,
|
|
21790
21793
|
payload: answerCode === void 0 ? {} : { answerCode }
|
|
21791
|
-
})
|
|
21794
|
+
}).pipe(Effect.map(Option.some), Effect.timeoutOrElse({
|
|
21792
21795
|
duration: requestTimeout,
|
|
21793
21796
|
orElse: () => Effect.succeedNone
|
|
21794
21797
|
}), Effect.catchTags({
|
|
@@ -21798,13 +21801,19 @@ const requestAttachment = Effect.fnUntraced(function* (asked) {
|
|
|
21798
21801
|
HttpClientError: () => Effect.succeedNone,
|
|
21799
21802
|
SchemaError: () => Effect.succeedNone
|
|
21800
21803
|
}));
|
|
21804
|
+
const lapsing = asking.some((folder) => Option.isSome(folder.replaces)) ? "Its new grants expire unconfirmed, and each folder’s connection from before still works." : "Its new grants expire unconfirmed.";
|
|
21801
21805
|
const giveUpAt = DateTime.toEpochMillis(started.expiresAt) + giveUpAfterMillis;
|
|
21806
|
+
let confirmBy;
|
|
21802
21807
|
const answered = Effect.gen(function* () {
|
|
21803
21808
|
while (true) {
|
|
21804
|
-
const
|
|
21805
|
-
|
|
21806
|
-
if (
|
|
21809
|
+
const sent = yield* Ref.get(pasted);
|
|
21810
|
+
const state = Option.getOrUndefined(yield* collect(sent));
|
|
21811
|
+
if (state !== void 0 && isEnded(state)) return state;
|
|
21812
|
+
if (state?.confirmBy !== void 0) confirmBy = DateTime.toEpochMillis(state.confirmBy);
|
|
21813
|
+
if ((yield* Ref.get(pasted)) !== sent) continue;
|
|
21814
|
+
if ((yield* Clock.currentTimeMillis) > (confirmBy ?? giveUpAt)) {
|
|
21807
21815
|
yield* endWait;
|
|
21816
|
+
if (confirmBy !== void 0 && sent === void 0) return yield* sayFailed(`It was approved, but no code was pasted in time, so this machine kept nothing. ${lapsing} To connect this machine, run: ${again$1}`);
|
|
21808
21817
|
return yield* sayFailed(`ref0 hasn’t said how it ended, so this machine kept nothing. If it was approved, ref0 revokes its grants 10 minutes after it connected. To connect this machine, run: ${again$1}`);
|
|
21809
21818
|
}
|
|
21810
21819
|
yield* Effect.sleep(pollMillis);
|
|
@@ -21949,7 +21958,7 @@ const requestAttachment = Effect.fnUntraced(function* (asked) {
|
|
|
21949
21958
|
times: 2
|
|
21950
21959
|
}), Effect.catchTag("Unanswered", () => sayFailed("Couldn’t reach ref0 to abort it. If it’s approved anyway, ref0 revokes its grants 10 minutes after they connect, since this machine never kept them.")));
|
|
21951
21960
|
if (!isEnded(state)) {
|
|
21952
|
-
if ((yield* Ref.get(pasted)) === void 0) return yield* sayFailed([["It was already answered, but no code was pasted, so this machine kept nothing.",
|
|
21961
|
+
if ((yield* Ref.get(pasted)) === void 0) return yield* sayFailed([["It was already answered, but no code was pasted, so this machine kept nothing.", lapsing]]);
|
|
21953
21962
|
yield* printBlocks([["It was already answered, so this machine waits to hear how."]]);
|
|
21954
21963
|
}
|
|
21955
21964
|
const connected = yield* finish(isEnded(state) ? state : yield* answered);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ref0/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "ref0's command line, which connects an agent's machine to ref0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@effect/vitest": "4.0.0",
|
|
30
30
|
"@ref0/contracts": "0.0.0",
|
|
31
31
|
"@ref0/model": "0.0.0",
|
|
32
|
-
"@ref0/sdk": "0.12.
|
|
32
|
+
"@ref0/sdk": "0.12.1",
|
|
33
33
|
"@types/node": "24.19.2",
|
|
34
34
|
"smol-toml": "1.9.1",
|
|
35
35
|
"typescript": "7.0.2",
|