@autono/pinbox-core 0.18.0 → 0.20.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.
Files changed (40) hide show
  1. package/dist/connectors/github.d.ts +1 -1
  2. package/dist/connectors/index.d.ts +30 -4
  3. package/dist/connectors/index.js +3 -3
  4. package/dist/delivery/openclaw.d.ts +2 -2
  5. package/dist/delivery/openclaw.js +1 -1
  6. package/dist/delivery/resume.d.ts +2 -2
  7. package/dist/delivery/resume.js +1 -1
  8. package/dist/delivery/router.d.ts +1 -1
  9. package/dist/delivery/router.js +1 -1
  10. package/dist/delivery/webhook.d.ts +1 -1
  11. package/dist/do.d.ts +10 -4
  12. package/dist/do.js +22 -6
  13. package/dist/{hub-I67BuX9S.js → hub-Ds7W5n89.js} +2 -2
  14. package/dist/hub-server.d.ts +2 -2
  15. package/dist/hub-server.js +1 -1
  16. package/dist/hub.d.ts +30 -2
  17. package/dist/hub.js +1 -1
  18. package/dist/markdown.d.ts +1 -1
  19. package/dist/markdown.js +5 -0
  20. package/dist/payload-CmKx5yL2.d.ts +6 -0
  21. package/dist/{poll-BrcAuaAz.js → poll-ZSv3wN9C.js} +1 -1
  22. package/dist/{proc-BMp_pbPS.js → proc-CBLeAM7c.js} +1 -1
  23. package/dist/{router-BH74psWn.js → router-DrYLHCF4.js} +1 -1
  24. package/dist/{router-DOwWVak2.d.ts → router-NoiuUFb-.d.ts} +3 -3
  25. package/dist/{schema-BlM4lTLW.d.ts → schema-BLZ3MqMD.d.ts} +101 -1
  26. package/dist/schema-DDpii7iQ.js +192 -0
  27. package/dist/schema.d.ts +2 -2
  28. package/dist/schema.js +2 -163
  29. package/dist/schema.json +246 -0
  30. package/dist/{sessions-BOrd8Yvv.d.ts → sessions-Bd7_G5jW.d.ts} +1 -1
  31. package/dist/sessions.d.ts +1 -1
  32. package/dist/{slack-Dnq9bnXd.js → slack-C4P0AbuZ.js} +211 -61
  33. package/dist/{store-IR3o5YwY.js → store-Daziyk0_.js} +1 -1
  34. package/dist/{store-DAB5CEA1.d.ts → store-QLtACKhW.d.ts} +2 -2
  35. package/dist/store.d.ts +1 -1
  36. package/dist/store.js +1 -1
  37. package/dist/{types-BmfT_m1p.d.ts → types-BIm_s4nu.d.ts} +1 -1
  38. package/dist/ws-protocol.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/dist/payload-CYbjb8ZB.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- import { r as ConnectorTransport, t as Connector } from "../types-BmfT_m1p.js";
1
+ import { r as ConnectorTransport, t as Connector } from "../types-BIm_s4nu.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-BlM4lTLW.js";
2
- import { a as RemoteStatus, i as RemoteComment, n as ConnectorEvents, r as ConnectorTransport, t as Connector } from "../types-BmfT_m1p.js";
3
- import { c as PinStore } from "../store-DAB5CEA1.js";
1
+ import { g as ThreadMessage } from "../schema-BLZ3MqMD.js";
2
+ import { a as RemoteStatus, i as RemoteComment, n as ConnectorEvents, r as ConnectorTransport, t as Connector } from "../types-BIm_s4nu.js";
3
+ import { c as PinStore } from "../store-QLtACKhW.js";
4
4
  //#region src/connectors/github-app.d.ts
5
5
  /** The slice of fetch this transport uses — injectable without dragging in Bun's extras. */
6
6
  type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
@@ -25,12 +25,38 @@ declare class GithubAppError extends Error {
25
25
  readonly status: number;
26
26
  constructor(message: string, status: number, hint?: string);
27
27
  }
28
+ /** The App's own credential: a short-lived RS256 JWT with `iss` = app id. */
29
+ declare function signAppJwt(appId: string, privateKeyPem: string, now?: () => number): Promise<string>;
30
+ /** GitHub's standard request headers for the REST API. */
31
+ declare function githubHeaders(bearer: string, json?: boolean): Record<string, string>;
32
+ type InstallationToken = {
33
+ token: string;
34
+ expiresAt: number;
35
+ };
36
+ /** Exchange an App JWT for a one-hour installation token. */
37
+ declare function mintInstallationToken(api: string, installationId: string, appJwt: string, fetchImpl: FetchLike): Promise<InstallationToken>;
28
38
  declare function createGithubAppTransport(opts: GithubAppTransportOptions): ConnectorTransport;
29
39
  /** PKCS#8 PEM in, PKCS#8 PEM out; PKCS#1 PEM (GitHub's download) is wrapped into PKCS#8. */
30
40
  declare function toPkcs8Pem(pem: string): string;
31
41
  /** PrivateKeyInfo ::= SEQUENCE { version 0, algorithm rsaEncryption, privateKey OCTET STRING }. */
32
42
  declare function pkcs1ToPkcs8(pkcs1: Uint8Array): Uint8Array;
33
43
  //#endregion
44
+ //#region src/connectors/github-webhook.d.ts
45
+ type GithubWebhookOptions = {
46
+ /** The webhook secret configured on the App — HMAC-SHA256 key for the signature. */
47
+ secret: string;
48
+ /** "owner/name": events for any other repository are acknowledged and ignored. */
49
+ repo: string;
50
+ };
51
+ /**
52
+ * Handle one webhook delivery. Returns the hub's machine envelope: 200 with
53
+ * `{ applied, ignored }`, 401 `E_AUTH` on a signature failure, 400 `E_INVALID_INPUT` on a
54
+ * body GitHub would never send.
55
+ */
56
+ declare function handleGithubWebhook(req: Request, store: PinStore, opts: GithubWebhookOptions): Promise<Response>;
57
+ /** `sha256=<hex hmac>` over the raw body, compared in constant time. */
58
+ declare function signatureValid(secret: string, rawBody: string, header: string | null): Promise<boolean>;
59
+ //#endregion
34
60
  //#region src/connectors/mirror.d.ts
35
61
  declare function createConnectorEvents(store: PinStore, pinId: string): ConnectorEvents;
36
62
  /**
@@ -64,4 +90,4 @@ type SlackConnectorOptions = {
64
90
  /** Links are `ref: "<channel>/<thread_ts>"`; every thread op derives channel + ts from the ref. */
65
91
  declare function createSlackConnector(transport: ConnectorTransport, opts: SlackConnectorOptions): Connector;
66
92
  //#endregion
67
- export { Connector, ConnectorEvents, ConnectorTransport, FetchLike, GithubAppError, GithubAppTransportOptions, POLL_OPEN_MS, POLL_RESOLVED_MS, RemoteComment, RemoteStatus, SlackConnectorOptions, SlackTransportOptions, createConnectorEvents, createGithubAppTransport, createSlackConnector, createSlackTransport, drainConnectorPolls, outboundCandidates, pkcs1ToPkcs8, toPkcs8Pem };
93
+ export { Connector, ConnectorEvents, ConnectorTransport, FetchLike, GithubAppError, GithubAppTransportOptions, GithubWebhookOptions, InstallationToken, POLL_OPEN_MS, POLL_RESOLVED_MS, RemoteComment, RemoteStatus, SlackConnectorOptions, SlackTransportOptions, createConnectorEvents, createGithubAppTransport, createSlackConnector, createSlackTransport, drainConnectorPolls, githubHeaders, handleGithubWebhook, mintInstallationToken, outboundCandidates, pkcs1ToPkcs8, signAppJwt, signatureValid, toPkcs8Pem };
@@ -1,3 +1,3 @@
1
- import { a as outboundCandidates, i as createConnectorEvents, n as POLL_RESOLVED_MS, r as drainConnectorPolls, t as POLL_OPEN_MS } from "../poll-BrcAuaAz.js";
2
- import { a as pkcs1ToPkcs8, i as createGithubAppTransport, n as createSlackTransport, o as toPkcs8Pem, r as GithubAppError, t as createSlackConnector } from "../slack-Dnq9bnXd.js";
3
- export { GithubAppError, POLL_OPEN_MS, POLL_RESOLVED_MS, createConnectorEvents, createGithubAppTransport, createSlackConnector, createSlackTransport, drainConnectorPolls, outboundCandidates, pkcs1ToPkcs8, toPkcs8Pem };
1
+ import { a as createConnectorEvents, n as POLL_RESOLVED_MS, o as outboundCandidates, r as drainConnectorPolls, t as POLL_OPEN_MS } from "../poll-ZSv3wN9C.js";
2
+ import { a as GithubAppError, c as mintInstallationToken, d as toPkcs8Pem, i as signatureValid, l as pkcs1ToPkcs8, n as createSlackTransport, o as createGithubAppTransport, r as handleGithubWebhook, s as githubHeaders, t as createSlackConnector, u as signAppJwt } from "../slack-C4P0AbuZ.js";
3
+ export { GithubAppError, POLL_OPEN_MS, POLL_RESOLVED_MS, createConnectorEvents, createGithubAppTransport, createSlackConnector, createSlackTransport, drainConnectorPolls, githubHeaders, handleGithubWebhook, mintInstallationToken, outboundCandidates, pkcs1ToPkcs8, signAppJwt, signatureValid, toPkcs8Pem };
@@ -1,5 +1,5 @@
1
- import { t as GetPin } from "../payload-CYbjb8ZB.js";
2
- import { n as DeliveryAdapter } from "../router-DOwWVak2.js";
1
+ import { t as GetPin } from "../payload-CmKx5yL2.js";
2
+ import { n as DeliveryAdapter } from "../router-NoiuUFb-.js";
3
3
  //#region src/delivery/openclaw.d.ts
4
4
  declare function createOpenclawAdapter(opts?: {
5
5
  command?: string[];
@@ -1,4 +1,4 @@
1
- import { n as resolveBinary, r as payloadForEvent, t as drainToExit } from "../proc-BMp_pbPS.js";
1
+ import { n as resolveBinary, r as payloadForEvent, t as drainToExit } from "../proc-CBLeAM7c.js";
2
2
  //#region src/delivery/openclaw.ts
3
3
  const PUSH_ARGS = [
4
4
  "system",
@@ -1,5 +1,5 @@
1
- import { t as GetPin } from "../payload-CYbjb8ZB.js";
2
- import { n as DeliveryAdapter } from "../router-DOwWVak2.js";
1
+ import { t as GetPin } from "../payload-CmKx5yL2.js";
2
+ import { n as DeliveryAdapter } from "../router-NoiuUFb-.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,4 +1,4 @@
1
- import { n as resolveBinary, r as payloadForEvent, t as drainToExit } from "../proc-BMp_pbPS.js";
1
+ import { n as resolveBinary, r as payloadForEvent, t as drainToExit } from "../proc-CBLeAM7c.js";
2
2
  //#region src/delivery/resume.ts
3
3
  const RESUME_COMMANDS = {
4
4
  claude: (key, prompt) => [
@@ -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-DOwWVak2.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-NoiuUFb-.js";
2
2
  export { DEFAULT_HOOKS_ESCALATE_MS, DeliveryAdapter, DeliveryRouter, HOOK_CAPABLE_AGENTS, buildInjectionContext, buildReplyPrompt, createHooksAdapter, hooksEscalateMs };
@@ -1,3 +1,3 @@
1
1
  import { n as buildReplyPrompt, t as buildInjectionContext } from "../context-BHcEpzVb.js";
2
- import { a as createHooksAdapter, i as HOOK_CAPABLE_AGENTS, n as DeliveryRouter, r as hooksEscalateMs, t as DEFAULT_HOOKS_ESCALATE_MS } from "../router-BH74psWn.js";
2
+ import { a as createHooksAdapter, i as HOOK_CAPABLE_AGENTS, n as DeliveryRouter, r as hooksEscalateMs, t as DEFAULT_HOOKS_ESCALATE_MS } from "../router-DrYLHCF4.js";
3
3
  export { DEFAULT_HOOKS_ESCALATE_MS, DeliveryRouter, HOOK_CAPABLE_AGENTS, buildInjectionContext, buildReplyPrompt, createHooksAdapter, hooksEscalateMs };
@@ -1,4 +1,4 @@
1
- import { n as DeliveryAdapter } from "../router-DOwWVak2.js";
1
+ import { n as DeliveryAdapter } from "../router-NoiuUFb-.js";
2
2
  //#region src/delivery/webhook.d.ts
3
3
  type WebhookConfig = {
4
4
  url: string;
package/dist/do.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as Link, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-BlM4lTLW.js";
2
- import { t as Connector } from "./types-BmfT_m1p.js";
3
- import { r as SessionStore } from "./sessions-BOrd8Yvv.js";
4
- import { a as LinkStore, c as PinStore, i as DeliveryStore, l as StoredEvent, t as CursorStore } from "./store-DAB5CEA1.js";
1
+ import { a as Link, g as ThreadMessage, m as SessionRef, r as Attachment, s as Pin, t as AppliedEdit } from "./schema-BLZ3MqMD.js";
2
+ import { t as Connector } from "./types-BIm_s4nu.js";
3
+ import { r as SessionStore } from "./sessions-Bd7_G5jW.js";
4
+ import { a as LinkStore, c as PinStore, i as DeliveryStore, l as StoredEvent, t as CursorStore } from "./store-QLtACKhW.js";
5
5
  import { Broadcaster } from "./ws.js";
6
6
  import { DurableObjectState, R2Bucket, WebSocket } from "@cloudflare/workers-types";
7
7
  //#region src/do-store.d.ts
@@ -40,6 +40,7 @@ type PinboxDoEnv = {
40
40
  GITHUB_INSTALLATION_ID?: string;
41
41
  GITHUB_REPO?: string;
42
42
  GITHUB_API_BASE?: string;
43
+ GITHUB_WEBHOOK_SECRET?: string;
43
44
  SLACK_BOT_TOKEN?: string;
44
45
  SLACK_CHANNEL?: string;
45
46
  MEDIA?: R2Bucket;
@@ -75,6 +76,11 @@ declare class PinboxHubDO {
75
76
  constructor(ctx: DurableObjectState, env: PinboxDoEnv);
76
77
  fetch(req: Request): Promise<Response>;
77
78
  private intercept;
79
+ /**
80
+ * GitHub cannot present our credential: the HMAC signature is this route's whole auth
81
+ * (github-webhook.ts), so it sits outside the bearer/JWT gate. Unconfigured ⇒ falls to 404.
82
+ */
83
+ private githubWebhook;
78
84
  webSocketMessage(ws: WebSocket, message: string | ArrayBuffer): void;
79
85
  webSocketClose(_ws: WebSocket, _code: number, _reason: string, _wasClean: boolean): void;
80
86
  /**
package/dist/do.js CHANGED
@@ -1,12 +1,12 @@
1
- import { AttachmentSchema, PinInputSchema, PinSchema, SessionRefSchema, ThreadMessageSchema } from "./schema.js";
1
+ import { a as PinSchema, c as SessionRefSchema, i as PinInputSchema, l as ThreadMessageSchema, n as AttachmentSchema } from "./schema-DDpii7iQ.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-IR3o5YwY.js";
4
- import { r as drainConnectorPolls } from "./poll-BrcAuaAz.js";
5
- import { n as createHubHandler, o as ok, r as err } from "./hub-I67BuX9S.js";
3
+ import { t as MIGRATIONS } from "./store-Daziyk0_.js";
4
+ import { r as drainConnectorPolls } from "./poll-ZSv3wN9C.js";
5
+ import { n as createHubHandler, o as ok, r as err } from "./hub-Ds7W5n89.js";
6
6
  import { ClientHelloSchema, WS_CLOSE_PROTOCOL, WS_CLOSE_UNAUTHORIZED, WS_TOKEN_SUBPROTOCOL_PREFIX, encodeWsEvent } from "./ws-protocol.js";
7
- import { n as DeliveryRouter } from "./router-BH74psWn.js";
7
+ import { n as DeliveryRouter } from "./router-DrYLHCF4.js";
8
8
  import { createWebhookAdapter } from "./delivery/webhook.js";
9
- import { i as createGithubAppTransport, n as createSlackTransport, t as createSlackConnector } from "./slack-Dnq9bnXd.js";
9
+ import { n as createSlackTransport, o as createGithubAppTransport, r as handleGithubWebhook, t as createSlackConnector } from "./slack-C4P0AbuZ.js";
10
10
  import { createGithubConnector } from "./connectors/github.js";
11
11
  import { i as verifyJwt, n as verifyNone, r as verifyToken } from "./verify-BDt9d9Np.js";
12
12
  //#region src/do-store-registries.ts
@@ -564,6 +564,8 @@ var DoBroadcaster = class {
564
564
  return this.state.getWebSockets(topic).length;
565
565
  }
566
566
  };
567
+ /** Hub-root path of the GitHub webhook receiver (`/_pinbox/webhooks/github` on the Worker). */
568
+ const WEBHOOK_PATH = "/webhooks/github";
567
569
  /** Retry cadence for the delivery queue. Coarse: the receiver being down is not urgent. */
568
570
  const DRAIN_INTERVAL_MS = 3e4;
569
571
  /** Later than any due_at this hub can write, so `due()` answers "anything pending?". */
@@ -653,11 +655,25 @@ var PinboxHubDO = class {
653
655
  return await this.intercept(req, url, verify) ?? this.handler(req);
654
656
  }
655
657
  async intercept(req, url, verify) {
658
+ if (req.method === "POST" && url.pathname === WEBHOOK_PATH) return this.githubWebhook(req);
656
659
  if (req.method === "POST" && url.pathname === "/attachments") return await this.unauthorized(verify, req) ?? this.createAttachment(req, url);
657
660
  const mediaKey = /^\/media\/([^/]+)$/.exec(url.pathname)?.[1];
658
661
  if (req.method === "GET" && mediaKey !== void 0) return await this.unauthorized(verify, req) ?? this.serveMedia(mediaKey);
659
662
  return null;
660
663
  }
664
+ /**
665
+ * GitHub cannot present our credential: the HMAC signature is this route's whole auth
666
+ * (github-webhook.ts), so it sits outside the bearer/JWT gate. Unconfigured ⇒ falls to 404.
667
+ */
668
+ githubWebhook(req) {
669
+ const secret = this.env.GITHUB_WEBHOOK_SECRET;
670
+ const repo = this.env.GITHUB_REPO;
671
+ if (secret === void 0 || secret === "" || repo === void 0 || repo === "") return null;
672
+ return handleGithubWebhook(req, this.store, {
673
+ secret,
674
+ repo
675
+ });
676
+ }
661
677
  webSocketMessage(ws, message) {
662
678
  if (typeof message !== "string") {
663
679
  this.protocolError(ws, "binary frames are not part of protocol 1");
@@ -1,6 +1,6 @@
1
- import { AppliedEditSchema, AttachmentSchema, PinInputSchema, SessionRefSchema } from "./schema.js";
1
+ import { c as SessionRefSchema, i as PinInputSchema, n as AttachmentSchema, t as AppliedEditSchema } from "./schema-DDpii7iQ.js";
2
2
  import { a as NotFoundError, i as ConflictError, o as newId } from "./sessions-DrCVTMfI.js";
3
- import { t as POLL_OPEN_MS } from "./poll-BrcAuaAz.js";
3
+ import { t as POLL_OPEN_MS } from "./poll-ZSv3wN9C.js";
4
4
  import { t as buildInjectionContext } from "./context-BHcEpzVb.js";
5
5
  import { z } from "zod";
6
6
  //#region src/routes-links.ts
@@ -1,5 +1,5 @@
1
- import { r as Attachment } from "./schema-BlM4lTLW.js";
2
- import { c as PinStore } from "./store-DAB5CEA1.js";
1
+ import { r as Attachment } from "./schema-BLZ3MqMD.js";
2
+ import { c as PinStore } from "./store-QLtACKhW.js";
3
3
  import { HubOptions } from "./hub.js";
4
4
  //#region src/attachments.d.ts
5
5
  interface AttachmentSink {
@@ -1,4 +1,4 @@
1
- import { c as registerAttachmentSink, n as createHubHandler } from "./hub-I67BuX9S.js";
1
+ import { c as registerAttachmentSink, n as createHubHandler } from "./hub-Ds7W5n89.js";
2
2
  import { ClientHelloSchema, WS_CLOSE_PROTOCOL, WS_CLOSE_UNAUTHORIZED, WS_TOKEN_SUBPROTOCOL_PREFIX, encodeWsEvent } from "./ws-protocol.js";
3
3
  //#region src/attachments-local.ts
4
4
  const EXTENSIONS = {
package/dist/hub.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Connector } from "./types-BmfT_m1p.js";
2
- import { c as PinStore } from "./store-DAB5CEA1.js";
1
+ import { t as Connector } from "./types-BIm_s4nu.js";
2
+ import { c as PinStore } from "./store-QLtACKhW.js";
3
3
  //#region src/hub.d.ts
4
4
  type Identity = {
5
5
  userId: string;
@@ -26,6 +26,20 @@ declare function mustGetPin(store: PinStore, id: string): {
26
26
  text: string;
27
27
  kind: "comment" | "move" | "note";
28
28
  target?: {
29
+ model?: {
30
+ modelId: string;
31
+ revision: string;
32
+ partId: string;
33
+ position: [number, number, number];
34
+ normal?: [number, number, number] | undefined;
35
+ units: "cm" | "in" | "m" | "mm";
36
+ faceIndex?: number | undefined;
37
+ camera?: {
38
+ position: [number, number, number];
39
+ target: [number, number, number];
40
+ up: [number, number, number];
41
+ } | undefined;
42
+ } | undefined;
29
43
  url?: string | undefined;
30
44
  selector?: string | undefined;
31
45
  tag?: string | undefined;
@@ -55,6 +69,20 @@ declare function mustGetPin(store: PinStore, id: string): {
55
69
  textRuns?: string[] | undefined;
56
70
  } | undefined;
57
71
  targets?: {
72
+ model?: {
73
+ modelId: string;
74
+ revision: string;
75
+ partId: string;
76
+ position: [number, number, number];
77
+ normal?: [number, number, number] | undefined;
78
+ units: "cm" | "in" | "m" | "mm";
79
+ faceIndex?: number | undefined;
80
+ camera?: {
81
+ position: [number, number, number];
82
+ target: [number, number, number];
83
+ up: [number, number, number];
84
+ } | undefined;
85
+ } | undefined;
58
86
  url?: string | undefined;
59
87
  selector?: string | undefined;
60
88
  tag?: string | undefined;
package/dist/hub.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as mustGetPin, i as match, n as createHubHandler, o as ok, r as err, s as readJson, t as BodyNotJsonError } from "./hub-I67BuX9S.js";
1
+ import { a as mustGetPin, i as match, n as createHubHandler, o as ok, r as err, s as readJson, t as BodyNotJsonError } from "./hub-Ds7W5n89.js";
2
2
  export { BodyNotJsonError, createHubHandler, err, match, mustGetPin, ok, readJson };
@@ -1,4 +1,4 @@
1
- import { s as Pin } from "./schema-BlM4lTLW.js";
1
+ import { s as Pin } from "./schema-BLZ3MqMD.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
@@ -29,6 +29,8 @@ function standardFacts(pin) {
29
29
  const target = pin.target;
30
30
  const lines = [];
31
31
  if (target?.url !== void 0) lines.push(` - url: ${target.url}`);
32
+ const model = target?.model;
33
+ if (model) lines.push(` - model: ${model.modelId} @ ${model.revision}; part: ${model.partId}; local point: ${model.position.join(", ")} ${model.units}`);
32
34
  const source = sourceRef(pin);
33
35
  if (source !== void 0) lines.push(` - source: ${source}`);
34
36
  const rect = target?.rect;
@@ -44,6 +46,7 @@ function standardFacts(pin) {
44
46
  */
45
47
  function forensicBlock(pin) {
46
48
  const forensic = {};
49
+ if (pin.target?.model) forensic["model"] = pin.target.model;
47
50
  if (pin.target?.context) forensic["context"] = pin.target.context;
48
51
  if (pin.env && Object.keys(pin.env).length > 0) forensic["env"] = pin.env;
49
52
  if (Object.keys(forensic).length === 0) return [];
@@ -62,6 +65,8 @@ function forensicBlock(pin) {
62
65
  * a pin the same way.
63
66
  */
64
67
  function pinLocus(pin) {
68
+ const model = pin.target?.model;
69
+ if (model) return `${model.modelId}/${model.partId} @ ${model.revision}`;
65
70
  return pin.target?.selector ?? sourceRef(pin) ?? pin.target?.url;
66
71
  }
67
72
  function sourceRef(pin) {
@@ -0,0 +1,6 @@
1
+ import { s as Pin } from "./schema-BLZ3MqMD.js";
2
+ import "./store-QLtACKhW.js";
3
+ //#region src/delivery/payload.d.ts
4
+ type GetPin = (id: string) => Pin | null;
5
+ //#endregion
6
+ export { GetPin as t };
@@ -249,4 +249,4 @@ function advances(next, current) {
249
249
  return current === null || next > current;
250
250
  }
251
251
  //#endregion
252
- export { outboundCandidates as a, createConnectorEvents as i, POLL_RESOLVED_MS as n, drainConnectorPolls as r, POLL_OPEN_MS as t };
252
+ export { createConnectorEvents as a, inboundEvents as i, POLL_RESOLVED_MS as n, outboundCandidates as o, drainConnectorPolls as r, POLL_OPEN_MS as t };
@@ -1,4 +1,4 @@
1
- import { PinSchema, ThreadMessageSchema } from "./schema.js";
1
+ import { a as PinSchema, l as ThreadMessageSchema } from "./schema-DDpii7iQ.js";
2
2
  import { n as buildReplyPrompt, t as buildInjectionContext } from "./context-BHcEpzVb.js";
3
3
  //#region src/delivery/payload.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { PinSchema, ThreadMessageSchema } from "./schema.js";
1
+ import { a as PinSchema, l as ThreadMessageSchema } from "./schema-DDpii7iQ.js";
2
2
  //#region src/delivery/hooks.ts
3
3
  /** Agents whose hook systems can register + pull (research §1: shared hooks schema). */
4
4
  const HOOK_CAPABLE_AGENTS = /* @__PURE__ */ new Set([
@@ -1,6 +1,6 @@
1
- import { g as ThreadMessage, s as Pin } from "./schema-BlM4lTLW.js";
2
- import { t as Session } from "./sessions-BOrd8Yvv.js";
3
- import { c as PinStore, l as StoredEvent } from "./store-DAB5CEA1.js";
1
+ import { g as ThreadMessage, s as Pin } from "./schema-BLZ3MqMD.js";
2
+ import { t as Session } from "./sessions-Bd7_G5jW.js";
3
+ import { c as PinStore, l as StoredEvent } from "./store-QLtACKhW.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,
@@ -1,4 +1,28 @@
1
1
  import { z } from "zod";
2
+ //#region src/model-anchor.d.ts
3
+ /** A point in a named part's LOCAL coordinates, pinned to an immutable model revision.
4
+ * No implicit reprojection across edits: hosts must explicitly migrate stale anchors. */
5
+ declare const ModelAnchorSchema: z.ZodObject<{
6
+ modelId: z.ZodString;
7
+ revision: z.ZodString;
8
+ partId: z.ZodString;
9
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
10
+ normal: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
11
+ units: z.ZodEnum<{
12
+ cm: "cm";
13
+ in: "in";
14
+ m: "m";
15
+ mm: "mm";
16
+ }>;
17
+ faceIndex: z.ZodOptional<z.ZodNumber>;
18
+ camera: z.ZodOptional<z.ZodObject<{
19
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
20
+ target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
21
+ up: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
22
+ }, z.core.$strip>>;
23
+ }, z.core.$strict>;
24
+ type ModelAnchor = z.infer<typeof ModelAnchorSchema>;
25
+ //#endregion
2
26
  //#region src/schema.d.ts
3
27
  declare const SCHEMA_VERSION = 1;
4
28
  declare const RectSchema: z.ZodType<{
@@ -80,6 +104,25 @@ declare const PinInputSchema: z.ZodObject<{
80
104
  note: "note";
81
105
  }>>;
82
106
  target: z.ZodOptional<z.ZodObject<{
107
+ model: z.ZodOptional<z.ZodObject<{
108
+ modelId: z.ZodString;
109
+ revision: z.ZodString;
110
+ partId: z.ZodString;
111
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
112
+ normal: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
113
+ units: z.ZodEnum<{
114
+ cm: "cm";
115
+ in: "in";
116
+ m: "m";
117
+ mm: "mm";
118
+ }>;
119
+ faceIndex: z.ZodOptional<z.ZodNumber>;
120
+ camera: z.ZodOptional<z.ZodObject<{
121
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
122
+ target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
123
+ up: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strict>>;
83
126
  url: z.ZodOptional<z.ZodString>;
84
127
  selector: z.ZodOptional<z.ZodString>;
85
128
  tag: z.ZodOptional<z.ZodString>;
@@ -118,6 +161,25 @@ declare const PinInputSchema: z.ZodObject<{
118
161
  textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
162
  }, z.core.$strip>>;
120
163
  targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
164
+ model: z.ZodOptional<z.ZodObject<{
165
+ modelId: z.ZodString;
166
+ revision: z.ZodString;
167
+ partId: z.ZodString;
168
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
169
+ normal: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
170
+ units: z.ZodEnum<{
171
+ cm: "cm";
172
+ in: "in";
173
+ m: "m";
174
+ mm: "mm";
175
+ }>;
176
+ faceIndex: z.ZodOptional<z.ZodNumber>;
177
+ camera: z.ZodOptional<z.ZodObject<{
178
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
179
+ target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
180
+ up: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
181
+ }, z.core.$strip>>;
182
+ }, z.core.$strict>>;
121
183
  url: z.ZodOptional<z.ZodString>;
122
184
  selector: z.ZodOptional<z.ZodString>;
123
185
  tag: z.ZodOptional<z.ZodString>;
@@ -227,6 +289,25 @@ declare const PinSchema: z.ZodObject<{
227
289
  note: "note";
228
290
  }>>;
229
291
  target: z.ZodOptional<z.ZodObject<{
292
+ model: z.ZodOptional<z.ZodObject<{
293
+ modelId: z.ZodString;
294
+ revision: z.ZodString;
295
+ partId: z.ZodString;
296
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
297
+ normal: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
298
+ units: z.ZodEnum<{
299
+ cm: "cm";
300
+ in: "in";
301
+ m: "m";
302
+ mm: "mm";
303
+ }>;
304
+ faceIndex: z.ZodOptional<z.ZodNumber>;
305
+ camera: z.ZodOptional<z.ZodObject<{
306
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
307
+ target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
308
+ up: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
309
+ }, z.core.$strip>>;
310
+ }, z.core.$strict>>;
230
311
  url: z.ZodOptional<z.ZodString>;
231
312
  selector: z.ZodOptional<z.ZodString>;
232
313
  tag: z.ZodOptional<z.ZodString>;
@@ -265,6 +346,25 @@ declare const PinSchema: z.ZodObject<{
265
346
  textRuns: z.ZodOptional<z.ZodArray<z.ZodString>>;
266
347
  }, z.core.$strip>>;
267
348
  targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
349
+ model: z.ZodOptional<z.ZodObject<{
350
+ modelId: z.ZodString;
351
+ revision: z.ZodString;
352
+ partId: z.ZodString;
353
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
354
+ normal: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
355
+ units: z.ZodEnum<{
356
+ cm: "cm";
357
+ in: "in";
358
+ m: "m";
359
+ mm: "mm";
360
+ }>;
361
+ faceIndex: z.ZodOptional<z.ZodNumber>;
362
+ camera: z.ZodOptional<z.ZodObject<{
363
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
364
+ target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
365
+ up: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
366
+ }, z.core.$strip>>;
367
+ }, z.core.$strict>>;
268
368
  url: z.ZodOptional<z.ZodString>;
269
369
  selector: z.ZodOptional<z.ZodString>;
270
370
  tag: z.ZodOptional<z.ZodString>;
@@ -405,4 +505,4 @@ type Attachment = z.infer<typeof AttachmentSchema>;
405
505
  type Link = z.infer<typeof LinkSchema>;
406
506
  declare function pinJsonSchema(): Record<string, unknown>;
407
507
  //#endregion
408
- export { ThreadMessageSchema as _, Link as a, PinInput as c, Rect as d, RectSchema as f, ThreadMessage as g, SessionRefSchema as h, AttachmentSchema as i, PinInputSchema as l, SessionRef as m, AppliedEditSchema as n, LinkSchema as o, SCHEMA_VERSION as p, Attachment as r, Pin as s, AppliedEdit as t, PinSchema as u, pinJsonSchema as v };
508
+ export { ThreadMessageSchema as _, Link as a, ModelAnchorSchema as b, PinInput as c, Rect as d, RectSchema as f, ThreadMessage as g, SessionRefSchema as h, AttachmentSchema as i, PinInputSchema as l, SessionRef as m, AppliedEditSchema as n, LinkSchema as o, SCHEMA_VERSION as p, Attachment as r, Pin as s, AppliedEdit as t, PinSchema as u, pinJsonSchema as v, ModelAnchor as y };