t3 0.0.3 → 0.0.4

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 (83) hide show
  1. package/dist/client/assets/DiffPanel-DxvQMXZW.js +1491 -0
  2. package/dist/client/assets/{angular-html-shv80_GZ.js → angular-html-PO6YH8f-.js} +1 -1
  3. package/dist/client/assets/{angular-ts-BjWAylHW.js → angular-ts-DaJ2RvnO.js} +1 -1
  4. package/dist/client/assets/{apl-CkYWz8C0.js → apl-zEuTt-He.js} +1 -1
  5. package/dist/client/assets/{astro-CXyQY2Fi.js → astro-DwysnkhD.js} +1 -1
  6. package/dist/client/assets/{blade-CDM8qZbe.js → blade-GgAGAlM8.js} +1 -1
  7. package/dist/client/assets/{c-CUmJm7m_.js → c-DzeHBMp7.js} +1 -1
  8. package/dist/client/assets/{cobol-wxQNEWxu.js → cobol-iVCIJtWR.js} +1 -1
  9. package/dist/client/assets/{coffee-2P2zwF_h.js → coffee-BxMkYhOP.js} +1 -1
  10. package/dist/client/assets/{cpp-BTyeRVXV.js → cpp-BEfmDGKr.js} +1 -1
  11. package/dist/client/assets/{crystal-frSE8Mxi.js → crystal-CGJ9U7K8.js} +1 -1
  12. package/dist/client/assets/{css-BgTyfICB.js → css-D-J6muk9.js} +1 -1
  13. package/dist/client/assets/{edge-BY65SEnm.js → edge-B5l1ep6K.js} +1 -1
  14. package/dist/client/assets/{elixir-BLt8zeU8.js → elixir-DT7C4nRI.js} +1 -1
  15. package/dist/client/assets/{elm-CsZMXfMm.js → elm-DacHZu0P.js} +1 -1
  16. package/dist/client/assets/{erb-D78ZlEy1.js → erb-B4qeW_5R.js} +1 -1
  17. package/dist/client/assets/{git-rebase-DvAgC2qb.js → git-rebase-Dk3SbS0p.js} +1 -1
  18. package/dist/client/assets/{glimmer-js-ComKKhUt.js → glimmer-js-DEVFfhxl.js} +1 -1
  19. package/dist/client/assets/{glimmer-ts-CHaw-kHb.js → glimmer-ts-CsEJRls5.js} +1 -1
  20. package/dist/client/assets/{glsl-CzysIiSS.js → glsl-Im5_mbH8.js} +1 -1
  21. package/dist/client/assets/{graphql-JB5TILB9.js → graphql-DrNOYYdo.js} +1 -1
  22. package/dist/client/assets/{hack-BBDevESF.js → hack-D53MnsWT.js} +1 -1
  23. package/dist/client/assets/{haml-RVvrlpmx.js → haml-B4euY0vY.js} +1 -1
  24. package/dist/client/assets/{handlebars-B6i0Kg7r.js → handlebars-CtMln1GB.js} +1 -1
  25. package/dist/client/assets/{html-Cqmhl3Dv.js → html-B7CTON1n.js} +1 -1
  26. package/dist/client/assets/{html-derivative-D3F6P6wT.js → html-derivative-DwHkcKJ3.js} +1 -1
  27. package/dist/client/assets/{http-94c20x_x.js → http-BmGf_D9h.js} +1 -1
  28. package/dist/client/assets/{hurl-CoBvslGX.js → hurl-nnTeLb9y.js} +1 -1
  29. package/dist/client/assets/index-D2CnaX3V.css +1 -0
  30. package/dist/client/assets/{index-CWbABLMQ.js → index-nhQz5h-9.js} +79 -79
  31. package/dist/client/assets/{java-NRmbTstg.js → java-d7p4YLBX.js} +1 -1
  32. package/dist/client/assets/{javascript-clEikEAO.js → javascript-BcWERNKv.js} +1 -1
  33. package/dist/client/assets/{jinja-Zxps0pS4.js → jinja-CB7zbi6K.js} +1 -1
  34. package/dist/client/assets/{jison-CW-VQKc0.js → jison-BBAjjhmY.js} +1 -1
  35. package/dist/client/assets/{json-t_Zs8_eG.js → json-CNf-D-Ai.js} +1 -1
  36. package/dist/client/assets/{jsx-CUmrXn6v.js → jsx-DdT20ddY.js} +1 -1
  37. package/dist/client/assets/{julia-BZtXsPO1.js → julia-Bp0laiQT.js} +1 -1
  38. package/dist/client/assets/{just-DbayLjXg.js → just-C2n1JzZf.js} +1 -1
  39. package/dist/client/assets/{latex-Bx9vQriq.js → latex-BX6qSGK7.js} +1 -1
  40. package/dist/client/assets/{liquid-B9_lc15A.js → liquid-DgouKodz.js} +1 -1
  41. package/dist/client/assets/{lua-D7ivNc2F.js → lua-B-JF8LJ7.js} +1 -1
  42. package/dist/client/assets/{marko-CKTUP3wb.js → marko-DdaUBozC.js} +1 -1
  43. package/dist/client/assets/{mdc-DFmdtGcy.js → mdc-Tak-aC9z.js} +1 -1
  44. package/dist/client/assets/{nginx-B6XJm_FX.js → nginx-C26ntnSE.js} +1 -1
  45. package/dist/client/assets/{nim-D0sDLUjH.js → nim-KDX5BPuj.js} +1 -1
  46. package/dist/client/assets/{perl-BPnjaHZd.js → perl-BwpIuvHY.js} +1 -1
  47. package/dist/client/assets/{php-xnmFg-xe.js → php-CmeyInUZ.js} +1 -1
  48. package/dist/client/assets/{pug-C-ps4Q3A.js → pug-t16F4unN.js} +1 -1
  49. package/dist/client/assets/{qml-Blgq0sES.js → qml-DKXIwoU2.js} +1 -1
  50. package/dist/client/assets/{r-Bw2YX0iz.js → r-Bm5SLw35.js} +1 -1
  51. package/dist/client/assets/{razor-CVMxbgJD.js → razor-Cg7E03DE.js} +1 -1
  52. package/dist/client/assets/{regexp-BfboaxDC.js → regexp-B4BXgdkL.js} +1 -1
  53. package/dist/client/assets/{rst-DSEOyg4a.js → rst-CErMU3C_.js} +1 -1
  54. package/dist/client/assets/{ruby-BHaAeBnD.js → ruby-C-LB4XJd.js} +1 -1
  55. package/dist/client/assets/{sas-De8g3GnH.js → sas-KXri-Pyv.js} +1 -1
  56. package/dist/client/assets/{scss-WFF9AEc1.js → scss-5RriKTs7.js} +1 -1
  57. package/dist/client/assets/{shellscript-D0b3xhF8.js → shellscript-d2-2QqxY.js} +1 -1
  58. package/dist/client/assets/{shellsession-CEPeMTvi.js → shellsession-BBXyPthj.js} +1 -1
  59. package/dist/client/assets/{soy-CkuE1c8h.js → soy-B5WN_6xP.js} +1 -1
  60. package/dist/client/assets/{sql-CBLYRRTG.js → sql-ByWEVmCC.js} +1 -1
  61. package/dist/client/assets/{stata-CHnQmpJo.js → stata-ZtX2PbNh.js} +1 -1
  62. package/dist/client/assets/{surrealql-2jE3UuBR.js → surrealql-DIyL-cuf.js} +1 -1
  63. package/dist/client/assets/{svelte-18k8aay7.js → svelte-Dv8xlo7a.js} +1 -1
  64. package/dist/client/assets/{templ-C_KMacdx.js → templ-DEm7cZue.js} +1 -1
  65. package/dist/client/assets/{tex-BVp_GiMd.js → tex-GXsn56xP.js} +1 -1
  66. package/dist/client/assets/{ts-tags-Bi_bBn8w.js → ts-tags-ByCXY4T3.js} +1 -1
  67. package/dist/client/assets/{tsx-B7mt-RUJ.js → tsx-By_LD9k9.js} +1 -1
  68. package/dist/client/assets/{twig-DhHOZ6Vd.js → twig-Du6sgCzz.js} +1 -1
  69. package/dist/client/assets/{typescript-LV7sesr2.js → typescript-DodIuvim.js} +1 -1
  70. package/dist/client/assets/{vue-mzEQ7_PJ.js → vue-D-NASAgP.js} +1 -1
  71. package/dist/client/assets/{vue-html-UCqCdVGl.js → vue-html-xVY24NdN.js} +1 -1
  72. package/dist/client/assets/{vue-vine-Dnznzfmf.js → vue-vine-D6iwmyYT.js} +1 -1
  73. package/dist/client/assets/{xml-3N76prFb.js → xml-Bnub5Bnx.js} +1 -1
  74. package/dist/client/assets/{xsl-Ckd3D0dQ.js → xsl-gWFBcUcI.js} +1 -1
  75. package/dist/client/assets/{yaml-det4gTgr.js → yaml-Bh8YueBH.js} +1 -1
  76. package/dist/client/index.html +2 -2
  77. package/dist/index.cjs +96 -17
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.mjs +96 -17
  80. package/dist/index.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/dist/client/assets/DiffPanel-D4FZnMmT.js +0 -1491
  83. package/dist/client/assets/index-DtnLdTtl.css +0 -1
package/dist/index.mjs CHANGED
@@ -194,22 +194,44 @@ const resolveStaticDir = Effect.fn(function* () {
194
194
  if (yield* exists(join(monorepoClient, "index.html")).pipe(Effect.orElseSucceed(() => false))) return monorepoClient;
195
195
  });
196
196
 
197
+ //#endregion
198
+ //#region ../../packages/shared/src/shell.ts
199
+ const PATH_CAPTURE_START = "__T3CODE_PATH_START__";
200
+ const PATH_CAPTURE_END = "__T3CODE_PATH_END__";
201
+ const PATH_CAPTURE_COMMAND = [
202
+ `printf '%s\n' '${PATH_CAPTURE_START}'`,
203
+ "printenv PATH",
204
+ `printf '%s\n' '${PATH_CAPTURE_END}'`
205
+ ].join("; ");
206
+ function extractPathFromShellOutput(output) {
207
+ const startIndex = output.indexOf(PATH_CAPTURE_START);
208
+ if (startIndex === -1) return null;
209
+ const valueStartIndex = startIndex + 21;
210
+ const endIndex = output.indexOf(PATH_CAPTURE_END, valueStartIndex);
211
+ if (endIndex === -1) return null;
212
+ const pathValue = output.slice(valueStartIndex, endIndex).trim();
213
+ return pathValue.length > 0 ? pathValue : null;
214
+ }
215
+ function readPathFromLoginShell(shell, execFile = execFileSync) {
216
+ return extractPathFromShellOutput(execFile(shell, ["-ilc", PATH_CAPTURE_COMMAND], {
217
+ encoding: "utf8",
218
+ timeout: 5e3
219
+ })) ?? void 0;
220
+ }
221
+
197
222
  //#endregion
198
223
  //#region src/os-jank.ts
199
224
  function fixPath() {
200
225
  if (process.platform !== "darwin") return;
201
226
  try {
202
- const result = execFileSync(process.env.SHELL ?? "/bin/zsh", ["-ilc", "echo -n $PATH"], {
203
- encoding: "utf8",
204
- timeout: 5e3
205
- });
227
+ const result = readPathFromLoginShell(process.env.SHELL ?? "/bin/zsh");
206
228
  if (result) process.env.PATH = result;
207
229
  } catch {}
208
230
  }
209
231
  const expandHomePath = Effect.fn(function* (input) {
210
- const { join, sep } = yield* Path.Path;
232
+ const { join } = yield* Path.Path;
211
233
  if (input === "~") return OS.homedir();
212
- if (input.startsWith(`~${sep}`)) return join(OS.homedir(), input.slice(sep.length));
234
+ if (input.startsWith("~/") || input.startsWith("~\\")) return join(OS.homedir(), input.slice(2));
213
235
  return input;
214
236
  });
215
237
  const resolveStateDir = Effect.fn(function* (raw) {
@@ -5160,6 +5182,12 @@ var ProviderService = class extends ServiceMap.Service()("t3/provider/Services/P
5160
5182
  */
5161
5183
  var CheckpointReactor = class extends ServiceMap.Service()("t3/orchestration/Services/CheckpointReactor") {};
5162
5184
 
5185
+ //#endregion
5186
+ //#region src/git/isRepo.ts
5187
+ function isGitRepository(cwd) {
5188
+ return existsSync(join(cwd, ".git"));
5189
+ }
5190
+
5163
5191
  //#endregion
5164
5192
  //#region src/orchestration/Layers/CheckpointReactor.ts
5165
5193
  function toTurnId$2(value) {
@@ -5231,6 +5259,7 @@ const make$2 = Effect.gen(function* () {
5231
5259
  }
5232
5260
  return Option.none();
5233
5261
  });
5262
+ const isGitWorkspace = (cwd) => isGitRepository(cwd);
5234
5263
  const captureCheckpointFromTurnCompletion = Effect.fnUntraced(function* (event) {
5235
5264
  const turnId = toTurnId$2(event.turnId);
5236
5265
  if (!turnId) return;
@@ -5254,6 +5283,14 @@ const make$2 = Effect.gen(function* () {
5254
5283
  });
5255
5284
  return;
5256
5285
  }
5286
+ if (!isGitWorkspace(checkpointCwd)) {
5287
+ yield* Effect.logDebug("checkpoint capture skipped for non-git workspace", {
5288
+ threadId: thread.id,
5289
+ turnId,
5290
+ cwd: checkpointCwd
5291
+ });
5292
+ return;
5293
+ }
5257
5294
  const nextTurnCount = thread.checkpoints.reduce((maxTurnCount, checkpoint) => Math.max(maxTurnCount, checkpoint.checkpointTurnCount), 0) + 1;
5258
5295
  const fromTurnCount = Math.max(0, nextTurnCount - 1);
5259
5296
  const fromCheckpointRef = checkpointRefForThreadTurn(thread.id, fromTurnCount);
@@ -5345,6 +5382,7 @@ const make$2 = Effect.gen(function* () {
5345
5382
  });
5346
5383
  return;
5347
5384
  }
5385
+ if (!isGitWorkspace(checkpointCwd)) return;
5348
5386
  const currentTurnCount = thread.checkpoints.reduce((maxTurnCount, checkpoint) => Math.max(maxTurnCount, checkpoint.checkpointTurnCount), 0);
5349
5387
  const baselineCheckpointRef = checkpointRefForThreadTurn(thread.id, currentTurnCount);
5350
5388
  if (yield* checkpointStore.hasCheckpointRef({
@@ -5375,6 +5413,7 @@ const make$2 = Effect.gen(function* () {
5375
5413
  yield* Effect.logWarning("checkpoint pre-turn capture skipped: no workspace cwd", { threadId });
5376
5414
  return;
5377
5415
  }
5416
+ if (!isGitWorkspace(checkpointCwd)) return;
5378
5417
  const baselineCheckpointRef = checkpointRefForThreadTurn(threadId, thread.checkpoints.reduce((maxTurnCount, checkpoint) => Math.max(maxTurnCount, checkpoint.checkpointTurnCount), 0));
5379
5418
  if (yield* checkpointStore.hasCheckpointRef({
5380
5419
  cwd: checkpointCwd,
@@ -5407,6 +5446,15 @@ const make$2 = Effect.gen(function* () {
5407
5446
  }).pipe(Effect.catch(() => Effect.void));
5408
5447
  return;
5409
5448
  }
5449
+ if (!isGitWorkspace(sessionRuntime.value.cwd)) {
5450
+ yield* appendRevertFailureActivity({
5451
+ threadId: event.payload.threadId,
5452
+ turnCount: event.payload.turnCount,
5453
+ detail: "Checkpoints are unavailable because this project is not a git repository.",
5454
+ createdAt: now
5455
+ }).pipe(Effect.catch(() => Effect.void));
5456
+ return;
5457
+ }
5410
5458
  const currentTurnCount = thread.checkpoints.reduce((maxTurnCount, checkpoint) => Math.max(maxTurnCount, checkpoint.checkpointTurnCount), 0);
5411
5459
  if (event.payload.turnCount > currentTurnCount) {
5412
5460
  yield* appendRevertFailureActivity({
@@ -8780,6 +8828,17 @@ const make = Effect.gen(function* () {
8780
8828
  createdAt: ""
8781
8829
  })
8782
8830
  });
8831
+ const isGitRepoForThread = Effect.fnUntraced(function* (threadId) {
8832
+ const readModel = yield* orchestrationEngine.getReadModel();
8833
+ const thread = readModel.threads.find((entry) => entry.id === threadId);
8834
+ if (!thread) return false;
8835
+ const workspaceCwd = resolveThreadWorkspaceCwd({
8836
+ thread,
8837
+ projects: readModel.projects
8838
+ });
8839
+ if (!workspaceCwd) return false;
8840
+ return isGitRepository(workspaceCwd);
8841
+ });
8783
8842
  const rememberAssistantMessageId = (threadId, turnId, messageId) => Cache.getOption(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId)).pipe(Effect.flatMap((existingIds) => Cache.set(turnMessageIdsByTurnKey, providerTurnKey(threadId, turnId), Option.match(existingIds, {
8784
8843
  onNone: () => new Set([messageId]),
8785
8844
  onSome: (ids) => {
@@ -9058,7 +9117,7 @@ const make = Effect.gen(function* () {
9058
9117
  });
9059
9118
  if (event.type === "turn.diff.updated") {
9060
9119
  const turnId = toTurnId$1(event.turnId);
9061
- if (turnId) {
9120
+ if (turnId && (yield* isGitRepoForThread(thread.id))) {
9062
9121
  const assistantMessageId = MessageId.makeUnsafe(`assistant:${event.itemId ?? event.turnId ?? event.eventId}`);
9063
9122
  yield* orchestrationEngine.dispatch({
9064
9123
  type: "thread.turn.diff.complete",
@@ -11567,11 +11626,10 @@ const makeProviderService = (options) => Effect.gen(function* () {
11567
11626
  return activeSessions.map((session) => {
11568
11627
  const binding = bindingsByThreadId.get(session.threadId);
11569
11628
  if (!binding) return session;
11570
- return {
11571
- ...session,
11572
- ...session.resumeCursor === void 0 && binding.resumeCursor !== void 0 ? { resumeCursor: binding.resumeCursor } : {},
11573
- ...binding.runtimeMode !== void 0 ? { runtimeMode: binding.runtimeMode } : {}
11574
- };
11629
+ const overrides = {};
11630
+ if (session.resumeCursor === void 0 && binding.resumeCursor !== void 0) overrides.resumeCursor = binding.resumeCursor;
11631
+ if (binding.runtimeMode !== void 0) overrides.runtimeMode = binding.runtimeMode;
11632
+ return Object.assign({}, session, overrides);
11575
11633
  });
11576
11634
  });
11577
11635
  const getCapabilities = (provider) => registry.getByProvider(provider).pipe(Effect.map((adapter) => adapter.capabilities));
@@ -12843,7 +12901,7 @@ var TerminalManagerRuntime = class extends EventEmitter {
12843
12901
  }
12844
12902
  async runWithThreadLock(threadId, task) {
12845
12903
  const previous = this.threadLocks.get(threadId) ?? Promise.resolve();
12846
- let release = () => {};
12904
+ let release;
12847
12905
  const current = new Promise((resolve) => {
12848
12906
  release = resolve;
12849
12907
  });
@@ -15834,6 +15892,11 @@ function resolveWorkspaceWritePath(params) {
15834
15892
  function stripRequestTag(body) {
15835
15893
  return Struct.omit(body, ["_tag"]);
15836
15894
  }
15895
+ function messageFromCause(cause) {
15896
+ const squashed = Cause.squash(cause);
15897
+ const message = squashed instanceof Error ? squashed.message.trim() : String(squashed).trim();
15898
+ return message.length > 0 ? message : Cause.pretty(cause);
15899
+ }
15837
15900
  var ServerLifecycleError = class extends Schema.TaggedErrorClass()("ServerLifecycleError", {
15838
15901
  operation: Schema.String,
15839
15902
  cause: Schema.optional(Schema.Defect)
@@ -15884,6 +15947,21 @@ const createServer = Effect.fn(function* () {
15884
15947
  });
15885
15948
  });
15886
15949
  const normalizeDispatchCommand = Effect.fnUntraced(function* (input) {
15950
+ const normalizeProjectWorkspaceRoot = Effect.fnUntraced(function* (workspaceRoot) {
15951
+ const normalizedWorkspaceRoot = path.resolve(yield* expandHomePath(workspaceRoot.trim()));
15952
+ const workspaceStat = yield* fileSystem.stat(normalizedWorkspaceRoot).pipe(Effect.catch(() => Effect.succeed(null)));
15953
+ if (!workspaceStat) return yield* new RouteRequestError({ message: `Project directory does not exist: ${normalizedWorkspaceRoot}` });
15954
+ if (workspaceStat.type !== "Directory") return yield* new RouteRequestError({ message: `Project path is not a directory: ${normalizedWorkspaceRoot}` });
15955
+ return normalizedWorkspaceRoot;
15956
+ });
15957
+ if (input.command.type === "project.create") return {
15958
+ ...input.command,
15959
+ workspaceRoot: yield* normalizeProjectWorkspaceRoot(input.command.workspaceRoot)
15960
+ };
15961
+ if (input.command.type === "project.meta.update" && input.command.workspaceRoot !== void 0) return {
15962
+ ...input.command,
15963
+ workspaceRoot: yield* normalizeProjectWorkspaceRoot(input.command.workspaceRoot)
15964
+ };
15887
15965
  if (input.command.type !== "thread.turn.start") return input.command;
15888
15966
  const turnStartCommand = input.command;
15889
15967
  const normalizedAttachments = yield* Effect.forEach(turnStartCommand.message.attachments, (attachment) => Effect.gen(function* () {
@@ -16102,7 +16180,8 @@ const createServer = Effect.fn(function* () {
16102
16180
  operation: "autoBootstrapProject",
16103
16181
  cause
16104
16182
  })));
16105
- const runPromise = yield* Effect.map(Effect.services(), Effect.runPromiseWith);
16183
+ const runtimeServices = yield* Effect.services();
16184
+ const runPromise = Effect.runPromiseWith(runtimeServices);
16106
16185
  const unsubscribeTerminalEvents = yield* terminalManager.subscribe((event) => void Effect.runPromise(onTerminalEvent(event)));
16107
16186
  yield* Effect.addFinalizer(() => Effect.sync(() => unsubscribeTerminalEvents()));
16108
16187
  yield* NodeHttpServer.make(() => httpServer, listenOptions).pipe(Effect.mapError((cause) => new ServerLifecycleError({
@@ -16250,7 +16329,7 @@ const createServer = Effect.fn(function* () {
16250
16329
  if (request._tag === "Failure") {
16251
16330
  const errorResponse = yield* encodeResponse({
16252
16331
  id: "unknown",
16253
- error: { message: `Invalid request format: ${Cause.pretty(request.cause)}` }
16332
+ error: { message: `Invalid request format: ${messageFromCause(request.cause)}` }
16254
16333
  });
16255
16334
  ws.send(errorResponse);
16256
16335
  return;
@@ -16259,7 +16338,7 @@ const createServer = Effect.fn(function* () {
16259
16338
  if (result._tag === "Failure") {
16260
16339
  const errorResponse = yield* encodeResponse({
16261
16340
  id: request.value.id,
16262
- error: { message: Cause.pretty(result.cause) }
16341
+ error: { message: messageFromCause(result.cause) }
16263
16342
  });
16264
16343
  ws.send(errorResponse);
16265
16344
  return;
@@ -16386,7 +16465,7 @@ const getTelemetryIdentifier = Effect.gen(function* () {
16386
16465
 
16387
16466
  //#endregion
16388
16467
  //#region package.json
16389
- var version = "0.0.2";
16468
+ var version = "0.0.3";
16390
16469
 
16391
16470
  //#endregion
16392
16471
  //#region src/telemetry/Layers/AnalyticsService.ts