t3code-cli 0.12.0 → 0.13.0

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.
Files changed (64) hide show
  1. package/dist/application.js +1 -1
  2. package/dist/auth.js +1 -1
  3. package/dist/bin.js +48 -31
  4. package/dist/cli.js +1 -1
  5. package/dist/config.js +1 -1
  6. package/dist/connection.js +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/node.js +1 -1
  9. package/dist/rolldown-runtime.js +1 -1
  10. package/dist/rpc.js +1 -1
  11. package/dist/shared.js +11971 -1517
  12. package/dist/src/application/actions.d.ts +1 -1
  13. package/dist/src/application/layer.d.ts +42 -42
  14. package/dist/src/application/project-commands.d.ts +3 -3
  15. package/dist/src/application/projects.d.ts +1 -1
  16. package/dist/src/application/shell-sequence.d.ts +23 -28
  17. package/dist/src/application/terminals.d.ts +6 -6
  18. package/dist/src/application/thread-commands.d.ts +18 -18
  19. package/dist/src/application/thread-update.d.ts +1 -1
  20. package/dist/src/application/thread-wait.d.ts +19 -24
  21. package/dist/src/application/threads.d.ts +124 -149
  22. package/dist/src/auth/error.d.ts +1 -2
  23. package/dist/src/auth/layer.d.ts +2 -2
  24. package/dist/src/auth/local-origin.d.ts +2 -2
  25. package/dist/src/auth/local-token.d.ts +2 -2
  26. package/dist/src/auth/remote-error.d.ts +3 -0
  27. package/dist/src/config/config.d.ts +2 -2
  28. package/dist/src/config/credential/service.d.ts +2 -2
  29. package/dist/src/config/keystore/file.d.ts +1 -1
  30. package/dist/src/config/persist/migration.d.ts +3 -3
  31. package/dist/src/config/persist/persist.d.ts +4 -4
  32. package/dist/src/connection/error.d.ts +3 -1
  33. package/dist/src/connection/prepared.d.ts +14 -0
  34. package/dist/src/domain/helpers.d.ts +46 -51
  35. package/dist/src/domain/model-config.d.ts +91 -86
  36. package/dist/src/domain/thread-lifecycle.d.ts +23 -28
  37. package/dist/src/orchestration/layer.d.ts +308 -523
  38. package/dist/src/rpc/error.d.ts +4 -6
  39. package/dist/src/rpc/index.d.ts +3 -2
  40. package/dist/src/rpc/layer.d.ts +1890 -2299
  41. package/dist/src/rpc/operation.d.ts +4 -6260
  42. package/dist/src/rpc/service.d.ts +1 -1
  43. package/dist/src/rpc/session.d.ts +22 -0
  44. package/dist/src/rpc/ws-group.d.ts +439 -1180
  45. package/dist/src/runtime/layer.d.ts +10 -10
  46. package/dist/src/sql/node-sqlite-client.d.ts +1 -1
  47. package/dist/t3tools.js +2 -2
  48. package/package.json +8 -7
  49. package/src/application/thread-wait.ts +4 -0
  50. package/src/auth/error.ts +2 -8
  51. package/src/auth/remote-error.ts +17 -0
  52. package/src/auth/transport.ts +45 -114
  53. package/src/connection/error.ts +4 -1
  54. package/src/connection/layer.ts +5 -2
  55. package/src/connection/prepared.ts +83 -0
  56. package/src/orchestration/layer.ts +2 -1
  57. package/src/rpc/error.ts +9 -16
  58. package/src/rpc/index.ts +3 -2
  59. package/src/rpc/layer.ts +17 -51
  60. package/src/rpc/operation.ts +16 -2
  61. package/src/rpc/service.ts +2 -1
  62. package/src/rpc/session.ts +168 -0
  63. package/src/rpc/ws-group.ts +12 -26
  64. package/src/runtime/layer.ts +6 -3
@@ -1,2 +1,2 @@
1
- import { B as T3ModelApplicationLive, Gm as T3ActionApplication, H as T3TerminalApplicationLive, Jm as T3ProjectApplication, Km as T3Application, L as T3ActionApplicationLive, R as T3ApplicationLive, U as T3ThreadApplicationLive, V as T3ProjectApplicationLive, W as makeT3Application, Xm as T3ThreadApplication, Ym as T3TerminalApplication, qm as T3ModelApplication, z as T3ApplicationSlicesLive } from "./shared.js";
1
+ import { B_ as T3ThreadApplication, F_ as T3ActionApplication, G as T3ApplicationLive, I_ as T3Application, J as T3ProjectApplicationLive, K as T3ApplicationSlicesLive, L_ as T3ModelApplication, R_ as T3ProjectApplication, W as T3ActionApplicationLive, X as T3ThreadApplicationLive, Y as T3TerminalApplicationLive, Z as makeT3Application, q as T3ModelApplicationLive, z_ as T3TerminalApplication } from "./shared.js";
2
2
  export { T3ActionApplication, T3ActionApplicationLive, T3Application, T3ApplicationLive, T3ApplicationSlicesLive, T3ModelApplication, T3ModelApplicationLive, T3ProjectApplication, T3ProjectApplicationLive, T3TerminalApplication, T3TerminalApplicationLive, T3ThreadApplication, T3ThreadApplicationLive, makeT3Application };
package/dist/auth.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as AuthLocalError, A as T3LocalAuthToken, C as T3AuthPairing, D as T3LocalAuth, E as parsePairingUrl, F as makeT3LocalAuthOrigin, Gp as T3Auth, M as makeT3LocalAuthToken, N as T3LocalAuthOrigin, O as T3LocalAuthLive, P as T3LocalAuthOriginLive, Q as AuthLocalDatabaseError, S as makeT3Auth, T as makeT3AuthPairing, Z as AuthConfigError, et as AuthLocalSecretError, j as T3LocalAuthTokenLive, k as makeT3LocalAuth, nt as AuthPairingUrlError, rt as AuthTransportError, tt as AuthLocalSigningError, w as T3AuthPairingLive, x as T3AuthLive } from "./shared.js";
1
+ import { A as T3LocalAuthToken, B as AuthLocalSecretError, C as T3AuthPairing, D as T3LocalAuth, E as parsePairingUrl, F as makeT3LocalAuthOrigin, Fg as T3Auth, H as AuthPairingUrlError, L as AuthConfigError, M as makeT3LocalAuthToken, N as T3LocalAuthOrigin, O as T3LocalAuthLive, P as T3LocalAuthOriginLive, R as AuthLocalDatabaseError, S as makeT3Auth, T as makeT3AuthPairing, U as AuthTransportError, V as AuthLocalSigningError, j as T3LocalAuthTokenLive, k as makeT3LocalAuth, w as T3AuthPairingLive, x as T3AuthLive, z as AuthLocalError } from "./shared.js";
2
2
  export { AuthConfigError, AuthLocalDatabaseError, AuthLocalError, AuthLocalSecretError, AuthLocalSigningError, AuthPairingUrlError, AuthTransportError, T3Auth, T3AuthLive, T3AuthPairing, T3AuthPairingLive, T3LocalAuth, T3LocalAuthLive, T3LocalAuthOrigin, T3LocalAuthOriginLive, T3LocalAuthToken, T3LocalAuthTokenLive, makeT3Auth, makeT3AuthPairing, makeT3LocalAuth, makeT3LocalAuthOrigin, makeT3LocalAuthToken, parsePairingUrl };
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as __toESM, i as __require, t as __commonJSMin } from "./rolldown-runtime.js";
3
- import { $_ as fromNullishOr, $g as fail, $h as FileSystem, $m as getGlobalFlagsForCommandPath, $p as layer$12, A_ as effect, Ag as endUnsafe, Ah as InvalidValue, Am as selfActionForceFlag, B_ as make$13, Bg as nominal, Bh as Struct, Bm as isAgentEnvironment, C_ as tapError, Cg as tap, Ch as string$1, Cm as envNameFlag, D_ as uninterruptible, Dg as make$9, Dh as isBoolean, Dm as projectFlag, E_ as try_, Eg as get$1, Eh as run$2, Em as modelFlags, F_ as sync$1, Fg as shutdown, Fh as Terminal, Fm as yesFlag, G_ as isResult, Gg as as, Gh as optionalKey, Gp as T3Auth, H_ as succeed$4, Hg as acquireRelease, Hh as decodeUnknownEffect, Hm as resolveOutputFormat, I_ as MinimumLogLevel, Ig as unbounded, Ih as isQuitError, Im as canRenderLiveTerminal, J_ as Service, Jg as catchFilter, Jh as fromReadable, Jp as resolveThreadId, K_ as isSuccess, Kg as asVoid, Kh as Crypto, Km as T3Application, Kp as resolveCommandProjectRef, L_ as _await, Lg as BadArgument, Lh as make$11, M_ as provide, Mg as make$10, Mh as UnknownSubcommand, Mm as threadFormatFlag, N_ as provideMerge, Ng as offer, Nh as UnrecognizedOption, Nm as waitFormatFlag, O_ as void_, Og as drain, Oh as isFalseValue, Om as projectPathFlag, P_ as succeed$2, Pg as offerUnsafe, Ph as isCliError, Pm as worktreeFlag, Q_ as flatMap$1, Qg as effectify, Qh as FileDescriptor, Qm as LogLevel, Qp as CliRuntime, R_ as doneUnsafe, Rg as badArgument, Rh as Literal, S_ as sync, Sg as succeed$5, Sh as optional$1, T_ as tryPromise, Tg as unwrap, Th as confirm, Tm as formatFlag, U_ as succeed$1, Ug as addFinalizer, Uh as decodeUnknownSync, Up as CliPath, V_ as makeUnsafe, Vg as makeRunMain, Vh as TaggedErrorClass, Vm as isInteractiveHumanTerminal, W_ as fail$2, Wg as andThen, Wh as fromJsonString, Wm as loadT3CliEnv, Wp as cliEnvironmentSetting, X_ as getUnsafe, Xg as catchTags, Xh as Path$1, Xp as ProjectLookupError, Y_ as empty$1, Yg as catchTag, Yh as fromWritable, Yp as resolveWorktreePath, Z_ as make$12, Zg as catch_, Zh as TypeId$3, Zm as BuiltIns, Zp as ThreadSessionError, __ as runFork, _g as runFold, _h as argumentKind, _v as pipe, a as BaseAppLayer, a_ as gen, ag as decodeText, ah as toImpl, av as match, b_ as succeed, bg as runLast, bh as isParam, c_ as map, cg as fromIterable, ch as choice, ct as layerNode$1, cv as Prototype, d_ as matchEffect, dg as map$1, dh as string$2, dt as layerNode, dv as isNotNull, e_ as flatMap, eg as FileTypeId, eh as getGlobalFlagsForCommandTree, em as T3Config, ev as fromUndefinedOr, f_ as orDie, fg as merge, fh as withDefault, fv as isNotUndefined, g_ as result$1, gg as runDrain, gh as Formatter, gt as threadStatus, gv as identity$1, h_ as provideService, hg as runCollect, hh as log, ht as latestAssistantMessage, hv as dual, i_ as forkScoped, ig as callback$1, ih as makeCommand, iv as isSome, j_ as mergeAll, jg as failCauseUnsafe, jh as ShowHelp, jm as threadFlag, k_ as fail$1, kg as isSink, kh as isTrueValue, km as replaceFlag, l_ as mapError, lg as fromQueue, lh as integer, lv as BaseProto, m_ as provideContext, mg as run$1, mh as error, mv as isUndefined, n_ as fnUntraced, ng as WatchBackend, nh as TypeId$4, nv as getOrUndefined, o_ as ignore, og as empty, oh as parseConfig, ov as none, p_ as provide$1, pg as mkString, ph as withDescription$1, pt as layer$13, pv as isNullish, q_ as succeed$3, qg as callback, qh as make$7, r_ as forEach, rg as make$8, rh as checkForDuplicateFlags, rv as isNone, s_ as interrupt, sg as filter, sh as boolean, sv as some, t_ as fn, tg as Size, th as getHelpForCommandPath, tv as getOrElse, u_ as match$1, ug as isStream, uh as optional$2, uv as hasProperty, v_ as scoped, vg as runForEach, vh as extractSingleParams, vv as pipeArguments, w_ as timeoutOrElse, wd as ProviderUserInputAnswers, wg as transduce, wh as variadic$1, wm as forceFlag, x_ as suspend, xg as splitLines, xh as mapEffect$1, y_ as serviceOption, yg as runHead, yh as isFlagParam, z_ as isDone, zg as systemError, zh as String$1 } from "./shared.js";
3
+ import { $_ as integer, $b as BaseProto, $v as fromQueue, $y as mapError, A_ as isAgentEnvironment, Ab as make$13, Av as Struct, Ay as nominal, Bb as getUnsafe, Bg as ProjectLookupError, Bv as Path$1, By as catchTags, C_ as waitFormatFlag, Cb as provideMerge, Cv as UnrecognizedOption, Cy as offer, Db as _await, Dv as make$11, Dy as BadArgument, E_ as canRenderLiveTerminal, Eb as MinimumLogLevel, Ev as isQuitError, Ey as unbounded, Fb as isResult, Fg as T3Auth, Fv as optionalKey, Fy as as, G_ as getHelpForCommandPath, Gb as getOrElse, Gv as Size, Gy as fn, H_ as LogLevel, Hb as flatMap$1, Hg as CliRuntime, Hv as FileDescriptor, Hy as effectify, I_ as T3Application, Ib as isSuccess, Ig as resolveCommandProjectRef, Iv as Crypto, Iy as asVoid, J_ as makeCommand, Jb as isSome, Jv as callback$1, Jy as forkScoped, K_ as TypeId$4, Kb as getOrUndefined, Kv as WatchBackend, Ky as fnUntraced, Lb as succeed$3, Lv as make$7, Ly as callback, M_ as resolveOutputFormat, Mb as succeed$4, Mv as decodeUnknownEffect, My as acquireRelease, Nb as succeed$1, Ng as CliPath, Nv as decodeUnknownSync, Ny as addFinalizer, Ob as doneUnsafe, Ov as Literal, Oy as badArgument, P_ as loadT3CliEnv, Pb as fail$2, Pg as cliEnvironmentSetting, Pv as fromJsonString, Py as andThen, Q_ as choice, Qb as Prototype, Qv as fromIterable, Qy as map, Rb as Service, Rg as resolveThreadId, Rv as fromReadable, Ry as catchFilter, S_ as threadFormatFlag, Sb as provide, Sv as UnknownSubcommand, Sy as make$10, T_ as yesFlag, Tb as sync$1, Tv as Terminal, Ty as shutdown, U_ as getGlobalFlagsForCommandPath, Ub as fromNullishOr, Ug as layer$12, Uv as FileSystem, Uy as fail, V_ as BuiltIns, Vb as make$12, Vg as ThreadSessionError, Vv as TypeId$3, Vy as catch_, W_ as getGlobalFlagsForCommandTree, Wb as fromUndefinedOr, Wg as T3Config, Wv as FileTypeId, Wy as flatMap, X_ as parseConfig, Xb as none, Xv as empty, Xy as ignore, Y_ as toImpl, Yb as match, Yv as decodeText, Yy as gen, Z_ as boolean, Zb as some, Zv as filter, Zy as interrupt, __ as projectFlag, _b as uninterruptible, _v as isBoolean, _y as make$9, a as BaseAppLayer, ab as provideService, av as log, ax as dual, ay as runCollect, b_ as selfActionForceFlag, bb as effect, bv as InvalidValue, by as endUnsafe, cb as scoped, ct as layerNode$1, cv as extractSingleParams, cx as pipeArguments, cy as runForEach, db as suspend, dt as layerNode, dv as mapEffect$1, dy as splitLines, eb as match$1, em as ProviderUserInputAnswers, ev as optional$2, ex as hasProperty, ey as isStream, fb as sync, fv as optional$1, fy as succeed$5, g_ as modelFlags, gb as try_, gt as threadStatus, gv as run$2, gy as get$1, h_ as formatFlag, hb as tryPromise, ht as latestAssistantMessage, hv as confirm, hy as unwrap, ib as provideContext, iv as error, ix as isUndefined, iy as run$1, j_ as isInteractiveHumanTerminal, jb as makeUnsafe, jv as TaggedErrorClass, jy as makeRunMain, kb as isDone, kv as String$1, ky as systemError, lb as serviceOption, lv as isFlagParam, ly as runHead, m_ as forceFlag, mb as timeoutOrElse, mv as variadic$1, my as transduce, nb as orDie, nv as withDefault, nx as isNotUndefined, ny as merge, ob as result$1, ov as Formatter, ox as identity$1, oy as runDrain, p_ as envNameFlag, pb as tapError, pt as layer$13, pv as string$1, py as tap, q_ as checkForDuplicateFlags, qb as isNone, qv as make$8, qy as forEach, rb as provide$1, rv as withDescription$1, rx as isNullish, ry as mkString, sb as runFork, sv as argumentKind, sx as pipe, sy as runFold, tb as matchEffect, tv as string$2, tx as isNotNull, ty as map$1, ub as succeed, uv as isParam, uy as runLast, v_ as projectPathFlag, vb as void_, vv as isFalseValue, vy as drain, w_ as worktreeFlag, wb as succeed$2, wv as isCliError, wy as offerUnsafe, x_ as threadFlag, xb as mergeAll, xv as ShowHelp, xy as failCauseUnsafe, y_ as replaceFlag, yb as fail$1, yv as isTrueValue, yy as isSink, zb as empty$1, zg as resolveWorktreePath, zv as fromWritable, zy as catchTag } from "./shared.js";
4
4
  import * as OS from "node:os";
5
5
  import os, { homedir } from "node:os";
6
6
  import * as NodeChildProcess from "node:child_process";
@@ -310,7 +310,8 @@ const parseTemplate = (templates, expressions, prevTokens, template, index) => {
310
310
  const nextTokens = concatTokens(prevTokens, tokens, hasLeadingWhitespace);
311
311
  if (index === expressions.length) return nextTokens;
312
312
  const expression = expressions[index];
313
- return concatTokens(nextTokens, Array.isArray(expression) ? expression.map((expression) => parseExpression(expression)) : [parseExpression(expression)], hasTrailingWhitespace);
313
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression) => parseExpression(expression)) : [parseExpression(expression)];
314
+ return concatTokens(nextTokens, expressionTokens, hasTrailingWhitespace);
314
315
  };
315
316
  /**
316
317
  * Convert valid expressions defined in a template string command (i.e. using
@@ -631,7 +632,10 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
631
632
  } catch {}
632
633
  };
633
634
  const killProcess = (command, childProcess, signal) => suspend(() => {
634
- if (!childProcess.kill(signal)) return fail(toPlatformError("kill", new globalThis.Error("Failed to kill child process"), command));
635
+ if (!childProcess.kill(signal)) {
636
+ const error = new globalThis.Error("Failed to kill child process");
637
+ return fail(toPlatformError("kill", error, command));
638
+ }
635
639
  return void_;
636
640
  });
637
641
  const withTimeout = (childProcess, command, options) => (kill) => {
@@ -667,10 +671,13 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
667
671
  const resolvedAdditionalFds = resolveAdditionalFds(cmd.options);
668
672
  let isReferenced = true;
669
673
  let cleanupOnNonZeroExit = false;
674
+ const cwd = yield* resolveWorkingDirectory(cmd.options);
675
+ const env = resolveEnvironment(cmd.options);
676
+ const stdio = buildStdioArray(stdinConfig, stdoutConfig, stderrConfig, resolvedAdditionalFds);
670
677
  const [childProcess, exitSignal] = yield* acquireRelease(spawn(cmd, {
671
- cwd: yield* resolveWorkingDirectory(cmd.options),
672
- env: resolveEnvironment(cmd.options),
673
- stdio: buildStdioArray(stdinConfig, stdoutConfig, stderrConfig, resolvedAdditionalFds),
678
+ cwd,
679
+ env,
680
+ stdio,
674
681
  detached: cmd.options.detached ?? process.platform !== "win32",
675
682
  shell: cmd.options.shell
676
683
  }), fnUntraced(function* ([childProcess, exitSignal]) {
@@ -709,7 +716,8 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
709
716
  const isRunning = map(isDone(exitSignal), (done) => !done);
710
717
  const exitCode = flatMap(_await(exitSignal), ([code, signal]) => {
711
718
  if (isNotNull(code)) return succeed(ExitCode(code));
712
- return fail(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: '${signal}'`), cmd));
719
+ const error = new globalThis.Error(`Process interrupted due to receipt of signal: '${signal}'`);
720
+ return fail(toPlatformError("exitCode", error, cmd));
713
721
  });
714
722
  const kill = (options) => {
715
723
  return withTimeout(childProcess, cmd, options)((command, childProcess, signal) => catch_(killProcessGroup(command, childProcess, signal), () => killProcess(command, childProcess, signal))).pipe(andThen(_await(exitSignal)), asVoid);
@@ -1113,7 +1121,7 @@ const makeTempFileFactory = (method) => {
1113
1121
  const directory = yield* makeDirectory(options);
1114
1122
  const random = NodeCrypto.randomBytes(6).toString("hex");
1115
1123
  const name = Path.join(directory, options?.suffix ? `${random}${options.suffix}` : random);
1116
- yield* writeFile(name, new Uint8Array(0));
1124
+ yield* writeFile(name, /* @__PURE__ */ new Uint8Array(0));
1117
1125
  return name;
1118
1126
  });
1119
1127
  };
@@ -1827,23 +1835,25 @@ const parseArgs = (lexResult, command, commandPath = []) => gen(function* () {
1827
1835
  const inheritedFlagParams = commandImpl.contextConfig.flags.flatMap(extractSingleParams).filter(isFlagParam);
1828
1836
  const inheritedFlagRegistry = createFlagRegistry(inheritedFlagParams);
1829
1837
  const inheritedNames = new Set(inheritedFlagParams.map((param) => param.name));
1830
- const result = scanCommandLevel(tokens, {
1838
+ const context = {
1831
1839
  command,
1832
1840
  commandPath: newCommandPath,
1833
1841
  flagRegistry,
1834
1842
  inheritedFlagRegistry,
1835
1843
  localFlagNames: flagParams.filter((param) => !inheritedNames.has(param.name)).map((param) => param.name)
1836
- });
1844
+ };
1845
+ const result = scanCommandLevel(tokens, context);
1837
1846
  if (result._tag === "Leaf") return {
1838
1847
  flags: result.flags,
1839
1848
  arguments: [...result.arguments, ...afterEndOfOptions],
1840
1849
  subcommand: none(),
1841
1850
  ...result.errors.length > 0 && { errors: result.errors }
1842
1851
  };
1843
- const subParsed = yield* parseArgs({
1852
+ const subLex = {
1844
1853
  tokens: result.childTokens,
1845
1854
  trailingOperands: []
1846
- }, result.sub, newCommandPath);
1855
+ };
1856
+ const subParsed = yield* parseArgs(subLex, result.sub, newCommandPath);
1847
1857
  const allErrors = [...result.errors, ...subParsed.errors ?? []];
1848
1858
  return {
1849
1859
  flags: result.flags,
@@ -2512,7 +2522,7 @@ const withSubcommands = /*#__PURE__*/ dual(2, (self, subcommands) => {
2512
2522
  */
2513
2523
  const withGlobalFlags = /*#__PURE__*/ dual(2, (self, globalFlags) => {
2514
2524
  const impl = toImpl(self);
2515
- const next = Array.from(new Set([...impl.globalFlags, ...globalFlags]));
2525
+ const next = Array.from(/* @__PURE__ */ new Set([...impl.globalFlags, ...globalFlags]));
2516
2526
  return makeCommand({
2517
2527
  ...impl,
2518
2528
  globalFlags: next
@@ -2657,7 +2667,9 @@ const runWith = (command, config) => {
2657
2667
  return fnUntraced(function* (args) {
2658
2668
  const { tokens, trailingOperands } = lex(args);
2659
2669
  const allFlags = getGlobalFlagsForCommandTree(command, BuiltIns);
2660
- const { flagMap, remainder, errors: globalFlagErrors } = consumeGlobalFlags(tokens, command, createFlagRegistry(allFlags.flatMap((f) => extractSingleParams(f.flag)).filter(isFlagParam)));
2670
+ const allFlagParams = allFlags.flatMap((f) => extractSingleParams(f.flag));
2671
+ const globalRegistry = createFlagRegistry(allFlagParams.filter(isFlagParam));
2672
+ const { flagMap, remainder, errors: globalFlagErrors } = consumeGlobalFlags(tokens, command, globalRegistry);
2661
2673
  const emptyArgs = {
2662
2674
  flags: flagMap,
2663
2675
  arguments: []
@@ -65042,7 +65054,7 @@ var require_templates = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65042
65054
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
65043
65055
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
65044
65056
  const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
65045
- const ESCAPES = new Map([
65057
+ const ESCAPES = /* @__PURE__ */ new Map([
65046
65058
  ["n", "\n"],
65047
65059
  ["r", "\r"],
65048
65060
  ["t", " "],
@@ -84241,7 +84253,7 @@ var require_char_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84241
84253
  //#endregion
84242
84254
  //#region node_modules/.pnpm/unicode-emoji-modifier-base@1.0.0/node_modules/unicode-emoji-modifier-base/index.js
84243
84255
  var require_unicode_emoji_modifier_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84244
- module.exports = new Set([
84256
+ module.exports = /* @__PURE__ */ new Set([
84245
84257
  9757,
84246
84258
  9977,
84247
84259
  9994,
@@ -84331,7 +84343,7 @@ var require_unicode_emoji_modifier_base = /* @__PURE__ */ __commonJSMin(((export
84331
84343
  //#region node_modules/.pnpm/skin-tone@2.0.0/node_modules/skin-tone/index.js
84332
84344
  var require_skin_tone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84333
84345
  const emojiModifierBase = require_unicode_emoji_modifier_base();
84334
- const skinTones = new Map([
84346
+ const skinTones = /* @__PURE__ */ new Map([
84335
84347
  ["none", ""],
84336
84348
  ["white", "🏻"],
84337
84349
  ["creamWhite", "🏼"],
@@ -84493,7 +84505,9 @@ var COLON_REPLACER = "*#COLON|*";
84493
84505
  var COLON_REPLACER_REGEXP = new RegExp(escapeRegExp(COLON_REPLACER), "g");
84494
84506
  var TAB_ALLOWED_CHARACTERS = [" "];
84495
84507
  var ANSI_REGEXP = ansiRegex();
84496
- var HARD_RETURN = "\r", HARD_RETURN_RE = new RegExp(HARD_RETURN), HARD_RETURN_GFM_RE = new RegExp(HARD_RETURN + "|<br />");
84508
+ var HARD_RETURN = "\r";
84509
+ var HARD_RETURN_RE = new RegExp(HARD_RETURN);
84510
+ var HARD_RETURN_GFM_RE = new RegExp(HARD_RETURN + "|<br />");
84497
84511
  var defaultOptions = {
84498
84512
  code: chalk.yellow,
84499
84513
  blockquote: chalk.gray.italic,
@@ -85609,21 +85623,22 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
85609
85623
  return 1;
85610
85624
  }
85611
85625
  //#endregion
85612
- //#region node_modules/.pnpm/string-width@8.2.1/node_modules/string-width/index.js
85626
+ //#region node_modules/.pnpm/string-width@8.2.2/node_modules/string-width/index.js
85613
85627
  /**
85614
85628
  Logic:
85615
85629
  - Segment graphemes to match how terminals render clusters.
85616
85630
  - Width rules:
85617
- 1. Skip non-printing clusters (Default_Ignorable, Control, pure Mark, lone Surrogates). Tabs are ignored by design.
85631
+ 1. Skip non-printing clusters (Default_Ignorable, Control, pure nonspacing/enclosing Mark, lone Surrogates). Tabs are ignored by design.
85618
85632
  2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
85619
85633
  3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
85620
85634
  4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
85621
85635
  Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
85622
- 5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
85636
+ 5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing spacing marks and Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
85623
85637
  */
85624
85638
  const segmenter$1 = new Intl.Segmenter();
85625
- const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v;
85626
- const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
85639
+ const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
85640
+ const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
85641
+ const spacingMarkRegex = /\p{Spacing_Mark}/v;
85627
85642
  const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
85628
85643
  const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
85629
85644
  const extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
@@ -85678,7 +85693,7 @@ function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
85678
85693
  }
85679
85694
  return width;
85680
85695
  }
85681
- function trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions) {
85696
+ function trailingWidth(visibleSegment, eastAsianWidthOptions) {
85682
85697
  let extra = 0;
85683
85698
  let first = true;
85684
85699
  for (const character of visibleSegment) {
@@ -85686,7 +85701,7 @@ function trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions) {
85686
85701
  first = false;
85687
85702
  continue;
85688
85703
  }
85689
- if (character >= "＀" && character <= "￯") extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
85704
+ if (spacingMarkRegex.test(character) || character >= "＀" && character <= "￯") extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
85690
85705
  }
85691
85706
  return extra;
85692
85707
  }
@@ -85713,7 +85728,7 @@ function stringWidth(input, options = {}) {
85713
85728
  }
85714
85729
  const codePoint = visibleSegment.codePointAt(0);
85715
85730
  width += eastAsianWidth(codePoint, eastAsianWidthOptions);
85716
- width += trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions);
85731
+ width += trailingWidth(visibleSegment, eastAsianWidthOptions);
85717
85732
  }
85718
85733
  return width;
85719
85734
  }
@@ -85885,7 +85900,7 @@ const ansiStyles = assembleStyles();
85885
85900
  //#region node_modules/.pnpm/wrap-ansi@10.0.0/node_modules/wrap-ansi/index.js
85886
85901
  const ANSI_ESCAPE = "\x1B";
85887
85902
  const ANSI_ESCAPE_CSI = "›";
85888
- const ESCAPES = new Set([ANSI_ESCAPE, ANSI_ESCAPE_CSI]);
85903
+ const ESCAPES = /* @__PURE__ */ new Set([ANSI_ESCAPE, ANSI_ESCAPE_CSI]);
85889
85904
  const ANSI_ESCAPE_BELL = "\x07";
85890
85905
  const ANSI_CSI = "[";
85891
85906
  const ANSI_OSC = "]";
@@ -87322,9 +87337,10 @@ const pairCommand = make("pair", {
87322
87337
  const output = yield* T3Output;
87323
87338
  const resolvedFormat = resolveOutputFormat(format, cliRuntime, t3CliEnv, "json");
87324
87339
  const result = yield* auth.pair(url);
87340
+ const fallbackName = yield* auth.defaultNameFromUrl(result.url);
87325
87341
  const environmentName = yield* persistAuthEnvironment({
87326
87342
  explicitName: name,
87327
- fallbackName: yield* auth.defaultNameFromUrl(result.url),
87343
+ fallbackName,
87328
87344
  url: result.url,
87329
87345
  token: result.token,
87330
87346
  local,
@@ -87360,9 +87376,10 @@ const localCommand = make("local", {
87360
87376
  ...isSome(baseDir) ? { baseDir: baseDir.value } : {},
87361
87377
  ...isSome(origin) ? { origin: origin.value } : {}
87362
87378
  });
87379
+ const fallbackName = yield* auth.defaultNameForLocal();
87363
87380
  const environmentName = yield* persistAuthEnvironment({
87364
87381
  explicitName: name,
87365
- fallbackName: yield* auth.defaultNameForLocal(),
87382
+ fallbackName,
87366
87383
  url: result.url,
87367
87384
  token: result.token,
87368
87385
  local: true,
@@ -89019,7 +89036,7 @@ const T3InputLive = effect(T3Input, fn("makeT3Input")(function* () {
89019
89036
  })) }));
89020
89037
  }),
89021
89038
  readStdinBinary: fn("T3InputLive.readStdinBinary")(function* () {
89022
- return yield* stdio.stdin.pipe(runFold(() => new Uint8Array(0), (acc, chunk) => {
89039
+ return yield* stdio.stdin.pipe(runFold(() => /* @__PURE__ */ new Uint8Array(0), (acc, chunk) => {
89023
89040
  const merged = new Uint8Array(acc.length + chunk.length);
89024
89041
  merged.set(acc);
89025
89042
  merged.set(chunk, acc.length);
@@ -89131,7 +89148,7 @@ var T3Version = class extends Service()("t3cli/T3Version") {};
89131
89148
  //#endregion
89132
89149
  //#region src/version/layer.ts
89133
89150
  const PackageJsonSchema = fromJsonString(Struct({ version: String$1 }));
89134
- const T3VersionBundledLive = sync$1(T3Version, () => ({ version: "0.12.0" }));
89151
+ const T3VersionBundledLive = sync$1(T3Version, () => ({ version: "0.13.0" }));
89135
89152
  effect(T3Version, gen(function* () {
89136
89153
  const packageJson = yield* (yield* FileSystem).readFileString(fileURLToPath(new URL("../../package.json", import.meta.url)));
89137
89154
  return { version: (yield* decodeUnknownEffect(PackageJsonSchema)(packageJson)).version };
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime.js";
2
- import { $p as layer, Bm as isAgentEnvironment, Dm as projectFlag, Em as modelFlags, Hm as resolveOutputFormat, Im as canRenderLiveTerminal, Jp as resolveThreadId, Kp as resolveCommandProjectRef, Lm as humanJsonFormatChoices, Mm as threadFormatFlag, Nm as waitFormatFlag, Om as projectPathFlag, Pm as worktreeFlag, Qp as CliRuntime, Rm as humanJsonNdjsonFormatChoices, Tm as formatFlag, Vm as isInteractiveHumanTerminal, Wp as cliEnvironmentSetting, Yp as resolveWorktreePath, jm as threadFlag, mt as selection_layer_exports, qp as resolveProjectRef, zm as humanNdjsonFormatChoices } from "./shared.js";
2
+ import { A_ as isAgentEnvironment, C_ as waitFormatFlag, D_ as humanJsonFormatChoices, E_ as canRenderLiveTerminal, Hg as CliRuntime, Ig as resolveCommandProjectRef, Lg as resolveProjectRef, M_ as resolveOutputFormat, O_ as humanJsonNdjsonFormatChoices, Pg as cliEnvironmentSetting, Rg as resolveThreadId, S_ as threadFormatFlag, Ug as layer, __ as projectFlag, g_ as modelFlags, h_ as formatFlag, j_ as isInteractiveHumanTerminal, k_ as humanNdjsonFormatChoices, mt as selection_layer_exports, v_ as projectPathFlag, w_ as worktreeFlag, x_ as threadFlag, zg as resolveWorktreePath } from "./shared.js";
3
3
  //#region src/cli/env/index.ts
4
4
  var env_exports = /* @__PURE__ */ __exportAll({
5
5
  Selection: () => selection_layer_exports,
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime.js";
2
- import { $g as fail, I as resolveT3BaseDir, P_ as succeed, Sm as credentialTokenFromEnv, T_ as tryPromise, Um as T3CliEnvConfig, Wm as loadT3CliEnv, _m as resolveT3cliConfigDir, a_ as gen, am as migrateV1EnvironmentName, bm as T3CredentialCipher, cm as normalizeHttpBaseUrl, dm as toWebSocketEndpointUrl, fm as UrlError, ft as CredentialCipherError, gm as resolveKeyFilePath, hm as resolveConfigFilePath, im as defaultEnvironmentNameFromUrl, lm as toHttpEndpointUrl, lt as KeystoreUnavailableError, mm as file_exports, nm as service_exports$2, om as slugifyEnvironmentName, pm as service_exports, rm as defaultEnvironmentNameForLocal, sm as validateEnvironmentName, st as keyring_node_exports, tm as config_exports, um as toWebSocketBaseUrl, ut as cipher_node_exports, vm as service_exports$1, xm as cipher_exports, ym as ConfigError } from "./shared.js";
2
+ import { $g as toHttpEndpointUrl, Gg as config_exports, I as resolveT3BaseDir, Jg as defaultEnvironmentNameFromUrl, Kg as service_exports$2, N_ as T3CliEnvConfig, P_ as loadT3CliEnv, Qg as normalizeHttpBaseUrl, Uy as fail, Xg as slugifyEnvironmentName, Yg as migrateV1EnvironmentName, Yy as gen, Zg as validateEnvironmentName, a_ as resolveConfigFilePath, c_ as service_exports$1, d_ as cipher_exports, e_ as toWebSocketBaseUrl, f_ as credentialTokenFromEnv, ft as CredentialCipherError, hb as tryPromise, i_ as file_exports, l_ as ConfigError, lt as KeystoreUnavailableError, n_ as UrlError, o_ as resolveKeyFilePath, qg as defaultEnvironmentNameForLocal, r_ as service_exports, s_ as resolveT3cliConfigDir, st as keyring_node_exports, t_ as toWebSocketEndpointUrl, u_ as T3CredentialCipher, ut as cipher_node_exports, wb as succeed } from "./shared.js";
3
3
  //#region src/config/credential/cipher-web.ts
4
4
  var cipher_web_exports = /* @__PURE__ */ __exportAll({ layerWeb: () => layerWeb });
5
5
  const aesGcmAlgorithm = "AES-GCM";
@@ -1,2 +1,2 @@
1
- import { X as T3CodeConnectionError, b as makeT3CodeConnectionProvider, n as makeT3CodeRpcLayer, t as T3CodeRpcLayer, v as T3CodeConnectionProvider, y as T3CodeConnectionProviderLive } from "./shared.js";
1
+ import { b as makeT3CodeConnectionProvider, n as makeT3CodeRpcLayer, rt as T3CodeConnectionError, t as T3CodeRpcLayer, v as T3CodeConnectionProvider, y as T3CodeConnectionProviderLive } from "./shared.js";
2
2
  export { T3CodeConnectionError, T3CodeConnectionProvider, T3CodeConnectionProviderLive, T3CodeRpcLayer, makeT3CodeConnectionProvider, makeT3CodeRpcLayer };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { Km as T3Application, i as AuthAppLayer, r as AppLayer } from "./shared.js";
1
+ import { I_ as T3Application, i as AuthAppLayer, r as AppLayer } from "./shared.js";
2
2
  export { AppLayer, AuthAppLayer, T3Application };
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { M_ as provide, at as layerWebSocketConstructor, j_ as mergeAll, ot as layerUndici, t as T3CodeRpcLayer } from "./shared.js";
1
+ import { Sb as provide, at as layerWebSocketConstructor, ot as layerUndici, t as T3CodeRpcLayer, xb as mergeAll } from "./shared.js";
2
2
  //#region src/node/connection.ts
3
3
  const NodeConnectionPlatformLayer = mergeAll(layerUndici, layerWebSocketConstructor);
4
4
  const T3CodeNodeRpcLayer = T3CodeRpcLayer.pipe(provide(NodeConnectionPlatformLayer));
@@ -31,6 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  value: mod,
32
32
  enumerable: true
33
33
  }) : target, mod));
34
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
34
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
35
35
  //#endregion
36
36
  export { __toESM as a, __require as i, __exportAll as n, __reExport as r, __commonJSMin as t };
package/dist/rpc.js CHANGED
@@ -1,2 +1,2 @@
1
- import { G as T3RpcOperations, J as T3Rpc, K as T3RpcOperationsLive, Y as RpcError, h as makeT3RpcLayer, m as T3RpcLive, q as makeT3RpcOperations } from "./shared.js";
1
+ import { $ as T3RpcOperationsLive, Q as T3RpcOperations, et as makeT3RpcOperations, h as makeT3RpcLayer, m as T3RpcLive, nt as RpcError, tt as T3Rpc } from "./shared.js";
2
2
  export { RpcError, T3Rpc, T3RpcLive, T3RpcOperations, T3RpcOperationsLive, makeT3RpcLayer, makeT3RpcOperations };