@fabiofiorita/porcelain 0.88.1 → 0.88.2

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 (46) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +67 -46
  4. package/web/dist/assets/_paired-BC2PXdEF.js +2 -0
  5. package/web/dist/assets/_paired-BKE-zKoJ.js +1 -0
  6. package/web/dist/assets/access-B1ddZlps.js +27 -0
  7. package/web/dist/assets/{core-nsSEMkdR.js → core-A9QwCfgd.js} +1 -1
  8. package/web/dist/assets/{core-C9VsdEg4.js → core-N5FOhKMV.js} +1 -1
  9. package/web/dist/assets/edit-file-D4o1bywx.js +322 -0
  10. package/web/dist/assets/{file-editor-DlbnkKAk.js → file-editor-MXkoMjoi.js} +11 -11
  11. package/web/dist/assets/hastToHtml-CpdMSaFQ.js +11 -0
  12. package/web/dist/assets/{highlights-HGlbOF9z.js → highlights-DRrqz3ij.js} +2 -2
  13. package/web/dist/assets/index-CVnkxc5l.js +10 -0
  14. package/web/dist/assets/lib-BKZ5ZaMU.js +1 -0
  15. package/web/dist/assets/pair-B1zlXYYv.js +2 -0
  16. package/web/dist/assets/pair-BKE-zKoJ.js +1 -0
  17. package/web/dist/assets/{pair-knAwIdS8.js → pair-DKAxtXy2.js} +1 -1
  18. package/web/dist/assets/resolveLanguages-CK0v50mm.js +2 -0
  19. package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  20. package/web/dist/assets/settings-page-CigAPPnS.js +1357 -0
  21. package/web/dist/assets/shiki-DLgG39WJ.js +1 -0
  22. package/web/dist/assets/{stream-tokenizer-CjS9-LFG.js → stream-tokenizer-DaEryYPA.js} +2 -2
  23. package/web/dist/assets/themes-CHgfTR2s.js +2 -0
  24. package/web/dist/assets/useNavigate-BZWuXWB6.js +1 -0
  25. package/web/dist/assets/{workspace-error-BeTBm_6h.js → workspace-error-Dc7KW7tw.js} +1 -1
  26. package/web/dist/index.html +11 -15
  27. package/web/dist/assets/_paired-B0NHYBZw.js +0 -1
  28. package/web/dist/assets/_paired-CI9bDWMQ.js +0 -2
  29. package/web/dist/assets/_section-BpoeKbFs.js +0 -2
  30. package/web/dist/assets/_section-I2Pn1XO-.js +0 -1
  31. package/web/dist/assets/access-RB9HeZAM.js +0 -27
  32. package/web/dist/assets/confirmed-read-BzQiPqPU.js +0 -184
  33. package/web/dist/assets/edit-file-CiBSkj3Q.js +0 -139
  34. package/web/dist/assets/hastToHtml-BMGZcuTk.js +0 -10
  35. package/web/dist/assets/index-5QFOY56T.js +0 -10
  36. package/web/dist/assets/lazyRouteComponent-CBnL3Wua.js +0 -1
  37. package/web/dist/assets/lib-DcUAKKEz.js +0 -1
  38. package/web/dist/assets/pair-B0NHYBZw.js +0 -1
  39. package/web/dist/assets/pair-_VLWQklP.js +0 -2
  40. package/web/dist/assets/resolveLanguages-DEcuv43Y.js +0 -2
  41. package/web/dist/assets/settings-page-CEgn-xXq.js +0 -13
  42. package/web/dist/assets/shiki-BEnL9EcY.js +0 -1
  43. package/web/dist/assets/themeResolver-XCfnoFxi.js +0 -2
  44. package/web/dist/assets/themes-cX3BdCD4.js +0 -2
  45. package/web/dist/assets/useNavigate-DSRB4lpU.js +0 -1
  46. package/web/dist/assets/workspace-pending-ZZrMTy9_.js +0 -1345
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @fabiofiorita/porcelain (0.88.1)
1
+ # @fabiofiorita/porcelain (0.88.2)
2
2
 
3
3
  The Porcelain server and bundled web app for a plain Node installation. A
4
4
  fresh, read-only agent writes a Walkthrough of what your coding agent changed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabiofiorita/porcelain",
3
- "version": "0.88.1",
3
+ "version": "0.88.2",
4
4
  "description": "A fresh, read-only agent explains what your coding agent changed. Read it from a browser, Mac or phone.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -823,17 +823,19 @@ var sqliteWalkthroughStoreLayer = Layer2.effectContext(
823
823
  function* (input) {
824
824
  const settings = yield* store.readSettings(input.projectId);
825
825
  const titles = yield* store.readTitles(input.projectId);
826
- const groups = yield* Effect2.forEach(
827
- input.worktreeIds,
828
- (id) => sql`SELECT payload FROM walkthrough_runs WHERE worktree_id = ${id} AND status = 'ready' ORDER BY sequence DESC`.pipe(
829
- Effect2.map(
830
- (rows) => rows.map((row) => decode3(row.payload).run)
831
- ),
832
- Effect2.orDie
833
- )
834
- );
835
- const runs = groups.flat();
836
- return { settings, titles, runs };
826
+ const walkthroughTitles = /* @__PURE__ */ new Map();
827
+ for (const { id, branch } of input.worktrees) {
828
+ if (branch === void 0) continue;
829
+ const [row] = yield* sql`
830
+ SELECT json_extract(payload, '$.run.state.content.title') AS title
831
+ FROM walkthrough_runs
832
+ WHERE worktree_id = ${id} AND status = 'ready'
833
+ AND json_extract(payload, '$.run.branch') = ${branch}
834
+ ORDER BY sequence DESC LIMIT 1
835
+ `.pipe(Effect2.orDie);
836
+ if (row) walkthroughTitles.set(id, row.title);
837
+ }
838
+ return { settings, titles, walkthroughTitles };
837
839
  }
838
840
  )
839
841
  })
@@ -4862,11 +4864,16 @@ var readWalkthroughQuerySchema = Schema89.Struct({
4862
4864
  ),
4863
4865
  excerptNode: Schema89.optional(Schema89.String)
4864
4866
  });
4867
+ var readWalkthroughHeadersSchema = Schema89.Struct({
4868
+ accept: Schema89.optional(Schema89.String)
4869
+ });
4870
+ var CAPTURED_EXCERPT_ACCEPT = "application/json, application/vnd.porcelain.captured-excerpt+json";
4865
4871
  var readWalkthroughResponseSchema = Schema89.Struct({
4866
4872
  walkthrough: nullableAsUndefined(walkthroughRunSchema2),
4867
4873
  attempt: Schema89.optional(walkthroughRunSchema2),
4868
4874
  freshness: walkthroughFreshnessSchema,
4869
- capturedPatch: Schema89.optional(Schema89.String)
4875
+ capturedPatch: Schema89.optional(Schema89.String),
4876
+ capturedRunId: Schema89.optional(Schema89.String)
4870
4877
  });
4871
4878
  var walkthroughWriterSettingsQuerySchema = Schema89.Struct({
4872
4879
  projectId: Schema89.optional(Schema89.String),
@@ -4928,6 +4935,7 @@ var WalkthroughsApi = class extends porcelainApi.add(
4928
4935
  disableCodecs: true,
4929
4936
  params: worktreeParamsSchema,
4930
4937
  query: readWalkthroughQuerySchema.fields,
4938
+ headers: readWalkthroughHeadersSchema.fields,
4931
4939
  success: readWalkthroughResponseSchema,
4932
4940
  error: [...worktreeFailures, ...gitReadFailures]
4933
4941
  }
@@ -25214,7 +25222,12 @@ import { Layer as Layer147 } from "effect";
25214
25222
  // apps/server/src/http/static-files.ts
25215
25223
  import { basename, extname, isAbsolute as isAbsolute2, posix } from "node:path";
25216
25224
  import { Layer as Layer146, Effect as Effect249 } from "effect";
25217
- import { HttpRouter as HttpRouter12, HttpServerRequest as HttpServerRequest6, HttpServerResponse as HttpServerResponse8 } from "effect/http";
25225
+ import {
25226
+ HttpMiddleware,
25227
+ HttpRouter as HttpRouter12,
25228
+ HttpServerRequest as HttpServerRequest6,
25229
+ HttpServerResponse as HttpServerResponse8
25230
+ } from "effect/http";
25218
25231
  var SHELL = "index.html";
25219
25232
  var NO_CACHE = "no-cache";
25220
25233
  var IMMUTABLE_CACHE = "public, max-age=31536000, immutable";
@@ -25314,16 +25327,16 @@ function staticFiles(files) {
25314
25327
  "Content-Length": String(file.size),
25315
25328
  "Content-Type": contentTypeForPath(file.path)
25316
25329
  };
25317
- if (request2.method === "HEAD")
25318
- return HttpServerResponse8.empty({ status: 200, headers });
25319
25330
  return HttpServerResponse8.stream(
25320
25331
  files.open({ path: file.path, size: file.size }),
25321
25332
  { headers }
25322
25333
  );
25323
25334
  });
25324
- return HttpRouter12.add("GET", "/*", answer2).pipe(
25325
- Layer146.provide(handlerAudit.layer)
25326
- );
25335
+ return HttpRouter12.add(
25336
+ "GET",
25337
+ "/*",
25338
+ answer2.pipe(HttpMiddleware.compression())
25339
+ ).pipe(Layer146.provide(handlerAudit.layer));
25327
25340
  }
25328
25341
 
25329
25342
  // apps/server/src/http/scopes/page.ts
@@ -26760,17 +26773,25 @@ var ReadWalkthroughService = class _ReadWalkthroughService extends Context214.Se
26760
26773
  const ready = readyRuns.at(-1);
26761
26774
  const walkthrough = latest?.state.status === "ready" ? latest : ready ?? latest;
26762
26775
  const job = walkthrough === void 0 ? void 0 : yield* store.readJob(walkthrough.id);
26763
- const identity4 = job === void 0 ? void 0 : yield* heads.content({
26764
- worktreeId: input.worktreeId,
26765
- worktreePath: job.worktreePath,
26766
- baseRef: job.run.baseRef
26767
- }).pipe(Effect258.catch(() => Effect258.succeed(void 0)));
26768
26776
  const capturedPatch = job !== void 0 && job.run.id === input.excerptRunId && input.excerptStep !== void 0 ? capturedExcerpt(
26769
26777
  job,
26770
26778
  input.excerptStep,
26771
26779
  input.excerptBlock,
26772
26780
  input.excerptNode
26773
26781
  ) : void 0;
26782
+ if (input.excerptOnly && input.excerptStep !== void 0) {
26783
+ return {
26784
+ walkthrough: void 0,
26785
+ attempt: void 0,
26786
+ freshness: "unknown",
26787
+ ...capturedPatch === void 0 || job === void 0 ? {} : { capturedPatch, capturedRunId: job.run.id }
26788
+ };
26789
+ }
26790
+ const identity4 = job === void 0 ? void 0 : yield* heads.content({
26791
+ worktreeId: input.worktreeId,
26792
+ worktreePath: job.worktreePath,
26793
+ baseRef: job.run.baseRef
26794
+ }).pipe(Effect258.catch(() => Effect258.succeed(void 0)));
26774
26795
  return {
26775
26796
  walkthrough,
26776
26797
  ...capturedPatch === void 0 ? {} : { capturedPatch },
@@ -26936,14 +26957,16 @@ function withUniqueTitles(stops) {
26936
26957
  return { ...stop, title: title2 };
26937
26958
  });
26938
26959
  }
26939
- function qualifyBlock(block, job, evidence, covered, excerpted) {
26960
+ function qualifyBlock(block, job, evidence, covered, excerptedHunks) {
26940
26961
  switch (block.kind) {
26941
26962
  case "diff_excerpt": {
26942
26963
  const file = job.files.find(
26943
26964
  (item) => (block.side === "old" ? item.oldPath ?? item.path : item.path) === block.path
26944
26965
  );
26945
- if (file === void 0 || excerpted.has(file.path) || !capturedDiffHunk(job.patch, block))
26946
- return void 0;
26966
+ if (file === void 0) return void 0;
26967
+ const hunk = capturedDiffHunk(job.patch, block);
26968
+ if (hunk === void 0 || excerptedHunks.has(hunk)) return void 0;
26969
+ excerptedHunks.add(hunk);
26947
26970
  return {
26948
26971
  block: {
26949
26972
  ...block,
@@ -27030,18 +27053,14 @@ function qualifyWalkthrough(content, job, evidence) {
27030
27053
  if (content.outcome === "nothing")
27031
27054
  return { ...content, stops: [], stillUnclear: [] };
27032
27055
  const covered = /* @__PURE__ */ new Set();
27033
- const excerpted = /* @__PURE__ */ new Set();
27056
+ const excerptedHunks = /* @__PURE__ */ new Set();
27034
27057
  const stops = content.stops.map((stop) => {
27035
27058
  const qualified = stop.blocks.flatMap((block) => {
27036
- const match = qualifyBlock(block, job, evidence, covered, excerpted);
27059
+ const match = qualifyBlock(block, job, evidence, covered, excerptedHunks);
27037
27060
  return match === void 0 ? [] : [match];
27038
27061
  });
27039
- for (const item of qualified) {
27040
- for (const path of item.paths) {
27041
- covered.add(path);
27042
- if (item.block.kind === "diff_excerpt") excerpted.add(path);
27043
- }
27044
- }
27062
+ for (const item of qualified)
27063
+ for (const path of item.paths) covered.add(path);
27045
27064
  return { ...stop, blocks: qualified.map((item) => item.block) };
27046
27065
  });
27047
27066
  const [first, ...rest] = job.files.filter((file) => !covered.has(file.path)).map((file) => ({ path: file.path, note: "Supporting change" }));
@@ -28331,12 +28350,14 @@ var ReadWalkthroughUseCase = class _ReadWalkthroughUseCase extends Context242.Se
28331
28350
  const access2 = yield* WorktreeAccess;
28332
28351
  const store = yield* ReadWalkthroughService;
28333
28352
  return {
28334
- execute: Effect285.fn("ReadWalkthroughUseCase.execute")(function* (input) {
28335
- return yield* access2.read(
28336
- input.worktreeId,
28337
- () => store.execute(input)
28338
- );
28339
- })
28353
+ execute: Effect285.fn("ReadWalkthroughUseCase.execute")(
28354
+ function* (input, excerptOnly) {
28355
+ return yield* access2.read(
28356
+ input.worktreeId,
28357
+ () => store.execute({ ...input, excerptOnly })
28358
+ );
28359
+ }
28360
+ )
28340
28361
  };
28341
28362
  })
28342
28363
  );
@@ -28550,7 +28571,10 @@ function walkthroughsRoutes(useCases) {
28550
28571
  ({ params, payload }) => useCases.start.execute({ ...params, ...payload }).pipe(Effect291.map(presentWalkthrough))
28551
28572
  ).handle(
28552
28573
  "readWalkthrough",
28553
- ({ params, query }) => useCases.read.execute({ ...params, ...query }).pipe(
28574
+ ({ params, query, headers }) => useCases.read.execute(
28575
+ { ...params, ...query },
28576
+ headers.accept === CAPTURED_EXCERPT_ACCEPT
28577
+ ).pipe(
28554
28578
  Effect291.map((value2) => ({
28555
28579
  ...value2,
28556
28580
  attempt: value2.attempt === void 0 ? void 0 : presentWalkthrough(value2.attempt),
@@ -38961,15 +38985,12 @@ var ReadInventoryUseCase = class _ReadInventoryUseCase extends Context370.Servic
38961
38985
  (project) => Effect488.gen(function* () {
38962
38986
  const metadata = yield* walkthroughs.execute({
38963
38987
  projectId: project.id,
38964
- worktreeIds: project.worktrees.map((worktree) => worktree.id)
38988
+ worktrees: project.worktrees
38965
38989
  });
38966
38990
  const walkthroughSettings = metadata.settings;
38967
38991
  const titles = metadata.titles;
38968
38992
  const worktrees = project.worktrees.map((worktree) => {
38969
- const run2 = metadata.runs.find(
38970
- (run3) => run3?.worktreeId === worktree.id && run3.branch === worktree.branch && run3.state.status === "ready"
38971
- );
38972
- const title2 = run2?.state.status === "ready" && run2.branch !== void 0 && run2.branch === worktree.branch ? run2.state.content.title : void 0;
38993
+ const title2 = metadata.walkthroughTitles.get(worktree.id);
38973
38994
  const pull = titles.find(
38974
38995
  (pull2) => pull2.branch === worktree.branch
38975
38996
  );