@porte/cli 0.1.4 → 0.1.6
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.js
CHANGED
|
@@ -11,7 +11,7 @@ setLogSink((_level, line) => {
|
|
|
11
11
|
});
|
|
12
12
|
const verbose = process.argv.includes("--verbose") || process.argv.includes("-v");
|
|
13
13
|
process.env.LOG_LEVEL ??= verbose ? "DEBUG" : "WARN";
|
|
14
|
-
const { run } = await import("./run-cli-
|
|
14
|
+
const { run } = await import("./run-cli-ChinbJm6.js");
|
|
15
15
|
const code = await run(process.argv.slice(2), {
|
|
16
16
|
stdout: process.stdout,
|
|
17
17
|
stderr: process.stderr,
|
|
@@ -168,7 +168,7 @@ var WebSocketHandlerError = class extends h("WebSocketHandlerError") {
|
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region src/entrypoints/cli/version.ts
|
|
170
170
|
/** Package version. Source is `package.json`. */
|
|
171
|
-
const VERSION = "0.1.
|
|
171
|
+
const VERSION = "0.1.6";
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/entrypoints/cli/cli-error.ts
|
|
174
174
|
/** Bad arguments or missing required flags. */
|
|
@@ -373,9 +373,11 @@ async function pairHost(input) {
|
|
|
373
373
|
async function waitForApproval(input, grant) {
|
|
374
374
|
const deadline = input.now() + grant.expiresInSeconds * 1e3;
|
|
375
375
|
let intervalSeconds = grant.intervalSeconds;
|
|
376
|
+
let attempt = 0;
|
|
376
377
|
while (input.now() < deadline) {
|
|
377
378
|
await input.sleep(intervalSeconds * 1e3);
|
|
378
379
|
const answer = await input.authorizer.poll(grant.deviceCode);
|
|
380
|
+
attempt += 1;
|
|
379
381
|
if (answer.status === "granted") return {
|
|
380
382
|
status: "paired",
|
|
381
383
|
token: answer.token
|
|
@@ -383,6 +385,10 @@ async function waitForApproval(input, grant) {
|
|
|
383
385
|
if (answer.status === "denied") return { status: "denied" };
|
|
384
386
|
if (answer.status === "expired") return { status: "expired" };
|
|
385
387
|
if (answer.status === "slow-down") intervalSeconds += answer.intervalSeconds;
|
|
388
|
+
input.onPoll?.({
|
|
389
|
+
attempt,
|
|
390
|
+
intervalSeconds
|
|
391
|
+
});
|
|
386
392
|
}
|
|
387
393
|
return { status: "expired" };
|
|
388
394
|
}
|
|
@@ -717,20 +723,26 @@ async function runPairCommand(input) {
|
|
|
717
723
|
const { code, url, quiet, strong, ok } = output.emphasis;
|
|
718
724
|
const interactive = process.stdin.isTTY;
|
|
719
725
|
let stopWatching;
|
|
726
|
+
let showingWait = false;
|
|
727
|
+
let lastPoll;
|
|
728
|
+
const waiting = (poll) => quiet(poll === void 0 ? `Waiting for approval — checking with Porte… ${WAITING_EMOJI}` : `Waiting for approval — checking with Porte every ${String(poll.intervalSeconds)}s (${String(poll.attempt)} so far) ${WAITING_EMOJI}`);
|
|
720
729
|
const paired = await pairHost({
|
|
721
730
|
authorizer: resources.authorizer,
|
|
722
731
|
credentials: resources.credentials,
|
|
723
732
|
baseUrl: input.config.baseUrl,
|
|
724
733
|
host: describeThisMachine(),
|
|
734
|
+
onPoll: (poll) => {
|
|
735
|
+
lastPoll = poll;
|
|
736
|
+
if (showingWait) output.status(waiting(poll));
|
|
737
|
+
},
|
|
725
738
|
onPrompt: (prompt) => {
|
|
726
739
|
const shown = formatPairingCode(prompt.userCode);
|
|
727
|
-
const waiting = `Waiting for approval — the code expires in ${String(Math.round(prompt.expiresInSeconds / 60))} minutes. ${WAITING_EMOJI}`;
|
|
728
740
|
output.title("Pair this machine with Porte", PAIR_EMOJI);
|
|
729
741
|
if (!interactive) {
|
|
730
742
|
output.raw(`First copy your pairing code: ${code(shown)}`);
|
|
731
743
|
output.raw(`Then open ${url(prompt.verificationUri)} in your browser.`);
|
|
732
744
|
output.blank();
|
|
733
|
-
output.raw(
|
|
745
|
+
output.raw(waiting(void 0));
|
|
734
746
|
return;
|
|
735
747
|
}
|
|
736
748
|
const codeLine = (hint) => `First copy your pairing code: ${code(shown)} ${hint}`;
|
|
@@ -742,7 +754,8 @@ async function runPairCommand(input) {
|
|
|
742
754
|
stopWatching?.();
|
|
743
755
|
output.blank();
|
|
744
756
|
output.blank();
|
|
745
|
-
|
|
757
|
+
showingWait = true;
|
|
758
|
+
output.status(waiting(lastPoll));
|
|
746
759
|
openUrl(prompt.verificationUri);
|
|
747
760
|
return;
|
|
748
761
|
}
|
|
@@ -2828,14 +2841,20 @@ var AcpUpdateMapper = class {
|
|
|
2828
2841
|
if (update.name !== void 0 && update.name !== null) next.name = update.name;
|
|
2829
2842
|
if (update.kind !== void 0 && update.kind !== null) next.kind = update.kind;
|
|
2830
2843
|
if (update.status !== void 0 && update.status !== null) next.status = update.status;
|
|
2831
|
-
if (update.content !== void 0 && update.content !== null) next.content = update.content.map(mapToolContent);
|
|
2844
|
+
if (update.content !== void 0 && update.content !== null && update.content.length > 0) next.content = update.content.map(mapToolContent);
|
|
2832
2845
|
if (update.locations !== void 0 && update.locations !== null) next.locations = update.locations.map(mapLocation);
|
|
2833
|
-
if (update.rawInput !== void 0) next.rawInput = mapJson(update.rawInput);
|
|
2834
|
-
if (update.rawOutput !== void 0) next.rawOutput = mapJson(update.rawOutput);
|
|
2846
|
+
if (update.rawInput !== void 0 && update.rawInput !== null) next.rawInput = mapJson(update.rawInput);
|
|
2847
|
+
if (update.rawOutput !== void 0 && update.rawOutput !== null) next.rawOutput = mapJson(update.rawOutput);
|
|
2835
2848
|
if (update._meta !== void 0 && update._meta !== null) next._meta = mapMeta(update._meta);
|
|
2836
2849
|
const parsed = ToolViewSchema.safeParse(next);
|
|
2837
2850
|
if (!parsed.success) throw new AcpUpdateValueError("ACP tool update is invalid");
|
|
2838
2851
|
this.tools.set(update.toolCallId, parsed.data);
|
|
2852
|
+
logger$2.debug("acp_tool_updated", { details: {
|
|
2853
|
+
toolCallId: update.toolCallId,
|
|
2854
|
+
status: parsed.data.status,
|
|
2855
|
+
content: parsed.data.content.length,
|
|
2856
|
+
rawInput: parsed.data.rawInput === void 0 ? "absent" : "present"
|
|
2857
|
+
} });
|
|
2839
2858
|
return [{
|
|
2840
2859
|
type: "tool.updated",
|
|
2841
2860
|
turnId,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "@porte/cli",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"description": "Run your local Grok sessions from your phone. The daemon that pairs a machine with useporte.dev.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"acp",
|