glotfile 1.1.1 → 1.1.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.
@@ -274,9 +274,6 @@ function validate(raw) {
274
274
  if (entry.contextSource !== void 0 && entry.contextSource !== "ai") {
275
275
  fail(`key "${key}" contextSource must be "ai" if present`);
276
276
  }
277
- if (entry.contextAt !== void 0 && typeof entry.contextAt !== "string") {
278
- fail(`key "${key}" contextAt must be a string if present`);
279
- }
280
277
  }
281
278
  if (raw.glossary !== void 0 && !Array.isArray(raw.glossary)) fail("glossary must be an array");
282
279
  if (raw.glossarySuggestions !== void 0 && !Array.isArray(raw.glossarySuggestions)) fail("glossarySuggestions must be an array");
@@ -772,7 +769,6 @@ function setMetadata(state, key, partial) {
772
769
  delete safe.values;
773
770
  if ("context" in safe) {
774
771
  delete entry.contextSource;
775
- delete entry.contextAt;
776
772
  }
777
773
  Object.assign(entry, safe);
778
774
  if ("context" in safe && !entry.context) delete entry.context;
@@ -3098,7 +3094,7 @@ var init_bedrock = __esm({
3098
3094
  if (res.stopReason === "max_tokens") {
3099
3095
  throw new MalformedReplyError(text || JSON.stringify(tool?.input ?? {}));
3100
3096
  }
3101
- if (tool?.input?.items) return tool.input.items;
3097
+ if (Array.isArray(tool?.input?.items)) return tool.input.items;
3102
3098
  return parseReplyItems(text);
3103
3099
  }
3104
3100
  };
@@ -4063,7 +4059,7 @@ ${s.lines}
4063
4059
  });
4064
4060
  return 'Write a context note for each key. Return JSON {"items":[{"id","context"}]}.\n' + JSON.stringify(items, null, 2);
4065
4061
  }
4066
- function applyContext(state, reqs, results, clock = systemClock, force = false) {
4062
+ function applyContext(state, reqs, results, force = false) {
4067
4063
  const byId = new Map(reqs.map((r) => [r.id, r]));
4068
4064
  let written = 0;
4069
4065
  const errors = [];
@@ -4087,7 +4083,6 @@ function applyContext(state, reqs, results, clock = systemClock, force = false)
4087
4083
  if (!entry || entry.context && !force) continue;
4088
4084
  entry.context = context;
4089
4085
  entry.contextSource = "ai";
4090
- entry.contextAt = clock();
4091
4086
  written++;
4092
4087
  }
4093
4088
  return { written, errors };
@@ -4096,7 +4091,6 @@ var MAX_CONTEXT_LENGTH, SNIPPET_WINDOW, MAX_SNIPPETS, EXCLUDED_DIRS, CONTEXT_BAT
4096
4091
  var init_context = __esm({
4097
4092
  "src/server/ai/context.ts"() {
4098
4093
  "use strict";
4099
- init_state();
4100
4094
  init_placeholders();
4101
4095
  MAX_CONTEXT_LENGTH = 500;
4102
4096
  SNIPPET_WINDOW = 15;
@@ -4238,7 +4232,7 @@ async function applyContextBatchResults(load, persist, provider, pending, projec
4238
4232
  if (retryUsage) addUsage(usage, retryUsage);
4239
4233
  }
4240
4234
  const fresh = load();
4241
- const { written, errors: applyErrors } = applyContext(fresh, applied, items, void 0, pending.force);
4235
+ const { written, errors: applyErrors } = applyContext(fresh, applied, items, pending.force);
4242
4236
  errors.push(...applyErrors);
4243
4237
  persist(fresh);
4244
4238
  clearPendingContextBatch(projectRoot);
@@ -8195,7 +8189,6 @@ function createApi(deps) {
8195
8189
  if (clearContext === true) {
8196
8190
  delete entry.context;
8197
8191
  delete entry.contextSource;
8198
- delete entry.contextAt;
8199
8192
  }
8200
8193
  updated++;
8201
8194
  }
@@ -9083,7 +9076,7 @@ function createApi(deps) {
9083
9076
  if (signal?.aborted) break;
9084
9077
  const batch = raw;
9085
9078
  const fresh = load();
9086
- const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], void 0, body.force === true);
9079
+ const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], body.force === true);
9087
9080
  const usage = provider.takeUsage?.();
9088
9081
  appendLog(projectRoot, {
9089
9082
  at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -265,9 +265,6 @@ function validate(raw) {
265
265
  if (entry.contextSource !== void 0 && entry.contextSource !== "ai") {
266
266
  fail(`key "${key}" contextSource must be "ai" if present`);
267
267
  }
268
- if (entry.contextAt !== void 0 && typeof entry.contextAt !== "string") {
269
- fail(`key "${key}" contextAt must be a string if present`);
270
- }
271
268
  }
272
269
  if (raw.glossary !== void 0 && !Array.isArray(raw.glossary)) fail("glossary must be an array");
273
270
  if (raw.glossarySuggestions !== void 0 && !Array.isArray(raw.glossarySuggestions)) fail("glossarySuggestions must be an array");
@@ -713,7 +710,6 @@ function setMetadata(state, key, partial) {
713
710
  delete safe.values;
714
711
  if ("context" in safe) {
715
712
  delete entry.contextSource;
716
- delete entry.contextAt;
717
713
  }
718
714
  Object.assign(entry, safe);
719
715
  if ("context" in safe && !entry.context) delete entry.context;
@@ -1730,7 +1726,7 @@ var CONTEXT_BATCH_SCHEMA = {
1730
1726
  required: ["items"],
1731
1727
  additionalProperties: false
1732
1728
  };
1733
- function applyContext(state, reqs, results, clock = systemClock, force = false) {
1729
+ function applyContext(state, reqs, results, force = false) {
1734
1730
  const byId = new Map(reqs.map((r) => [r.id, r]));
1735
1731
  let written = 0;
1736
1732
  const errors = [];
@@ -1754,7 +1750,6 @@ function applyContext(state, reqs, results, clock = systemClock, force = false)
1754
1750
  if (!entry || entry.context && !force) continue;
1755
1751
  entry.context = context;
1756
1752
  entry.contextSource = "ai";
1757
- entry.contextAt = clock();
1758
1753
  written++;
1759
1754
  }
1760
1755
  return { written, errors };
@@ -3987,7 +3982,7 @@ var BedrockProvider = class {
3987
3982
  if (res.stopReason === "max_tokens") {
3988
3983
  throw new MalformedReplyError(text || JSON.stringify(tool?.input ?? {}));
3989
3984
  }
3990
- if (tool?.input?.items) return tool.input.items;
3985
+ if (Array.isArray(tool?.input?.items)) return tool.input.items;
3991
3986
  return parseReplyItems(text);
3992
3987
  }
3993
3988
  };
@@ -4751,7 +4746,7 @@ async function applyContextBatchResults(load, persist, provider, pending, projec
4751
4746
  if (retryUsage) addUsage(usage, retryUsage);
4752
4747
  }
4753
4748
  const fresh = load();
4754
- const { written, errors: applyErrors } = applyContext(fresh, applied, items, void 0, pending.force);
4749
+ const { written, errors: applyErrors } = applyContext(fresh, applied, items, pending.force);
4755
4750
  errors.push(...applyErrors);
4756
4751
  persist(fresh);
4757
4752
  clearPendingContextBatch(projectRoot);
@@ -7520,7 +7515,6 @@ function createApi(deps) {
7520
7515
  if (clearContext === true) {
7521
7516
  delete entry.context;
7522
7517
  delete entry.contextSource;
7523
- delete entry.contextAt;
7524
7518
  }
7525
7519
  updated++;
7526
7520
  }
@@ -8408,7 +8402,7 @@ function createApi(deps) {
8408
8402
  if (signal?.aborted) break;
8409
8403
  const batch = raw;
8410
8404
  const fresh = load();
8411
- const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], void 0, body.force === true);
8405
+ const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], body.force === true);
8412
8406
  const usage = provider.takeUsage?.();
8413
8407
  appendLog(projectRoot, {
8414
8408
  at: (/* @__PURE__ */ new Date()).toISOString(),