@mdbase-dev/pickle 0.1.0-beta.95 → 0.1.0-beta.97

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/README.md CHANGED
@@ -13,3 +13,13 @@ await pickle.respond(requests[0], {
13
13
 
14
14
  The adapter uses ordinary mdbase operations. Request state is derived from
15
15
  linked response records, and no record payload is stored outside the collection.
16
+
17
+ For an inbox, use `pickle.list({ includeBody: false })`. It still waits for all
18
+ response links before deriving pending, answered, and conflict states, but does
19
+ not transfer every request's Markdown context. Fetch an opened request's context
20
+ with `await pickle.readBody(request, { signal, timeoutMs: 10_000 })`. Response
21
+ bodies are never needed for lifecycle calculation and are omitted from queries.
22
+
23
+ Pickle requests 256 records per page from the first query. Cursor authorities
24
+ pin that initial size; continuation requests reuse the cursor rather than asking
25
+ for an ineffective larger limit.
package/dist/index.d.ts CHANGED
@@ -76,6 +76,8 @@ export interface PickleRequest {
76
76
  responseType: string;
77
77
  responseTypeDefinition?: CollectionTypeDescriptor;
78
78
  createdAt?: string;
79
+ /** Stable file modification time for invalidating an opened context. */
80
+ modifiedAt?: string;
79
81
  dueAt?: string;
80
82
  tags: string[];
81
83
  links: PickleLink[];
@@ -118,7 +120,11 @@ export declare class PickleCollection {
118
120
  collection: CollectionDescription;
119
121
  contract: PickleContract;
120
122
  }>;
121
- list(options?: ConnectRequestOptions): Promise<PickleRequest[]>;
123
+ /** Omit Markdown bodies for an inbox; load individual context with readBody. */
124
+ list({ includeBody, ...options }?: ConnectRequestOptions & {
125
+ includeBody?: boolean;
126
+ }): Promise<PickleRequest[]>;
127
+ readBody(request: Pick<PickleRequest, "path">, options?: ConnectRequestOptions): Promise<string>;
122
128
  respond(request: PickleRequest, payload: JsonObject, options?: RespondOptions): Promise<PickleResponseSubmission>;
123
129
  readAttachment(attachment: PickleAttachment, options?: ConnectRequestOptions): Promise<PickleAttachmentContent | null>;
124
130
  pendingResponses(): readonly PicklePendingResponse[];
package/dist/index.js CHANGED
@@ -51,13 +51,14 @@ export class PickleCollection {
51
51
  this.contract ??= resolvePickleContract(this.description);
52
52
  return { collection: this.description, contract: this.contract };
53
53
  }
54
- async list(options = {}) {
54
+ /** Omit Markdown bodies for an inbox; load individual context with readBody. */
55
+ async list({ includeBody = true, ...options } = {}) {
55
56
  const { collection, contract } = await this.describe(options);
56
57
  const requestQuery = requireOutcome(await this.connect.queryAll({
57
58
  types: contract.implementations.map(({ typeName }) => typeName),
58
- includeBody: true,
59
+ includeBody,
59
60
  frontmatterMode: "effective"
60
- }, options));
61
+ }, { ...options, pageSize: 256 }));
61
62
  const requests = requestQuery.results.map(requireEffectiveFrontmatter);
62
63
  const responseTypes = [
63
64
  ...new Set(requests
@@ -70,14 +71,18 @@ export class PickleCollection {
70
71
  const responses = responseTypes.length
71
72
  ? (requireOutcome(await this.connect.queryAll({
72
73
  types: responseTypes,
73
- includeBody: true,
74
+ includeBody: false,
74
75
  frontmatterMode: "effective"
75
- }, options))).results.map(requireEffectiveFrontmatter)
76
+ }, { ...options, pageSize: 256 }))).results.map(requireEffectiveFrontmatter)
76
77
  : [];
77
78
  return requests
78
79
  .map((record) => normalizeRequest(record, responses, collection, contract))
79
80
  .sort((left, right) => (right.createdAt ?? "").localeCompare(left.createdAt ?? ""));
80
81
  }
82
+ async readBody(request, options = {}) {
83
+ const record = requireOutcome(await this.connect.read({ path: request.path }, options));
84
+ return record.body ?? "";
85
+ }
81
86
  async respond(request, payload, options = {}) {
82
87
  if (request.state !== "pending") {
83
88
  throw new PickleContractError(request.state === "conflict"
@@ -200,6 +205,7 @@ function normalizeRequest(record, responseRecords, description, contract) {
200
205
  "agent",
201
206
  message: stringField(record.effectiveFrontmatter, role(implementation, "message", "message")),
202
207
  body: record.body ?? "",
208
+ modifiedAt: record.file?.mtime,
203
209
  kind: stringField(record.effectiveFrontmatter, role(implementation, "kind", "kind")) ||
204
210
  "approval",
205
211
  priority: stringField(record.effectiveFrontmatter, role(implementation, "priority", "priority")) || "normal",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/pickle",
3
- "version": "0.1.0-beta.95",
3
+ "version": "0.1.0-beta.97",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,13 +22,13 @@
22
22
  "README.md"
23
23
  ],
24
24
  "dependencies": {
25
- "@mdbase-dev/connect": "0.1.0-beta.95"
25
+ "@mdbase-dev/connect": "0.1.0-beta.97"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^7.0.2",
29
29
  "vitest": "^4.1.10",
30
- "@mdbase-dev/connect-dev": "0.1.0-beta.95",
31
- "@mdbase-dev/connect-testing": "0.1.0-beta.95"
30
+ "@mdbase-dev/connect-testing": "0.1.0-beta.97",
31
+ "@mdbase-dev/connect-dev": "0.1.0-beta.97"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",