@autono/pinbox-core 0.12.0 → 0.14.0

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.
@@ -1,4 +1,4 @@
1
- import { r as ConnectorTransport, t as Connector } from "../types-Bu7YuW6a.js";
1
+ import { r as ConnectorTransport, t as Connector } from "../types-ArXPudwn.js";
2
2
  //#region src/connectors/github.d.ts
3
3
  declare function createGithubConnector(transport: ConnectorTransport): Connector;
4
4
  //#endregion
@@ -1,6 +1,6 @@
1
- import { g as ThreadMessage } from "../schema-HSZFobyd.js";
2
- import { a as RemoteStatus, i as RemoteComment, n as ConnectorEvents, r as ConnectorTransport, t as Connector } from "../types-Bu7YuW6a.js";
3
- import { c as PinStore } from "../store-DPp8xMdp.js";
1
+ import { g as ThreadMessage } from "../schema-DrY4XoLZ.js";
2
+ import { a as RemoteStatus, i as RemoteComment, n as ConnectorEvents, r as ConnectorTransport, t as Connector } from "../types-ArXPudwn.js";
3
+ import { c as PinStore } from "../store-K72bMbn7.js";
4
4
  //#region src/connectors/mirror.d.ts
5
5
  declare function createConnectorEvents(store: PinStore, pinId: string): ConnectorEvents;
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { t as GetPin } from "../payload-BLDLdUIh.js";
2
- import { n as DeliveryAdapter } from "../router-DBAEQNfs.js";
1
+ import { t as GetPin } from "../payload-Bfo0QpKF.js";
2
+ import { n as DeliveryAdapter } from "../router-BTQxKdcc.js";
3
3
  //#region src/delivery/openclaw.d.ts
4
4
  declare function createOpenclawAdapter(opts?: {
5
5
  command?: string[];
@@ -1,5 +1,5 @@
1
- import { t as GetPin } from "../payload-BLDLdUIh.js";
2
- import { n as DeliveryAdapter } from "../router-DBAEQNfs.js";
1
+ import { t as GetPin } from "../payload-Bfo0QpKF.js";
2
+ import { n as DeliveryAdapter } from "../router-BTQxKdcc.js";
3
3
  //#region src/delivery/resume.d.ts
4
4
  type ResumeCommand = (key: string, prompt: string) => string[];
5
5
  declare const RESUME_COMMANDS: Record<string, ResumeCommand>;
@@ -1,2 +1,2 @@
1
- import { a as HOOK_CAPABLE_AGENTS, c as buildReplyPrompt, i as hooksEscalateMs, n as DeliveryAdapter, o as createHooksAdapter, r as DeliveryRouter, s as buildInjectionContext, t as DEFAULT_HOOKS_ESCALATE_MS } from "../router-DBAEQNfs.js";
1
+ import { a as HOOK_CAPABLE_AGENTS, c as buildReplyPrompt, i as hooksEscalateMs, n as DeliveryAdapter, o as createHooksAdapter, r as DeliveryRouter, s as buildInjectionContext, t as DEFAULT_HOOKS_ESCALATE_MS } from "../router-BTQxKdcc.js";
2
2
  export { DEFAULT_HOOKS_ESCALATE_MS, DeliveryAdapter, DeliveryRouter, HOOK_CAPABLE_AGENTS, buildInjectionContext, buildReplyPrompt, createHooksAdapter, hooksEscalateMs };
@@ -1,4 +1,4 @@
1
- import { n as DeliveryAdapter } from "../router-DBAEQNfs.js";
1
+ import { n as DeliveryAdapter } from "../router-BTQxKdcc.js";
2
2
  //#region src/delivery/webhook.d.ts
3
3
  type WebhookConfig = {
4
4
  url: string;
package/dist/do.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as Link, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-HSZFobyd.js";
2
- import { r as SessionStore } from "./sessions-CHtzoBF6.js";
3
- import { a as LinkStore, c as PinStore, i as DeliveryStore, l as StoredEvent, t as CursorStore } from "./store-DPp8xMdp.js";
1
+ import { a as Link, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-DrY4XoLZ.js";
2
+ import { r as SessionStore } from "./sessions-B74wWsan.js";
3
+ import { a as LinkStore, c as PinStore, i as DeliveryStore, l as StoredEvent, t as CursorStore } from "./store-K72bMbn7.js";
4
4
  import { Broadcaster } from "./ws.js";
5
5
  import { DurableObjectState, R2Bucket, WebSocket } from "@cloudflare/workers-types";
6
6
  //#region src/do-store.d.ts
package/dist/do.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AttachmentSchema, PinInputSchema, PinSchema, SessionRefSchema, ThreadMessageSchema } from "./schema.js";
2
2
  import { a as NotFoundError, i as ConflictError, o as newId, t as SessionSchema } from "./sessions-DrCVTMfI.js";
3
- import { t as MIGRATIONS } from "./store-qtk4G3q4.js";
3
+ import { t as MIGRATIONS } from "./store-IR3o5YwY.js";
4
4
  import { n as createHubHandler, o as ok, r as err } from "./hub-I67BuX9S.js";
5
5
  import { ClientHelloSchema, WS_CLOSE_PROTOCOL, WS_CLOSE_UNAUTHORIZED, WS_TOKEN_SUBPROTOCOL_PREFIX, encodeWsEvent } from "./ws-protocol.js";
6
6
  import { n as DeliveryRouter } from "./router-B8EOto30.js";
@@ -222,15 +222,17 @@ var DoSqlitePinStore = class {
222
222
  const mergedEnv = { ...parsed.env };
223
223
  if (env.branch !== void 0) mergedEnv.branch = env.branch;
224
224
  if (env.commit !== void 0) mergedEnv.commit = env.commit;
225
- const pin = PinSchema.parse({
226
- ...parsed,
227
- env: mergedEnv,
228
- id: newId("pin"),
229
- schemaVersion: 1,
230
- status: "open",
231
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
232
- });
233
225
  return this.mutate(() => {
226
+ const count = this.sql.exec("SELECT COUNT(*) AS n FROM pins").toArray()[0]?.n ?? 0;
227
+ const pin = PinSchema.parse({
228
+ ...parsed,
229
+ env: mergedEnv,
230
+ id: newId("pin"),
231
+ n: count + 1,
232
+ schemaVersion: 1,
233
+ status: "open",
234
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
235
+ });
234
236
  this.sql.exec("INSERT INTO pins (id, status, created_at, json) VALUES (?, ?, ?, ?)", pin.id, pin.status, pin.createdAt, JSON.stringify(pin));
235
237
  this.sql.exec("INSERT INTO pins_fts (pin_id, kind, body) VALUES (?, ?, ?)", pin.id, "pin", pin.text);
236
238
  this.appendEvent("pin.created", pin.createdAt, pin);
@@ -1,5 +1,5 @@
1
- import { r as Attachment } from "./schema-HSZFobyd.js";
2
- import { c as PinStore } from "./store-DPp8xMdp.js";
1
+ import { r as Attachment } from "./schema-DrY4XoLZ.js";
2
+ import { c as PinStore } from "./store-K72bMbn7.js";
3
3
  import { HubOptions } from "./hub.js";
4
4
  //#region src/attachments.d.ts
5
5
  interface AttachmentSink {
package/dist/hub.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Connector } from "./types-Bu7YuW6a.js";
2
- import { c as PinStore } from "./store-DPp8xMdp.js";
1
+ import { t as Connector } from "./types-ArXPudwn.js";
2
+ import { c as PinStore } from "./store-K72bMbn7.js";
3
3
  //#region src/hub.d.ts
4
4
  type Identity = {
5
5
  userId: string;
@@ -54,6 +54,36 @@ declare function mustGetPin(store: PinStore, id: string): {
54
54
  selectedText?: string | undefined;
55
55
  textRuns?: string[] | undefined;
56
56
  } | undefined;
57
+ targets?: {
58
+ url?: string | undefined;
59
+ selector?: string | undefined;
60
+ tag?: string | undefined;
61
+ rect?: {
62
+ x: number;
63
+ y: number;
64
+ width: number;
65
+ height: number;
66
+ } | undefined;
67
+ spot?: {
68
+ x: number;
69
+ y: number;
70
+ } | undefined;
71
+ fixed?: boolean | undefined;
72
+ anchor?: string | undefined;
73
+ source?: {
74
+ file: string;
75
+ line?: number | undefined;
76
+ via: "framework" | "none" | "plugin";
77
+ } | undefined;
78
+ context?: {
79
+ classes?: string[] | undefined;
80
+ styles?: Record<string, string> | undefined;
81
+ aria?: Record<string, string> | undefined;
82
+ nearbyText?: string | undefined;
83
+ selectedText?: string | undefined;
84
+ textRuns?: string[] | undefined;
85
+ } | undefined;
86
+ }[] | undefined;
57
87
  } | undefined;
58
88
  move?: {
59
89
  from: {
@@ -101,6 +131,7 @@ declare function mustGetPin(store: PinStore, id: string): {
101
131
  height?: number | undefined;
102
132
  }[] | undefined;
103
133
  id: string;
134
+ n?: number | undefined;
104
135
  schemaVersion: 1;
105
136
  status: "open" | "resolved";
106
137
  createdAt: string;
@@ -1,4 +1,4 @@
1
- import { s as Pin } from "./schema-HSZFobyd.js";
1
+ import { s as Pin } from "./schema-DrY4XoLZ.js";
2
2
  //#region src/markdown.d.ts
3
3
  type DetailLevel = "compact" | "standard" | "forensic";
4
4
  declare function pinsToMarkdown(pins: Pin[], level: DetailLevel): string;
package/dist/markdown.js CHANGED
@@ -10,12 +10,20 @@ function pinToMarkdown(pin, level) {
10
10
  lines.push(...forensicBlock(pin));
11
11
  return lines;
12
12
  }
13
- /** `- [open] <where> — <text> (<id>)`, minus the locus when the pin names no place. */
13
+ /** `- [open] <where> — <text> (<id>)`, minus the locus when the pin names no place.
14
+ * A multi-target pin's headline carries every extra locus inline — the compact dial
15
+ * is what briefs inject, and the pattern ("three identical rows") IS the feedback. */
14
16
  function headline(pin) {
15
17
  const where = pinLocus(pin);
16
- const head = where === void 0 ? "" : `${where} — `;
18
+ const extras = extraLoci(pin);
19
+ const plus = extras.length === 0 ? "" : ` (+${extras.join(", ")})`;
20
+ const head = where === void 0 ? "" : `${where}${plus} — `;
17
21
  return `- [${pin.status}] ${head}${pin.text} (${pin.id})`;
18
22
  }
23
+ /** The extra loci of a multi-target pin, named like pinLocus names the anchor. */
24
+ function extraLoci(pin) {
25
+ return (pin.target?.targets ?? []).map((t) => t.selector ?? t.anchor ?? t.tag).filter((locus) => locus !== void 0);
26
+ }
19
27
  /** The indented context lines, each present only when the fact behind it exists. */
20
28
  function standardFacts(pin) {
21
29
  const target = pin.target;
@@ -0,0 +1,6 @@
1
+ import { s as Pin } from "./schema-DrY4XoLZ.js";
2
+ import "./store-K72bMbn7.js";
3
+ //#region src/delivery/payload.d.ts
4
+ type GetPin = (id: string) => Pin | null;
5
+ //#endregion
6
+ export { GetPin as t };
@@ -1,6 +1,6 @@
1
- import { g as ThreadMessage, s as Pin } from "./schema-HSZFobyd.js";
2
- import { t as Session } from "./sessions-CHtzoBF6.js";
3
- import { c as PinStore, l as StoredEvent } from "./store-DPp8xMdp.js";
1
+ import { g as ThreadMessage, s as Pin } from "./schema-DrY4XoLZ.js";
2
+ import { t as Session } from "./sessions-B74wWsan.js";
3
+ import { c as PinStore, l as StoredEvent } from "./store-K72bMbn7.js";
4
4
  //#region src/delivery/context.d.ts
5
5
  /**
6
6
  * The per-turn injection context: every open pin at the `compact` dial,
@@ -116,6 +116,45 @@ declare const PinInputSchema: z.ZodObject<{
116
116
  selectedText: z.ZodOptional<z.ZodString>;
117
117
  textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
118
  }, z.core.$strip>>;
119
+ targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
120
+ url: z.ZodOptional<z.ZodString>;
121
+ selector: z.ZodOptional<z.ZodString>;
122
+ tag: z.ZodOptional<z.ZodString>;
123
+ rect: z.ZodOptional<z.ZodType<{
124
+ x: number;
125
+ y: number;
126
+ width: number;
127
+ height: number;
128
+ }, unknown, z.core.$ZodTypeInternals<{
129
+ x: number;
130
+ y: number;
131
+ width: number;
132
+ height: number;
133
+ }, unknown>>>;
134
+ spot: z.ZodOptional<z.ZodObject<{
135
+ x: z.ZodNumber;
136
+ y: z.ZodNumber;
137
+ }, z.core.$strip>>;
138
+ fixed: z.ZodOptional<z.ZodBoolean>;
139
+ anchor: z.ZodOptional<z.ZodString>;
140
+ source: z.ZodOptional<z.ZodObject<{
141
+ file: z.ZodString;
142
+ line: z.ZodOptional<z.ZodNumber>;
143
+ via: z.ZodEnum<{
144
+ framework: "framework";
145
+ none: "none";
146
+ plugin: "plugin";
147
+ }>;
148
+ }, z.core.$strip>>;
149
+ context: z.ZodOptional<z.ZodObject<{
150
+ classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ styles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
152
+ aria: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
153
+ nearbyText: z.ZodOptional<z.ZodString>;
154
+ selectedText: z.ZodOptional<z.ZodString>;
155
+ textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ }, z.core.$strip>>;
157
+ }, z.core.$strip>>>;
119
158
  }, z.core.$strip>>;
120
159
  move: z.ZodOptional<z.ZodObject<{
121
160
  from: z.ZodType<{
@@ -223,6 +262,45 @@ declare const PinSchema: z.ZodObject<{
223
262
  selectedText: z.ZodOptional<z.ZodString>;
224
263
  textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
225
264
  }, z.core.$strip>>;
265
+ targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
266
+ url: z.ZodOptional<z.ZodString>;
267
+ selector: z.ZodOptional<z.ZodString>;
268
+ tag: z.ZodOptional<z.ZodString>;
269
+ rect: z.ZodOptional<z.ZodType<{
270
+ x: number;
271
+ y: number;
272
+ width: number;
273
+ height: number;
274
+ }, unknown, z.core.$ZodTypeInternals<{
275
+ x: number;
276
+ y: number;
277
+ width: number;
278
+ height: number;
279
+ }, unknown>>>;
280
+ spot: z.ZodOptional<z.ZodObject<{
281
+ x: z.ZodNumber;
282
+ y: z.ZodNumber;
283
+ }, z.core.$strip>>;
284
+ fixed: z.ZodOptional<z.ZodBoolean>;
285
+ anchor: z.ZodOptional<z.ZodString>;
286
+ source: z.ZodOptional<z.ZodObject<{
287
+ file: z.ZodString;
288
+ line: z.ZodOptional<z.ZodNumber>;
289
+ via: z.ZodEnum<{
290
+ framework: "framework";
291
+ none: "none";
292
+ plugin: "plugin";
293
+ }>;
294
+ }, z.core.$strip>>;
295
+ context: z.ZodOptional<z.ZodObject<{
296
+ classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
297
+ styles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
298
+ aria: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
299
+ nearbyText: z.ZodOptional<z.ZodString>;
300
+ selectedText: z.ZodOptional<z.ZodString>;
301
+ textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
302
+ }, z.core.$strip>>;
303
+ }, z.core.$strip>>>;
226
304
  }, z.core.$strip>>;
227
305
  move: z.ZodOptional<z.ZodObject<{
228
306
  from: z.ZodType<{
@@ -286,6 +364,7 @@ declare const PinSchema: z.ZodObject<{
286
364
  height: z.ZodOptional<z.ZodNumber>;
287
365
  }, z.core.$strip>>>;
288
366
  id: z.ZodString;
367
+ n: z.ZodOptional<z.ZodNumber>;
289
368
  schemaVersion: z.ZodLiteral<1>;
290
369
  status: z.ZodDefault<z.ZodEnum<{
291
370
  open: "open";
package/dist/schema.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as ThreadMessageSchema, a as Link, c as PinInput, d as Rect, f as RectSchema, g as ThreadMessage, h as SessionRefSchema, i as AttachmentSchema, l as PinInputSchema, m as SessionRef, n as AppliedEditSchema, o as LinkSchema, p as SCHEMA_VERSION, r as Attachment, s as Pin, t as AppliedEdit, u as PinSchema, v as pinJsonSchema } from "./schema-HSZFobyd.js";
1
+ import { _ as ThreadMessageSchema, a as Link, c as PinInput, d as Rect, f as RectSchema, g as ThreadMessage, h as SessionRefSchema, i as AttachmentSchema, l as PinInputSchema, m as SessionRef, n as AppliedEditSchema, o as LinkSchema, p as SCHEMA_VERSION, r as Attachment, s as Pin, t as AppliedEdit, u as PinSchema, v as pinJsonSchema } from "./schema-DrY4XoLZ.js";
2
2
  export { AppliedEdit, AppliedEditSchema, Attachment, AttachmentSchema, Link, LinkSchema, Pin, PinInput, PinInputSchema, PinSchema, Rect, RectSchema, SCHEMA_VERSION, SessionRef, SessionRefSchema, ThreadMessage, ThreadMessageSchema, pinJsonSchema };
package/dist/schema.js CHANGED
@@ -76,7 +76,7 @@ const ContextSchema = z.object({
76
76
  */
77
77
  textRuns: z.array(z.string()).optional()
78
78
  });
79
- const TargetSchema = z.object({
79
+ const TargetBaseSchema = z.object({
80
80
  url: z.string().optional(),
81
81
  selector: z.string().optional(),
82
82
  tag: z.string().optional(),
@@ -91,6 +91,7 @@ const TargetSchema = z.object({
91
91
  source: SourceSchema.optional(),
92
92
  context: ContextSchema.optional()
93
93
  });
94
+ const TargetSchema = TargetBaseSchema.extend({ targets: z.array(TargetBaseSchema).optional() });
94
95
  const EnvSchema = z.object({
95
96
  viewport: z.object({
96
97
  w: z.number(),
@@ -138,6 +139,12 @@ const PinInputSchema = z.object({
138
139
  });
139
140
  const PinSchema = PinInputSchema.extend({
140
141
  id: z.string().regex(/^pin_[a-z0-9]{10}$/),
142
+ /**
143
+ * Stable per-project ordinal, hub-assigned at creation like an issue number —
144
+ * never renumbered by resolution or reordering (dogfood: index-derived chip
145
+ * numbers kept shifting). Optional because pins predate it; readers fall back.
146
+ */
147
+ n: z.number().int().positive().optional(),
141
148
  schemaVersion: z.literal(1),
142
149
  status: z.enum(["open", "resolved"]).default("open"),
143
150
  createdAt: z.string(),
package/dist/schema.json CHANGED
@@ -137,6 +137,136 @@
137
137
  }
138
138
  },
139
139
  "additionalProperties": false
140
+ },
141
+ "targets": {
142
+ "type": "array",
143
+ "items": {
144
+ "type": "object",
145
+ "properties": {
146
+ "url": {
147
+ "type": "string"
148
+ },
149
+ "selector": {
150
+ "type": "string"
151
+ },
152
+ "tag": {
153
+ "type": "string"
154
+ },
155
+ "rect": {
156
+ "type": "object",
157
+ "properties": {
158
+ "x": {
159
+ "type": "number"
160
+ },
161
+ "y": {
162
+ "type": "number"
163
+ },
164
+ "width": {
165
+ "type": "number"
166
+ },
167
+ "height": {
168
+ "type": "number"
169
+ }
170
+ },
171
+ "required": [
172
+ "x",
173
+ "y",
174
+ "width",
175
+ "height"
176
+ ],
177
+ "additionalProperties": false
178
+ },
179
+ "spot": {
180
+ "type": "object",
181
+ "properties": {
182
+ "x": {
183
+ "type": "number"
184
+ },
185
+ "y": {
186
+ "type": "number"
187
+ }
188
+ },
189
+ "required": [
190
+ "x",
191
+ "y"
192
+ ],
193
+ "additionalProperties": false
194
+ },
195
+ "fixed": {
196
+ "type": "boolean"
197
+ },
198
+ "anchor": {
199
+ "type": "string"
200
+ },
201
+ "source": {
202
+ "type": "object",
203
+ "properties": {
204
+ "file": {
205
+ "type": "string"
206
+ },
207
+ "line": {
208
+ "type": "number"
209
+ },
210
+ "via": {
211
+ "type": "string",
212
+ "enum": [
213
+ "plugin",
214
+ "framework",
215
+ "none"
216
+ ]
217
+ }
218
+ },
219
+ "required": [
220
+ "file",
221
+ "via"
222
+ ],
223
+ "additionalProperties": false
224
+ },
225
+ "context": {
226
+ "type": "object",
227
+ "properties": {
228
+ "classes": {
229
+ "type": "array",
230
+ "items": {
231
+ "type": "string"
232
+ }
233
+ },
234
+ "styles": {
235
+ "type": "object",
236
+ "propertyNames": {
237
+ "type": "string"
238
+ },
239
+ "additionalProperties": {
240
+ "type": "string"
241
+ }
242
+ },
243
+ "aria": {
244
+ "type": "object",
245
+ "propertyNames": {
246
+ "type": "string"
247
+ },
248
+ "additionalProperties": {
249
+ "type": "string"
250
+ }
251
+ },
252
+ "nearbyText": {
253
+ "type": "string"
254
+ },
255
+ "selectedText": {
256
+ "type": "string"
257
+ },
258
+ "textRuns": {
259
+ "type": "array",
260
+ "items": {
261
+ "type": "string"
262
+ }
263
+ }
264
+ },
265
+ "additionalProperties": false
266
+ }
267
+ },
268
+ "additionalProperties": false
269
+ }
140
270
  }
141
271
  },
142
272
  "additionalProperties": false
@@ -327,6 +457,11 @@
327
457
  "type": "string",
328
458
  "pattern": "^pin_[a-z0-9]{10}$"
329
459
  },
460
+ "n": {
461
+ "type": "integer",
462
+ "exclusiveMinimum": 0,
463
+ "maximum": 9007199254740991
464
+ },
330
465
  "schemaVersion": {
331
466
  "type": "number",
332
467
  "const": 1
@@ -1,4 +1,4 @@
1
- import { m as SessionRef } from "./schema-HSZFobyd.js";
1
+ import { m as SessionRef } from "./schema-DrY4XoLZ.js";
2
2
  import { z } from "zod";
3
3
  import { Database } from "bun:sqlite";
4
4
  //#region src/trailer.d.ts
@@ -1,2 +1,2 @@
1
- import { a as parseTrailers, i as SqliteSessionStore, n as SessionSchema, r as SessionStore, t as Session } from "./sessions-CHtzoBF6.js";
1
+ import { a as parseTrailers, i as SqliteSessionStore, n as SessionSchema, r as SessionStore, t as Session } from "./sessions-B74wWsan.js";
2
2
  export { Session, SessionSchema, SessionStore, SqliteSessionStore, parseTrailers };
@@ -188,6 +188,9 @@ var SummaryRow = class {
188
188
  var CursorRow = class {
189
189
  last_seq;
190
190
  };
191
+ var CountRow = class {
192
+ n;
193
+ };
191
194
  var LinkRow = class {
192
195
  pin_id;
193
196
  connector;
@@ -229,6 +232,7 @@ var SqlitePinStore = class {
229
232
  selectEventsAfter;
230
233
  selectSummary;
231
234
  insertFts;
235
+ selectPinCount;
232
236
  selectSearch;
233
237
  insertLink;
234
238
  selectLinksForPin;
@@ -258,6 +262,7 @@ var SqlitePinStore = class {
258
262
  (SELECT COUNT(*) FROM pins WHERE status = 'resolved') AS resolved,
259
263
  (SELECT COALESCE(MAX(seq), 0) FROM events) AS lastEventSeq`).as(SummaryRow);
260
264
  this.insertFts = db.query("INSERT INTO pins_fts (pin_id, kind, body) VALUES (?, ?, ?)");
265
+ this.selectPinCount = db.query("SELECT COUNT(*) AS n FROM pins").as(CountRow);
261
266
  this.selectSearch = db.query(`SELECT json FROM pins
262
267
  WHERE id IN (SELECT DISTINCT pin_id FROM pins_fts WHERE pins_fts MATCH ?)
263
268
  ORDER BY created_at DESC, rowid DESC`).as(JsonRow);
@@ -297,15 +302,18 @@ var SqlitePinStore = class {
297
302
  const mergedEnv = { ...parsed.env };
298
303
  if (env.branch !== void 0) mergedEnv.branch = env.branch;
299
304
  if (env.commit !== void 0) mergedEnv.commit = env.commit;
300
- const pin = PinSchema.parse({
301
- ...parsed,
302
- env: mergedEnv,
303
- id: newId("pin"),
304
- schemaVersion: 1,
305
- status: "open",
306
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
307
- });
305
+ let pin;
308
306
  this.mutate(() => {
307
+ const n = (this.selectPinCount.get()?.n ?? 0) + 1;
308
+ pin = PinSchema.parse({
309
+ ...parsed,
310
+ env: mergedEnv,
311
+ id: newId("pin"),
312
+ n,
313
+ schemaVersion: 1,
314
+ status: "open",
315
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
316
+ });
309
317
  this.insertPin.run(pin.id, pin.status, pin.createdAt, JSON.stringify(pin));
310
318
  this.insertFts.run(pin.id, "pin", pin.text);
311
319
  this.logEvent("pin.created", pin.createdAt, pin);
@@ -1,5 +1,5 @@
1
- import { a as Link, c as PinInput, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-HSZFobyd.js";
2
- import { r as SessionStore } from "./sessions-CHtzoBF6.js";
1
+ import { a as Link, c as PinInput, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-DrY4XoLZ.js";
2
+ import { r as SessionStore } from "./sessions-B74wWsan.js";
3
3
  //#region src/store-errors.d.ts
4
4
  /** The addressed row does not exist. Mapped to 404 / `E_NOT_FOUND` by the hub. */
5
5
  declare class NotFoundError extends Error {}
package/dist/store.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as LinkStore, c as PinStore, d as ConflictError, f as NotFoundError, i as DeliveryStore, l as StoredEvent, n as DeliveryRow, o as MIGRATIONS, r as DeliveryStatus, s as Migration, t as CursorStore, u as openStore } from "./store-DPp8xMdp.js";
1
+ import { a as LinkStore, c as PinStore, d as ConflictError, f as NotFoundError, i as DeliveryStore, l as StoredEvent, n as DeliveryRow, o as MIGRATIONS, r as DeliveryStatus, s as Migration, t as CursorStore, u as openStore } from "./store-K72bMbn7.js";
2
2
  export { ConflictError, CursorStore, DeliveryRow, DeliveryStatus, DeliveryStore, LinkStore, MIGRATIONS, Migration, NotFoundError, PinStore, StoredEvent, openStore };
package/dist/store.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as NotFoundError, i as ConflictError } from "./sessions-DrCVTMfI.js";
2
- import { n as openStore, t as MIGRATIONS } from "./store-qtk4G3q4.js";
2
+ import { n as openStore, t as MIGRATIONS } from "./store-IR3o5YwY.js";
3
3
  export { ConflictError, MIGRATIONS, NotFoundError, openStore };
@@ -1,4 +1,4 @@
1
- import { a as Link, g as ThreadMessage, s as Pin } from "./schema-HSZFobyd.js";
1
+ import { a as Link, g as ThreadMessage, s as Pin } from "./schema-DrY4XoLZ.js";
2
2
  //#region src/connectors/types.d.ts
3
3
  /** Host-injected transport: local = `gh` CLI shell-out (impl in packages/cli, Bun.$); Worker = App token fetch. */
4
4
  interface ConnectorTransport {
@@ -1,4 +1,4 @@
1
- import { l as StoredEvent } from "./store-DPp8xMdp.js";
1
+ import { l as StoredEvent } from "./store-K72bMbn7.js";
2
2
  import { z } from "zod";
3
3
  //#region src/ws-protocol.d.ts
4
4
  declare const WS_PATH = "/ws";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autono/pinbox-core",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +0,0 @@
1
- import { s as Pin } from "./schema-HSZFobyd.js";
2
- import "./store-DPp8xMdp.js";
3
- //#region src/delivery/payload.d.ts
4
- type GetPin = (id: string) => Pin | null;
5
- //#endregion
6
- export { GetPin as t };