@eliya-oss/agent-diff 0.1.0-alpha.20 → 0.1.0-alpha.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.21
4
+
5
+ ### Patch Changes
6
+
7
+ - The store answers with the settings effect directly.
8
+
3
9
  ## 0.1.0-alpha.20
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -5132,6 +5132,19 @@ const MinimumLogLevel = /*#__PURE__*/ Reference("effect/References/MinimumLogLev
5132
5132
  //#endregion
5133
5133
  //#region node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/internal/tracer.js
5134
5134
  /** @internal */
5135
+ const addSpanStackTrace = (options) => {
5136
+ if (options?.captureStackTrace === false) return options;
5137
+ else if (options?.captureStackTrace !== void 0 && typeof options.captureStackTrace !== "boolean") return options;
5138
+ const limit = getStackTraceLimit();
5139
+ setStackTraceLimit(3);
5140
+ const traceError = /* @__PURE__ */ new Error();
5141
+ setStackTraceLimit(limit);
5142
+ return {
5143
+ ...options,
5144
+ captureStackTrace: spanCleaner(() => traceError.stack)
5145
+ };
5146
+ };
5147
+ /** @internal */
5135
5148
  const makeStackCleaner = (line) => (stack) => {
5136
5149
  let cache;
5137
5150
  return () => {
@@ -5145,6 +5158,7 @@ const makeStackCleaner = (line) => (stack) => {
5145
5158
  }
5146
5159
  };
5147
5160
  };
5161
+ const spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
5148
5162
  //#endregion
5149
5163
  //#region node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/internal/effect.js
5150
5164
  /** @internal */
@@ -5584,6 +5598,8 @@ const callback$1 = (register) => callbackOptions(register, register.length >= 2)
5584
5598
  /** @internal */
5585
5599
  const never = /*#__PURE__*/ callback$1(constVoid);
5586
5600
  /** @internal */
5601
+ const gen$1 = (...args) => suspend(() => fromIteratorUnsafe(args.length === 1 ? args[0]() : args[1].call(args[0].self)));
5602
+ /** @internal */
5587
5603
  const fnUntraced = (body, ...pipeables) => {
5588
5604
  const fn = pipeables.length === 0 ? function() {
5589
5605
  return suspend(() => fromIteratorUnsafe(body.apply(this, arguments)));
@@ -6241,6 +6257,14 @@ const makeSpanUnsafe = (fiber, name, options) => {
6241
6257
  }
6242
6258
  return span;
6243
6259
  };
6260
+ const provideSpanStackFrame = (name, stack) => {
6261
+ stack = typeof stack === "function" ? stack : constUndefined;
6262
+ return updateService(CurrentStackFrame, (parent) => ({
6263
+ name,
6264
+ stack,
6265
+ parent
6266
+ }));
6267
+ };
6244
6268
  /** @internal */
6245
6269
  const useSpan = (name, ...args) => {
6246
6270
  const options = args.length === 1 ? void 0 : args[0];
@@ -6256,6 +6280,32 @@ const useSpan = (name, ...args) => {
6256
6280
  };
6257
6281
  const provideParentSpan = /*#__PURE__*/ provideService(ParentSpan);
6258
6282
  /** @internal */
6283
+ const withParentSpan = function() {
6284
+ const dataFirst = isEffect(arguments[0]);
6285
+ const span = dataFirst ? arguments[1] : arguments[0];
6286
+ let options = dataFirst ? arguments[2] : arguments[1];
6287
+ let provideStackFrame = identity;
6288
+ if (span._tag === "Span") {
6289
+ options = addSpanStackTrace(options);
6290
+ provideStackFrame = provideSpanStackFrame(span.name, options?.captureStackTrace);
6291
+ }
6292
+ if (dataFirst) return provideParentSpan(provideStackFrame(arguments[0]), span);
6293
+ return (self) => provideParentSpan(provideStackFrame(self), span);
6294
+ };
6295
+ /** @internal */
6296
+ const withSpan$1 = function() {
6297
+ const dataFirst = typeof arguments[0] !== "string";
6298
+ const name = dataFirst ? arguments[1] : arguments[0];
6299
+ const traceOptions = addSpanStackTrace(arguments[2]);
6300
+ if (dataFirst) {
6301
+ const self = arguments[0];
6302
+ return useSpan(name, arguments[2], (span) => withParentSpan(self, span, traceOptions));
6303
+ }
6304
+ const fnArg = typeof arguments[1] === "function" ? arguments[1] : void 0;
6305
+ const options = fnArg ? void 0 : arguments[1];
6306
+ return (self, ...args) => useSpan(name, fnArg ? fnArg(...args) : options, (span) => withParentSpan(self, span, traceOptions));
6307
+ };
6308
+ /** @internal */
6259
6309
  const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
6260
6310
  const MAX_TIMER_MILLIS = 2 ** 31 - 1;
6261
6311
  var ClockImpl = class {
@@ -7546,6 +7596,57 @@ const void_ = void_$2;
7546
7596
  */
7547
7597
  const callback = callback$1;
7548
7598
  /**
7599
+ * Provides a way to write effectful code using generator functions, simplifying
7600
+ * control flow and error handling.
7601
+ *
7602
+ * **When to use**
7603
+ *
7604
+ * Use when you want to write effectful code that looks and behaves like
7605
+ * synchronous code, while still handling asynchronous tasks, errors, and complex
7606
+ * control flow such as loops and conditions.
7607
+ *
7608
+ * Generator functions work similarly to `async/await` but keep errors,
7609
+ * requirements, and interruption in the Effect type. You can `yield*` values
7610
+ * from effects and return the final result at the end.
7611
+ *
7612
+ * **Example** (Sequencing effects with generators)
7613
+ *
7614
+ * ```ts
7615
+ * import { Data, Effect } from "effect"
7616
+ *
7617
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
7618
+ *
7619
+ * const addServiceCharge = (amount: number) => amount + 1
7620
+ *
7621
+ * const applyDiscount = (
7622
+ * total: number,
7623
+ * discountRate: number
7624
+ * ): Effect.Effect<number, DiscountRateError> =>
7625
+ * discountRate === 0
7626
+ * ? Effect.fail(new DiscountRateError())
7627
+ * : Effect.succeed(total - (total * discountRate) / 100)
7628
+ *
7629
+ * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
7630
+ *
7631
+ * const fetchDiscountRate = Effect.promise(() => Promise.resolve(5))
7632
+ *
7633
+ * export const program = Effect.gen(function*() {
7634
+ * const transactionAmount = yield* fetchTransactionAmount
7635
+ * const discountRate = yield* fetchDiscountRate
7636
+ * const discountedAmount = yield* applyDiscount(
7637
+ * transactionAmount,
7638
+ * discountRate
7639
+ * )
7640
+ * const finalAmount = addServiceCharge(discountedAmount)
7641
+ * return `Final amount to charge: ${finalAmount}`
7642
+ * })
7643
+ * ```
7644
+ *
7645
+ * @category constructors
7646
+ * @since 2.0.0
7647
+ */
7648
+ const gen = gen$1;
7649
+ /**
7549
7650
  * Creates an `Effect` that represents a recoverable error.
7550
7651
  *
7551
7652
  * **When to use**
@@ -8005,6 +8106,28 @@ const context = context$1;
8005
8106
  */
8006
8107
  const provide = provide$1;
8007
8108
  /**
8109
+ * Wraps the effect with a child span for tracing.
8110
+ *
8111
+ * **Example** (Wrapping an effect in a child span)
8112
+ *
8113
+ * ```ts
8114
+ * import { Effect } from "effect"
8115
+ *
8116
+ * const task = Effect.gen(function*() {
8117
+ * yield* Effect.log("Executing task")
8118
+ * return "result"
8119
+ * })
8120
+ *
8121
+ * const traced = Effect.withSpan(task, "my-task", {
8122
+ * attributes: { version: "1.0" }
8123
+ * })
8124
+ * ```
8125
+ *
8126
+ * @category tracing
8127
+ * @since 2.0.0
8128
+ */
8129
+ const withSpan = withSpan$1;
8130
+ /**
8008
8131
  * Executes an effect as a Promise with the provided services.
8009
8132
  *
8010
8133
  * **When to use**
@@ -11877,13 +12000,13 @@ const cursorOps = (state, saveState, inbox) => {
11877
12000
  };
11878
12001
  const settingsOps = (root) => {
11879
12002
  return {
11880
- settings: fn("Store.settings")(function* () {
12003
+ settings: gen(function* () {
11881
12004
  const raw = yield* readOptional(settingsPath(root));
11882
12005
  return match$2(raw, {
11883
12006
  onNone: () => ({}),
11884
12007
  onSome: parseSettings
11885
12008
  });
11886
- }),
12009
+ }).pipe(withSpan("Store.settings")),
11887
12010
  saveSettings: fn("Store.saveSettings")(function* (next) {
11888
12011
  const path = settingsPath(root);
11889
12012
  yield* ensureDir(root);
@@ -12302,7 +12425,7 @@ const fileSource = fn("Cli.fileSource")(function* (repo, branch, file) {
12302
12425
  });
12303
12426
  const saveWrap = fn("Cli.saveWrap")(function* (wrap) {
12304
12427
  const store = yield* Store;
12305
- const current = yield* store.settings();
12428
+ const current = yield* store.settings;
12306
12429
  yield* store.saveSettings({
12307
12430
  ...current,
12308
12431
  wrap
@@ -13624,7 +13747,7 @@ const snippetOf = (state, limit) => {
13624
13747
  const patch = selectedPatch(state);
13625
13748
  if (patch === void 0) return [];
13626
13749
  const [from, to] = selectionRange(state);
13627
- return patch.rows.slice(from, to + 1).slice(0, limit).map((row) => `${String(lineOf(row)).padStart(4)} ${row.text}`);
13750
+ return patch.rows.slice(from, to + 1).slice(0, limit).map((row) => `${lineOf(row).padStart(4)} ${row.text}`);
13628
13751
  };
13629
13752
  const lineOf = (row) => match$2(row.newLine, {
13630
13753
  onNone: () => "-",
@@ -16711,7 +16834,7 @@ const launch = fn("Tui.launch")(function* (repo, renderer, noticeMs, sessionPath
16711
16834
  const branches = yield* listBranches(repo);
16712
16835
  const resume = sessionPath === void 0 ? void 0 : yield* promise(() => readSession(sessionPath));
16713
16836
  const store = yield* Store;
16714
- const settings = yield* store.settings();
16837
+ const settings = yield* store.settings;
16715
16838
  return new App({
16716
16839
  renderer,
16717
16840
  repo,
@@ -16873,7 +16996,7 @@ const routes = {
16873
16996
  name: asked,
16874
16997
  known: commandNames
16875
16998
  });
16876
- yield* answer(options, { commands: found === void 0 ? catalog : [found] });
16999
+ return yield* answer(options, { commands: found === void 0 ? catalog : [found] });
16877
17000
  })
16878
17001
  };
16879
17002
  const run = fn("Main.run")(function* (name, options) {
package/package.json CHANGED
@@ -2,11 +2,12 @@
2
2
  "name": "@eliya-oss/agent-diff",
3
3
  "type": "module",
4
4
  "devDependencies": {
5
- "@effect/tsgo": "^0.28.0",
5
+ "@effect/tsgo": "^0.31.0",
6
6
  "@effect/vitest": "^4.0.0-beta.102",
7
7
  "@types/node": "^26.1.2",
8
8
  "effect": "^4.0.0-beta.102",
9
- "oxlint": "^1.76.0",
9
+ "oxlint": "1.77.0",
10
+ "oxlint-tsgolint": "^7.0.2001",
10
11
  "rolldown": "^1.2.1",
11
12
  "vitest": "^4.1.10"
12
13
  },
@@ -22,7 +23,7 @@
22
23
  "bin": {
23
24
  "adiff": "./bin/adiff.js"
24
25
  },
25
- "version": "0.1.0-alpha.20",
26
+ "version": "0.1.0-alpha.21",
26
27
  "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
27
28
  "license": "MIT",
28
29
  "repository": {
@@ -42,7 +43,7 @@
42
43
  "check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm test",
43
44
  "build": "rolldown -c rolldown.config.ts",
44
45
  "typecheck": "tsc --noEmit",
45
- "lint": "oxlint && node scripts/check-rules.ts && pnpm run lint:effect",
46
+ "lint": "oxlint && node scripts/check-rules.ts",
46
47
  "test": "NODE_OPTIONS=--experimental-ffi vitest run",
47
48
  "test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
48
49
  "dev": "node --experimental-ffi --disable-warning=ExperimentalWarning src/main.ts",
@@ -52,7 +53,6 @@
52
53
  "sketch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/sketch.ts",
53
54
  "watch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/watch.ts",
54
55
  "serve": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/serve.ts",
55
- "play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts",
56
- "lint:effect": "effect-tsgo diagnostics --project tsconfig.json --format text --severity error,warning --lspconfig '{\"diagnostics\":{\"floatingEffect\":\"error\",\"missingEffectError\":\"error\",\"missingEffectContext\":\"error\",\"classSelfMismatch\":\"error\",\"anyUnknownInErrorContext\":\"error\",\"genericEffectServices\":\"error\",\"effectFnImplicitAny\":\"error\"}}'"
56
+ "play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts"
57
57
  }
58
58
  }