@gitroll/tacitt-cli 0.6.7 → 0.6.8

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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as permissionDiagnostic, a as readAgentPresence, d as guardDetachedStartup, f as createRenderActivity, g as longCommands, h as businessCommands, i as invoke, l as awaitingPassport, m as parseOptions, n as readOperation, o as createRuntime, p as helpText, r as waitOperation, s as executorEventSchema, t as cancelOperation, u as serveDetached, v as startupFailure, y as traceStartup } from "./query-Bb72w2DX.mjs";
2
+ import { _ as permissionDiagnostic, a as readAgentPresence, d as guardDetachedStartup, f as createRenderActivity, g as longCommands, h as businessCommands, i as invoke, l as awaitingPassport, m as parseOptions, n as readOperation, o as createRuntime, p as helpText, r as waitOperation, s as executorEventSchema, t as cancelOperation, u as serveDetached, v as startupFailure, y as traceStartup } from "./query-CaBXQlpF.mjs";
3
3
  import { nt as makePrivateDirectory, rt as openPrivateFile } from "./src-p_uJNjV3.mjs";
4
4
  import { A as createExecutionPort, I as inBackgroundStatusPoll, j as startHost, k as readStateDump } from "./job-CeSf9UCC.mjs";
5
5
  import { $t as safeField, Qt as safeCode, Xt as ApplicationError } from "./locate-BWkblijS.mjs";
@@ -1,4 +1,4 @@
1
- import { c as executorRequestSchema, g as longCommands, i as invoke, m as parseOptions, n as readOperation, o as createRuntime, r as waitOperation, v as startupFailure } from "./query-Bb72w2DX.mjs";
1
+ import { c as executorRequestSchema, g as longCommands, i as invoke, m as parseOptions, n as readOperation, o as createRuntime, r as waitOperation, v as startupFailure } from "./query-CaBXQlpF.mjs";
2
2
  import { $t as safeField, Qt as safeCode, Xt as ApplicationError } from "./locate-BWkblijS.mjs";
3
3
  import "./src-d7n58sbH.mjs";
4
4
  import { z } from "zod";
@@ -6928,7 +6928,7 @@ function retryDelay(error, fallback, now) {
6928
6928
  const delay = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(header) - now;
6929
6929
  return Number.isFinite(delay) ? Math.max(fallback, delay) : fallback;
6930
6930
  }
6931
- /** Reconcile first; only failed transfers that consumed bytes charge the durable budget. */
6931
+ /** Reconcile retained intents; only byte-started failures charge the durable budget. */
6932
6932
  async function attemptSession({ dependencies, original, session, key, remote, signal, guard, checkpoint }) {
6933
6933
  const previous = original.sessionUpload?.key === key && original.sessionUpload.sha256 === session.sha256 ? original.sessionUpload : null;
6934
6934
  let failures = previous?.attempt ?? 0;
@@ -6967,8 +6967,31 @@ async function attemptSession({ dependencies, original, session, key, remote, si
6967
6967
  await guard();
6968
6968
  await save();
6969
6969
  let lastReported = 0;
6970
+ const reserveUploadComplete = async () => {
6971
+ await guard();
6972
+ const reservation = await remote.reserve(input, signal);
6973
+ if (reservation.state === "awaiting_upload") {
6974
+ await guard();
6975
+ transfer.attempt = failures + 1;
6976
+ await session.upload(reservation, signal, async (bytes) => {
6977
+ const sent = Math.min(session.byteLength, Math.max(transfer.bytesSent, bytes));
6978
+ transfer.bytesAttempted += sent - transfer.bytesSent;
6979
+ transfer.bytesSent = sent;
6980
+ if (Date.now() - lastReported >= 250 || sent === session.byteLength) {
6981
+ report();
6982
+ lastReported = Date.now();
6983
+ }
6984
+ });
6985
+ await guard();
6986
+ await remote.complete({
6987
+ ...input,
6988
+ metadata: session.metadata
6989
+ }, signal);
6990
+ }
6991
+ };
6970
6992
  try {
6971
- try {
6993
+ if (previous === null) await reserveUploadComplete();
6994
+ else try {
6972
6995
  await remote.complete({
6973
6996
  ...input,
6974
6997
  metadata: session.metadata
@@ -6976,26 +6999,7 @@ async function attemptSession({ dependencies, original, session, key, remote, si
6976
6999
  } catch (error) {
6977
7000
  if (!(error instanceof JourneyRemoteError) || error.status !== 409 || error.code !== "upload_incomplete") throw error;
6978
7001
  if (failures >= 3) throw new ApplicationError("SESSION_UPLOAD_EXHAUSTED");
6979
- await guard();
6980
- const reservation = await remote.reserve(input, signal);
6981
- if (reservation.state === "awaiting_upload") {
6982
- await guard();
6983
- transfer.attempt = failures + 1;
6984
- await session.upload(reservation, signal, async (bytes) => {
6985
- const sent = Math.min(session.byteLength, Math.max(transfer.bytesSent, bytes));
6986
- transfer.bytesAttempted += sent - transfer.bytesSent;
6987
- transfer.bytesSent = sent;
6988
- if (Date.now() - lastReported >= 250 || sent === session.byteLength) {
6989
- report();
6990
- lastReported = Date.now();
6991
- }
6992
- });
6993
- await guard();
6994
- await remote.complete({
6995
- ...input,
6996
- metadata: session.metadata
6997
- }, signal);
6998
- }
7002
+ await reserveUploadComplete();
6999
7003
  }
7000
7004
  transfer.bytesAcknowledged = session.byteLength;
7001
7005
  await guard();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitroll/tacitt-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Private local session review and export for coding agents",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {