@allyhub/sdk 0.10.0 → 0.12.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 (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  3. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  4. package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +7 -0
  5. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  6. package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +20 -0
  7. package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
  8. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  9. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  10. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  11. package/dist/node_modules/@allyhub/image-sdk/dist/index.d.ts +1 -1
  12. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  13. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  14. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  15. package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +2 -0
  16. package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -1
  17. package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
  18. package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +14 -1
  19. package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
  20. package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +12 -0
  21. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  22. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +22 -5
  23. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  24. package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +56 -0
  25. package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
  26. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +57 -9
  27. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  28. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +6 -0
  29. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  30. package/dist/node_modules/@allyhub/protocol/dist/errors.d.ts +7 -0
  31. package/dist/node_modules/@allyhub/protocol/dist/errors.js +2 -0
  32. package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +328 -0
  33. package/dist/node_modules/@allyhub/protocol/dist/events.js +2 -0
  34. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +61 -1
  35. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  36. package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +2 -1
  37. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  38. package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +2 -2
  39. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +41 -3
  40. package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
  41. package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
  42. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +21 -4
  43. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +7 -0
  45. package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
  46. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +12 -0
  47. package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
  48. package/dist/node_modules/@allyhub/protocol/package.json +1 -5
  49. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  50. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  51. package/dist/node_modules/@allyhub/sheet/dist/export.d.ts +0 -8
  52. package/dist/node_modules/@allyhub/sheet/dist/export.js +2 -4
  53. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +1 -1
  54. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  55. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  56. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  57. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  58. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  59. package/docs/README.md +2 -0
  60. package/docs/defaults.md +10 -2
  61. package/docs/docs.md +4 -4
  62. package/docs/image.md +3 -3
  63. package/docs/linkedin.md +96 -0
  64. package/docs/reports.md +89 -0
  65. package/docs/sheets.md +1 -1
  66. package/docs/x.md +1 -1
  67. package/package.json +1 -1
  68. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +0 -337
  69. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +0 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  Feature highlights from each AllyHub release.
4
4
 
5
+ ## 0.12.0
6
+
7
+ - **AllyHub learns what is used and what fails.** The CLI and Studio tell AllyHub which commands run, how long agents take and the errors they meet, never what you make or say. Studio's Settings or `ALLYHUB_TELEMETRY=off` turns it off; the list of what is told is public.
8
+ - **Credits are simpler.** Every plan gives 100 credits a dollar, and a new account starts with 100.
9
+ - **A call is checked against your credits before it runs**, so it never ends unpaid halfway; while your other calls are still running, it waits a moment instead.
10
+ - **Files kept up to a cap.** 1 GiB without a plan, 100 GiB with one; an upload or a tool's result is let go 7 days after it was last used.
11
+ - **A cloud Studio pauses when its idle time is up**, and is paid for no longer than that.
12
+
13
+ ## 0.11.0
14
+
15
+ - **Reports.** A page written freely in HTML, CSS and JavaScript, read on a screen and sent as a link; rendered as one self-contained HTML file, a PDF or one long PNG, with report styles to start from (`allyhub report style`).
16
+ - **LinkedIn posts, carousels and articles**, written beside LinkedIn's look and checked against its limits; a post shows where LinkedIn folds it at "… more", and an article copies as LinkedIn's editor takes it.
17
+ - **Exports go to your Downloads.** An export from an editor lands in one folder, Downloads unless you choose another (`allyhub dev --exports`), and never overwrites a file there.
18
+ - **Mark up a thing by picking it.** Select marks what is under the pointer, and Mark up from a selection starts with it marked, so the agent is told exactly what you mean.
19
+ - **Present a deck on two screens as in PowerPoint**, each full screen, with Swap and Duplicate Slide Show.
20
+
5
21
  ## 0.10.0
6
22
 
7
23
  - **Word, Excel and PowerPoint files that hold up in Office.** A deck's file holds what its preview shows; a workbook keeps iterative calculation, data tables and combination charts; a chart over dates shows dates.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/audio",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/chart",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -26,6 +26,13 @@ export interface Problem {
26
26
  selector?: string;
27
27
  bbox?: Box;
28
28
  };
29
+ /**
30
+ * A fact of the page that drew it (its browser), not of the piece: where
31
+ * that page renders (frames, check, an export) it is the export's; where
32
+ * it is an editor's preview, the export is not affected, so it is not a
33
+ * problem of the version (allykit#502).
34
+ */
35
+ ofPage?: true;
29
36
  }
30
37
  /** A code no rule this process knows has: a mistake in the code that reports it, or in its extension's manifest. */
31
38
  export declare class UnknownRuleError extends Error {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/diagnostics",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -36,4 +36,24 @@ export declare function touches(shape: NoteShape, box: NoteBox): boolean;
36
36
  export declare function pointsOf(shape: NoteShape): NotePoint[];
37
37
  /** A shape moved into another frame, as a stage's own. */
38
38
  export declare function mapShape(shape: NoteShape, map: (p: NotePoint) => NotePoint): NoteShape;
39
+ /**
40
+ * An element's edge as it is drawn, for a person who picks it rather than
41
+ * drawing round it (docs/design/notes.md, "Select"): closed outlines, each a
42
+ * ring of points in the surface's pixels. A box is one ring of four, a box
43
+ * turned its four corners turned, words a ring a line, a round shape its
44
+ * edge in steps.
45
+ */
46
+ export type NoteOutline = NotePoint[][];
47
+ /** A box's outline. */
48
+ export declare function rectOutline(box: NoteBox): NoteOutline;
49
+ /** A box turned about its middle, degrees clockwise: its four corners where they are drawn. */
50
+ export declare function turnedOutline(box: NoteBox, degrees: number): NoteOutline;
51
+ /** The round in a box: its edge in steps. */
52
+ export declare function roundOutline(box: NoteBox): NoteOutline;
53
+ /** An outline moved into another frame. */
54
+ export declare function mapOutline(outline: readonly (readonly NotePoint[])[], map: (p: NotePoint) => NotePoint): NoteOutline;
55
+ /** The box round an outline. */
56
+ export declare function outlineBox(outline: readonly (readonly NotePoint[])[]): NoteBox;
57
+ /** Whether a point is inside an outline: inside one of its rings (the even-odd rule a ring). */
58
+ export declare function insideOutline(outline: readonly (readonly NotePoint[])[], p: NotePoint): boolean;
39
59
  //# sourceMappingURL=note-shape.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- const T=6,P=.85,I=.25,O=40,S=12,x=(t,n,r)=>Math.min(r,Math.max(n,t));function f(t){const n=t.map(e=>e.x),r=t.map(e=>e.y),c=Math.min(...n),o=Math.min(...r);return{x:c,y:o,width:Math.max(...n)-c,height:Math.max(...r)-o}}function l(t){const[n]=t,r=t.at(-1);if(!n||!r)return!1;const{width:c,height:o}=f(t),e=Math.hypot(c,o);return e>0&&Math.hypot(r.x-n.x,r.y-n.y)<=e*.25}const m=(t,n)=>t.x<n.x+Math.max(n.width,1)&&t.x+Math.max(t.width,1)>n.x&&t.y<n.y+Math.max(n.height,1)&&t.y+Math.max(t.height,1)>n.y;function M(t,n){const r=t.width/2||1,c=t.height/2||1,o=t.x+r,e=t.y+c,i=(x(o,n.x,n.x+n.width)-o)/r,s=(x(e,n.y,n.y+n.height)-e)/c;return Math.hypot(i,s)<=.85}function w(t,n,r){const c=n.x-t.x,o=n.y-t.y;let e=0,i=1;for(const[s,h]of[[-c,t.x-r.x],[c,r.x+r.width-t.x],[-o,t.y-r.y],[o,r.y+r.height-t.y]]){if(s===0){if(h<0)return!1}else s<0?e=Math.max(e,h/s):i=Math.min(i,h/s);if(e>i)return!1}return!0}export function touches(t,n){switch(t.kind){case"box":return m(t.rect,n);case"round":return M(t.rect,n);case"arrow":return m({x:t.to.x-6,y:t.to.y-6,width:12,height:12},n);case"line":return l(t.points)?M(f(t.points),n):t.points.some((r,c)=>w(t.points[c-1]??r,r,n))}}function d(t,n){return n.flatMap(r=>n.map(c=>({x:t.x+t.width*c,y:t.y+t.height*r})))}function g(t){const n=t.map((o,e)=>{const i=t[e-1]??o;return Math.hypot(o.x-i.x,o.y-i.y)}),r=n.reduce((o,e)=>o+e,0),c=x(Math.ceil(r/40)+1,2,12);return Array.from({length:c},(o,e)=>{let i=r*e/(c-1);for(const[s,h]of t.entries()){const u=n[s]??0,y=t[s-1];if(y&&i<=u){const a=u===0?0:i/u;return{x:y.x+(h.x-y.x)*a,y:y.y+(h.y-y.y)*a}}i-=u}return t.at(-1)??{x:0,y:0}})}export function pointsOf(t){switch(t.kind){case"box":return d(t.rect,[.5,.2,.8]);case"round":return d(t.rect,[.5,.3,.7]);case"arrow":return[t.to];case"line":return l(t.points)?d(f(t.points),[.5,.3,.7]):g(t.points)}}export function mapShape(t,n){switch(t.kind){case"box":case"round":{const r=n(t.rect),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height});return{kind:t.kind,rect:{...r,width:c.x-r.x,height:c.y-r.y}}}case"arrow":return{kind:"arrow",from:n(t.from),to:n(t.to)};case"line":return{kind:"line",points:t.points.map(n)}}}
2
+ const O=6,P=.85,I=.25,S=40,k=12,x=(t,n,r)=>Math.min(r,Math.max(n,t));function f(t){const n=t.map(e=>e.x),r=t.map(e=>e.y),c=Math.min(...n),i=Math.min(...r);return{x:c,y:i,width:Math.max(...n)-c,height:Math.max(...r)-i}}function d(t){const[n]=t,r=t.at(-1);if(!n||!r)return!1;const{width:c,height:i}=f(t),e=Math.hypot(c,i);return e>0&&Math.hypot(r.x-n.x,r.y-n.y)<=e*.25}const m=(t,n)=>t.x<n.x+Math.max(n.width,1)&&t.x+Math.max(t.width,1)>n.x&&t.y<n.y+Math.max(n.height,1)&&t.y+Math.max(t.height,1)>n.y;function M(t,n){const r=t.width/2||1,c=t.height/2||1,i=t.x+r,e=t.y+c,o=(x(i,n.x,n.x+n.width)-i)/r,s=(x(e,n.y,n.y+n.height)-e)/c;return Math.hypot(o,s)<=.85}function g(t,n,r){const c=n.x-t.x,i=n.y-t.y;let e=0,o=1;for(const[s,y]of[[-c,t.x-r.x],[c,r.x+r.width-t.x],[-i,t.y-r.y],[i,r.y+r.height-t.y]]){if(s===0){if(y<0)return!1}else s<0?e=Math.max(e,y/s):o=Math.min(o,y/s);if(e>o)return!1}return!0}export function touches(t,n){switch(t.kind){case"box":return m(t.rect,n);case"round":return M(t.rect,n);case"arrow":return m({x:t.to.x-6,y:t.to.y-6,width:12,height:12},n);case"line":return d(t.points)?M(f(t.points),n):t.points.some((r,c)=>g(t.points[c-1]??r,r,n))}}function a(t,n){return n.flatMap(r=>n.map(c=>({x:t.x+t.width*c,y:t.y+t.height*r})))}function T(t){const n=t.map((i,e)=>{const o=t[e-1]??i;return Math.hypot(i.x-o.x,i.y-o.y)}),r=n.reduce((i,e)=>i+e,0),c=x(Math.ceil(r/40)+1,2,12);return Array.from({length:c},(i,e)=>{let o=r*e/(c-1);for(const[s,y]of t.entries()){const h=n[s]??0,u=t[s-1];if(u&&o<=h){const l=h===0?0:o/h;return{x:u.x+(y.x-u.x)*l,y:u.y+(y.y-u.y)*l}}o-=h}return t.at(-1)??{x:0,y:0}})}export function pointsOf(t){switch(t.kind){case"box":return a(t.rect,[.5,.2,.8]);case"round":return a(t.rect,[.5,.3,.7]);case"arrow":return[t.to];case"line":return d(t.points)?a(f(t.points),[.5,.3,.7]):T(t.points)}}export function mapShape(t,n){switch(t.kind){case"box":case"round":{const r=n(t.rect),c=n({x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height});return{kind:t.kind,rect:{...r,width:c.x-r.x,height:c.y-r.y}}}case"arrow":return{kind:"arrow",from:n(t.from),to:n(t.to)};case"line":return{kind:"line",points:t.points.map(n)}}}export function rectOutline(t){return[[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}]]}export function turnedOutline(t,n){if(n%360===0)return rectOutline(t);const r=n*Math.PI/180,c=Math.cos(r),i=Math.sin(r),e=t.x+t.width/2,o=t.y+t.height/2;return rectOutline(t).map(s=>s.map(y=>({x:e+(y.x-e)*c-(y.y-o)*i,y:o+(y.x-e)*i+(y.y-o)*c})))}const w=48;export function roundOutline(t){const n=t.width/2,r=t.height/2;return[Array.from({length:w},(c,i)=>{const e=2*Math.PI*i/w;return{x:t.x+n+n*Math.cos(e),y:t.y+r+r*Math.sin(e)}})]}export function mapOutline(t,n){return t.map(r=>r.map(n))}export function outlineBox(t){return f(t.flat())}export function insideOutline(t,n){return t.some(r=>{let c=!1;for(let i=0,e=r.length-1;i<r.length;e=i++){const o=r[i],s=r[e];!o||!s||o.y>n.y!=s.y>n.y&&n.x<(s.x-o.x)*(n.y-o.y)/(s.y-o.y)+o.x&&(c=!c)}return c})}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/formats",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-draw",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./*": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-measure",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./*": {
@@ -123,7 +123,7 @@ export interface ImageOptions {
123
123
  * no words of its own.
124
124
  */
125
125
  script?: string;
126
- /** Its boards have no background: their files keep the alpha channel (PNG, WebP, AVIF). */
126
+ /** Its boards have no background: their files keep the alpha channel (PNG, WebP). */
127
127
  transparent?: boolean;
128
128
  /** Its boards, in order. */
129
129
  boards(ctx: ImageContext): Board[] | Promise<Board[]>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/image-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/measure",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/ooxml",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -110,6 +110,8 @@ export interface StageContext {
110
110
  code: string;
111
111
  message: string;
112
112
  level?: "error" | "warn";
113
+ /** A fact of the page drawing it (its browser), not of the piece (`Problem.ofPage`). */
114
+ ofPage?: true;
113
115
  }): void;
114
116
  /**
115
117
  * The caption cues shown in this part, on its own clock (seconds from
@@ -1,3 +1,3 @@
1
1
  export { consoleAt, consoleAtAsync, consoleLog, consoleParts, installConsole, resetConsole, } from "./console.js";
2
- export { locateLayers } from "./locate.js";
2
+ export { locateLayers, pickLayer } from "./locate.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export{consoleAt,consoleAtAsync,consoleLog,consoleParts,installConsole,resetConsole}from"./console.js";export{locateLayers}from"./locate.js";
2
+ export{consoleAt,consoleAtAsync,consoleLog,consoleParts,installConsole,resetConsole}from"./console.js";export{locateLayers,pickLayer}from"./locate.js";
@@ -1,4 +1,17 @@
1
1
  import { type NoteShape } from "@allyhub/formats";
2
- import type { LocatedLayer } from "../stage.js";
2
+ import type { LocatedLayer, PickedLayer } from "../stage.js";
3
3
  export declare function locateLayers(root: ParentNode, mark: NoteShape): LocatedLayer[];
4
+ /**
5
+ * The one thing in front at a point of the stage (px of its window), as a
6
+ * browser's inspector finds the element under the pointer: the first
7
+ * element there, front to back, that shows and draws something of its own,
8
+ * in a layer or a footage. A piece of a run of words (a letter or a word
9
+ * in its own span, for its motion) is its run. Its edge is a box with room
10
+ * round it (`edgeOf`): the element's own, turned with it, where it paints
11
+ * one or is a picture; else the box round its words.
12
+ */
13
+ export declare function pickLayer(doc: Document, at: {
14
+ x: number;
15
+ y: number;
16
+ }): PickedLayer | undefined;
4
17
  //# sourceMappingURL=locate.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{touches as T}from"@allyhub/formats";import{LAYER_NAME as C}from"../layer.js";const A=3,E=120,m=e=>e.width*e.height;function S(e){if(e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGElement||d(e)!=="")return!0;const o=getComputedStyle(e);return o.backgroundColor!=="transparent"&&!/^rgba\(.*,\s*0\)$/u.test(o.backgroundColor)||o.backgroundImage!=="none"||parseFloat(o.borderTopWidth)+parseFloat(o.borderRightWidth)+parseFloat(o.borderBottomWidth)+parseFloat(o.borderLeftWidth)>0}const b=e=>e.closest("[data-ak-piece]")?.dataset.akPiece;function d(e){return[...e.childNodes].filter(o=>o.nodeType===Node.TEXT_NODE).map(o=>o.textContent).join("").trim()}export function locateLayers(e,o){const c=t=>t.width>0&&t.height>0&&T(o,t),u=[],l=[];for(const t of e.querySelectorAll(".ak-layer")){if(!t.checkVisibility({opacityProperty:!0,visibilityProperty:!0})||!c(t.getBoundingClientRect())||![t,...t.querySelectorAll("*")].filter(i=>c(i.getBoundingClientRect())).some(S))continue;const r=t.getAttribute(C)??void 0,a=b(t),p={part:t.closest(".ak-part")?.dataset.key??"",layer:t.dataset.component??"",...r===void 0||r===""?{}:{key:r},...a===void 0?{}:{piece:a}};let n;for(const i of[t,...t.querySelectorAll("*")]){const h=i.getBoundingClientRect();!c(h)||d(i)===""&&!i.hasAttribute("data-ak")||(!n||m(h)<m(n.getBoundingClientRect()))&&(n=i)}if(!n){l.push(p);continue}const g=n.closest("[data-ak]")?.getAttribute("data-ak"),y=d(n).slice(0,E);u.push({...p,...g?{name:g}:{},...y===""?{}:{text:y}})}const f=[];for(const t of e.querySelectorAll(".ak-footage")){const s=t.dataset.akFile,r=(t.querySelector("video")??t).checkVisibility({opacityProperty:!0,visibilityProperty:!0});if(s===void 0||!r||!c(t.getBoundingClientRect()))continue;const a=b(t);f.push({part:t.dataset.akPart??"",layer:"footage",file:s,...a===void 0?{}:{piece:a}})}return[...u,...f,...l].slice(0,A)}
2
+ import{touches as $}from"@allyhub/formats";import{LAYER_NAME as C}from"../layer.js";const A=3,E=120,T=t=>t.width*t.height;function S(t){if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGElement||k(t)!=="")return!0;const e=getComputedStyle(t);return e.backgroundColor!=="transparent"&&!/^rgba\(.*,\s*0\)$/u.test(e.backgroundColor)||e.backgroundImage!=="none"||parseFloat(e.borderTopWidth)+parseFloat(e.borderRightWidth)+parseFloat(e.borderBottomWidth)+parseFloat(e.borderLeftWidth)>0}const m=t=>t.closest("[data-ak-piece]")?.dataset.akPiece;function k(t){return[...t.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}export function locateLayers(t,e){const r=i=>i.width>0&&i.height>0&&$(e,i),d=[],s=[];for(const i of t.querySelectorAll(".ak-layer")){if(!i.checkVisibility({opacityProperty:!0,visibilityProperty:!0})||!r(i.getBoundingClientRect())||![i,...i.querySelectorAll("*")].filter(f=>r(f.getBoundingClientRect())).some(S))continue;const c=i.getAttribute(C)??void 0,a=m(i),l={part:i.closest(".ak-part")?.dataset.key??"",layer:i.dataset.component??"",...c===void 0||c===""?{}:{key:c},...a===void 0?{}:{piece:a}};let y;for(const f of[i,...i.querySelectorAll("*")]){const p=f.getBoundingClientRect();!r(p)||k(f)===""&&!f.hasAttribute("data-ak")||(!y||T(p)<T(y.getBoundingClientRect()))&&(y=f)}if(!y){s.push(l);continue}const x=y.closest("[data-ak]")?.getAttribute("data-ak"),h=k(y).slice(0,E);d.push({...l,...x?{name:x}:{},...h===""?{}:{text:h}})}const o=[];for(const i of t.querySelectorAll(".ak-footage")){const u=i.dataset.akFile,c=(i.querySelector("video")??i).checkVisibility({opacityProperty:!0,visibilityProperty:!0});if(u===void 0||!c||!r(i.getBoundingClientRect()))continue;const a=m(i);o.push({part:i.dataset.akPart??"",layer:"footage",file:u,...a===void 0?{}:{piece:a}})}return[...d,...o,...s].slice(0,A)}const v=t=>t.checkVisibility({opacityProperty:!0,visibilityProperty:!0});function M(t){if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGElement)return!0;const e=getComputedStyle(t);return e.backgroundColor!=="transparent"&&!/^rgba\(.*,\s*0\)$/u.test(e.backgroundColor)||e.backgroundImage!=="none"||parseFloat(e.borderTopWidth)+parseFloat(e.borderRightWidth)+parseFloat(e.borderBottomWidth)+parseFloat(e.borderLeftWidth)>0}const R={px:2,share:.02};function L(t){if(!(t instanceof HTMLElement)||!t.parentElement)return;const e=t.getBoundingClientRect(),r=getComputedStyle(t),d=t.ownerDocument,s=d.createElement("div");s.style.cssText=["position:absolute","margin:0","padding:0","border:0","box-sizing:border-box","visibility:hidden","pointer-events:none",`left:${String(t.offsetLeft)}px`,`top:${String(t.offsetTop)}px`,`width:${String(t.offsetWidth)}px`,`height:${String(t.offsetHeight)}px`,`transform:${r.transform}`,`transform-origin:${r.transformOrigin}`,`rotate:${r.rotate}`,`scale:${r.scale}`,`translate:${r.translate}`].join(";");const o=(f,p)=>{const g=d.createElement("div");return g.style.cssText=`position:absolute;width:0;height:0;left:${f};top:${p}`,s.append(g),g},i=[o("0","0"),o("100%","0"),o("0","100%")];t.after(s);let u;try{u=i.map(f=>{const p=f.getBoundingClientRect();return{x:p.x,y:p.y}})}finally{s.remove()}const[n,c,a]=u;if(!n||!c||!a)return;const l={x:c.x+a.x-n.x,y:c.y+a.y-n.y},y=[n.x,c.x,a.x,l.x],x=[n.y,c.y,a.y,l.y],h=(f,p,g)=>Math.abs(f-p)>Math.max(R.px,g*R.share);if(!(h(Math.min(...y),e.left,e.width)||h(Math.max(...y),e.right,e.width)||h(Math.min(...x),e.top,e.height)||h(Math.max(...x),e.bottom,e.height)))return{o:n,a:c,b:a}}const F=t=>Math.abs(t.a.y-t.o.y)<.5&&Math.abs(t.b.x-t.o.x)<.5,b={share:.008,least:3};function B(t){const e=t.ownerDocument.defaultView,r=Math.max(b.least,Math.min(e?.innerWidth??0,e?.innerHeight??0)*b.share);let d,s,o;const i=L(t),u=t instanceof SVGGraphicsElement?t.getScreenCTM():null;if(i)({o:d,a:s,b:o}=i);else if(t instanceof SVGGraphicsElement&&u){const n=t.getBBox(),c=getComputedStyle(t),a=c.stroke==="none"?0:(parseFloat(c.strokeWidth)||0)/2,l=(y,x)=>{const h=new DOMPoint(y,x).matrixTransform(u);return{x:h.x,y:h.y}};d=l(n.x-a,n.y-a),s=l(n.x+n.width+a,n.y-a),o=l(n.x-a,n.y+n.height+a)}else{const n=t.getBoundingClientRect();d={x:n.left,y:n.top},s={x:n.right,y:n.top},o={x:n.left,y:n.bottom}}return[W(d,s,o,r)]}function W(t,e,r,d){const s=(n,c)=>{const a=Math.hypot(c.x-n.x,c.y-n.y)||1;return{x:(c.x-n.x)/a*d,y:(c.y-n.y)/a*d}},o=s(t,e),i=s(t,r),u={x:e.x+r.x-t.x,y:e.y+r.y-t.y};return[{x:t.x-o.x-i.x,y:t.y-o.y-i.y},{x:e.x+o.x-i.x,y:e.y+o.y-i.y},{x:u.x+o.x+i.x,y:u.y+o.y+i.y},{x:r.x-o.x+i.x,y:r.y-o.y+i.y}]}function H(t){const e=t.ownerDocument.createRange();e.selectNodeContents(t);const r=[...e.getClientRects()].filter(o=>o.width>0&&o.height>0);if(r.length===0)return;const d=Math.min(...r.map(o=>o.left)),s=Math.min(...r.map(o=>o.top));return{x:d,y:s,width:Math.max(...r.map(o=>o.right))-d,height:Math.max(...r.map(o=>o.bottom))-s}}export function pickLayer(t,e){const r=t.createElement("style");r.textContent="* { pointer-events: auto !important; }",t.head.append(r);let d;try{d=t.elementsFromPoint(e.x,e.y)}finally{r.remove()}for(const s of d){const o=s.closest(".ak-footage"),i=o?.dataset.akFile;if(o&&i!==void 0){if(!v(o.querySelector("video")??o))continue;const w=m(o);return{part:o.dataset.akPart??"",layer:"footage",file:i,...w===void 0?{}:{piece:w},outline:B(o)}}const u=s.closest(".ak-layer");if(!u||!v(s)||!S(s))continue;let n=s;for(;n!==u&&n.parentElement&&getComputedStyle(n).display.startsWith("inline")&&!M(n);)n=n.parentElement;const c=M(n)?void 0:L(n),a=c!==void 0&&!F(c),l=M(n)||a?void 0:H(n),y=t.defaultView,x=l?[W({x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x,y:l.y+l.height},Math.max(b.least,Math.min(y?.innerWidth??0,y?.innerHeight??0)*b.share))]:B(n),h=u.getAttribute(C)??void 0,f=m(u),p=n.closest("[data-ak]")?.getAttribute("data-ak"),g=(n instanceof HTMLElement?n.innerText:n.textContent).trim().replace(/\s+/gu," ");return{part:u.closest(".ak-part")?.dataset.key??"",layer:u.dataset.component??"",...h===void 0||h===""?{}:{key:h},...f===void 0?{}:{piece:f},...p?{name:p}:{},...g===""?{}:{text:g.slice(0,E)},outline:x}}}
@@ -229,6 +229,13 @@ export interface LocatedLayer {
229
229
  /** The module it is written in, where another item's (a video drawn inside this one), project-relative. */
230
230
  piece?: string;
231
231
  }
232
+ /** The one layer a person picked at a point (docs/design/notes.md, "Select"): what it is, and its edge, closed rings of points. */
233
+ export interface PickedLayer extends LocatedLayer {
234
+ outline: {
235
+ x: number;
236
+ y: number;
237
+ }[][];
238
+ }
232
239
  /** Where a player starts: a moment, or a part and how far into it (the same share of it when its length is no longer `dur`). */
233
240
  export interface PlayAt {
234
241
  /** Seconds. */
@@ -269,6 +276,11 @@ export interface StageBridge {
269
276
  play(options: PlayOptions): Promise<PlayControl>;
270
277
  /** What a person's mark is on, in shares of the stage. */
271
278
  locate(mark: NoteShape): LocatedLayer[];
279
+ /** The one thing in front at a point, with its edge, both in shares of the stage; none where nothing is drawn there. */
280
+ pick(at: {
281
+ x: number;
282
+ y: number;
283
+ }): PickedLayer | undefined;
272
284
  /**
273
285
  * An item's code as data, its module run and nothing drawn, as the
274
286
  * message its editor hears (a deck's DeckCode and theme), from the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/piece",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -42,10 +42,17 @@ export type Profile = z.infer<typeof ProfileSchema>;
42
42
  /** The roles of a team, the strongest last. */
43
43
  export declare const ROLES: readonly ["member", "admin", "owner"];
44
44
  export type Role = (typeof ROLES)[number];
45
- /** One call: its route (a `:name` filled from the parameter of that name) and its method; the other parameters are the query of a GET or a DELETE, else the body. */
45
+ /**
46
+ * One call: its route (a `:name` filled from the parameter of that name)
47
+ * and its method; a parameter named in `headers` is sent as that request
48
+ * header; the other parameters are the query of a GET or a DELETE, else
49
+ * the body.
50
+ */
46
51
  export interface AccountCall<P extends z.ZodType = z.ZodType, R extends z.ZodType = z.ZodType> extends MethodSpec<P, R> {
47
52
  http: "GET" | "POST" | "PUT" | "DELETE";
48
53
  route: string;
54
+ /** The parameters sent as request headers, each by its header's name. */
55
+ headers?: Readonly<Record<string, string>>;
49
56
  }
50
57
  export declare const ACCOUNT_CALLS: {
51
58
  readonly balance: AccountCall<z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
@@ -75,6 +82,10 @@ export declare const ACCOUNT_CALLS: {
75
82
  renewsAt: z.ZodISODateTime;
76
83
  }, z.core.$strip>>>;
77
84
  bought: z.ZodDefault<z.ZodNumber>;
85
+ expiring: z.ZodDefault<z.ZodArray<z.ZodObject<{
86
+ credits: z.ZodNumber;
87
+ expiresAt: z.ZodISODateTime;
88
+ }, z.core.$strip>>>;
78
89
  customer: z.ZodDefault<z.ZodBoolean>;
79
90
  autoTopUp: z.ZodNullable<z.ZodObject<{
80
91
  below: z.ZodNumber;
@@ -281,6 +292,10 @@ export declare const ACCOUNT_CALLS: {
281
292
  renewsAt: z.ZodISODateTime;
282
293
  }, z.core.$strip>>>;
283
294
  bought: z.ZodDefault<z.ZodNumber>;
295
+ expiring: z.ZodDefault<z.ZodArray<z.ZodObject<{
296
+ credits: z.ZodNumber;
297
+ expiresAt: z.ZodISODateTime;
298
+ }, z.core.$strip>>>;
284
299
  customer: z.ZodDefault<z.ZodBoolean>;
285
300
  autoTopUp: z.ZodNullable<z.ZodObject<{
286
301
  below: z.ZodNumber;
@@ -328,6 +343,7 @@ export declare const ACCOUNT_CALLS: {
328
343
  }, z.core.$strip>>;
329
344
  readonly topUp: AccountCall<z.ZodObject<{
330
345
  topUpCents: z.ZodNumber;
346
+ key: z.ZodUUID;
331
347
  }, z.core.$strict>, z.ZodObject<{
332
348
  credits: z.ZodNumber;
333
349
  }, z.core.$strip>>;
@@ -429,8 +445,8 @@ export declare const ACCOUNT_CALLS: {
429
445
  displayName: z.ZodString;
430
446
  retentionDays: z.ZodNumber;
431
447
  sendPolicy: z.ZodUnion<readonly [z.ZodEnum<{
432
- off: "off";
433
448
  team: "team";
449
+ off: "off";
434
450
  anyone: "anyone";
435
451
  }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
436
452
  sendsLeft: z.ZodNumber;
@@ -448,8 +464,8 @@ export declare const ACCOUNT_CALLS: {
448
464
  readonly "mail/settings": AccountCall<z.ZodObject<{
449
465
  displayName: z.ZodOptional<z.ZodString>;
450
466
  sendPolicy: z.ZodOptional<z.ZodEnum<{
451
- off: "off";
452
467
  team: "team";
468
+ off: "off";
453
469
  anyone: "anyone";
454
470
  }>>;
455
471
  retentionDays: z.ZodOptional<z.ZodNumber>;
@@ -458,8 +474,8 @@ export declare const ACCOUNT_CALLS: {
458
474
  displayName: z.ZodString;
459
475
  retentionDays: z.ZodNumber;
460
476
  sendPolicy: z.ZodUnion<readonly [z.ZodEnum<{
461
- off: "off";
462
477
  team: "team";
478
+ off: "off";
463
479
  anyone: "anyone";
464
480
  }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
465
481
  sendsLeft: z.ZodNumber;
@@ -601,10 +617,11 @@ export declare const ACCOUNT_CALLS: {
601
617
  };
602
618
  export type AccountCalls = typeof ACCOUNT_CALLS;
603
619
  export type AccountCallName = keyof AccountCalls;
604
- /** A call as an HTTP request: its method, its path with the route's parameters and a GET's or a DELETE's query, and a body. */
620
+ /** A call as an HTTP request: its method, its path with the route's parameters and a GET's or a DELETE's query, a body, and the headers the call names. */
605
621
  export declare function accountRequest(c: AccountCall, params: unknown): {
606
622
  method: AccountCall["http"];
607
623
  path: string;
608
624
  body?: unknown;
625
+ headers?: Record<string, string>;
609
626
  };
610
627
  //# sourceMappingURL=account.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as e}from"zod";import{ACCOUNT_DELETE_PATH as _,ACCOUNT_EXPORT_PATH as f,DEVICES_PATH as p,DevicesSchema as y}from"./auth.js";import{AUTO_TOP_UP_PATH as b,AutoTopUpRequestSchema as L,BILLING_CHECKOUT_PATH as v,BILLING_PAYMENT_PATH as G,BILLING_PLANS_PATH as j,BILLING_PORTAL_PATH as U,BILLING_REQUEST_PATH as H,BILLING_RESUME_PATH as k,BILLING_SUMMARY_PATH as N,BILLING_TOP_UP_PATH as C,BILLING_USAGE_PATH as R,BillingPaymentSchema as x,BillingPlansSchema as M,BillingSummarySchema as u,BillingUsageSchema as B,CheckoutRequestSchema as D,PortalRequestSchema as $,TopUpRequestSchema as z,BILLING_INVOICES_PATH as q,BILLING_SPENDS_PATH as V,BillingInvoicesSchema as Y,CAPABILITIES_PATH as A,CATALOG_PATH as Z,EDITORS_PATH as K,EditorsSchema as F,CapabilitiesSchema as E,CapabilityRequestSchema as Q,CatalogSchema as X,BillingSpendsSchema as J}from"./cloud.js";import{MAIL_MESSAGES_PATH as g,MAIL_PATH as W,MAIL_PERSON_QUERY as ee,MAIL_SETTINGS_PATH as te,MailMessageSchema as ie,MailSearchResponseSchema as ne,MailSearchSchema as oe,MailSettingsSchema as se,MailboxSchema as S}from"./mail.js";import{MEMBERS_PATH as l,MemberLimitSchema as ae,MembersSchema as re,ORGANIZATIONS_PATH as P,ORGANIZATION_PATH as I}from"./teams.js";export const INVITATIONS_PATH="/api/organization/invitations",InvitationsSchema=e.object({invitations:e.array(e.object({id:e.string(),email:e.string(),role:e.string(),expiresAt:e.iso.datetime()}))}),LEAVE_PATH="/api/organization/leave",KEYS_PATH="/api/keys",KeysSchema=e.object({keys:e.array(e.object({id:e.string(),name:e.string().nullable(),start:e.string().nullable(),enabled:e.boolean(),createdAt:e.iso.datetime(),lastUsedAt:e.iso.datetime().nullable()}))}),PROFILE_PATH="/api/account/profile",ProfileSchema=e.object({name:e.string(),email:e.string(),google:e.boolean(),v1:e.object({url:e.url(),closesAt:e.iso.datetime({offset:!0}),bonusCredits:e.number().int().nonnegative().default(0)}).optional()}),ROLES=["member","admin","owner"];const i=e.strictObject({}),n=e.object({}),w=e.object({url:e.url()}),d=e.string().trim().min(1).max(100),t=(o,h,m,c,s)=>({http:o,route:h,params:m,result:c,about:s});export const ACCOUNT_CALLS={balance:t("GET",N,i,u,"The organization's credits, this month's plan credits, its plan and its auto top-up."),plans:t("GET",j,i,M,"The plans, their prices, and what a top-up buys."),usage:t("GET",R,e.strictObject({days:e.int().min(1).max(400),timeZone:e.string().min(1)}),B,"Credits spent each day by what they were spent on, the days with none left out."),catalog:t("GET",Z,i,X,"The cloud tools' catalog: its works and every tool, with what it costs."),editors:t("GET",K,i,F,"The editors the console lists, free in every product, in their order."),capabilities:t("GET",A,i,E,"The cloud tools the team turned off: works and tools."),"capabilities/set":t("PUT",A,Q,E,"A work or a tool switched on or off for the team, an owner's or an admin's; what is off now."),spends:t("GET",V,e.strictObject({days:e.int().min(1).max(400),limit:e.int().min(1).max(5e3).optional()}),J,"Each spend of the last days, the latest first: when, by whom, on what and how many credits; a member reads their own."),checkout:t("POST",v,D,w,"Stripe Checkout for a plan or a top-up, to open in a browser."),portal:t("POST",U,$,w,"Stripe's Customer Portal at its home (the card, billing details, invoices) or at a flow (a new card, a change of plan, the plan's cancellation), to open in a browser."),resume:t("POST",k,i,u,"A plan cancelled at its period's end taken up again."),payment:t("GET",G,i,x,"The card charged without the person there, and where Stripe's emails go."),invoices:t("GET",q,i,Y,"The organization's invoices, the latest first, each with its PDF."),topUp:t("POST",C,z,e.object({credits:e.number()}),"Credits bought with the saved card at once; answers what was added."),"autoTopUp/set":t("PUT",b,L,e.union([e.object({on:e.literal(!0)}),e.object({saveCard:e.url()})]),"Auto top-up on, or Stripe Checkout that saves a card first (or another), to open in a browser."),"autoTopUp/off":t("DELETE",b,i,n,"Auto top-up off."),"credits/request":t("POST",H,i,e.object({asked:e.literal(!0)}),"The organization's owners and admins asked by email to add credits, at most once a day for each member."),members:t("GET",l,i,re,"The members with their limits and spend; a member sees their own row."),"members/limit":t("PUT",`${l}/:userId/limit`,e.strictObject({userId:e.string().min(1)}).extend(ae.shape),n,"A member's limit in credits a month, null for none."),"members/role":t("PUT",`${l}/:userId/role`,e.strictObject({userId:e.string().min(1),role:e.enum(ROLES)}),n,"A member's role; only an owner makes or unmakes an owner."),"members/remove":t("DELETE",`${l}/:userId`,e.strictObject({userId:e.string().min(1)}),n,"A member removed from the team."),invitations:t("GET",INVITATIONS_PATH,i,InvitationsSchema,"The invitations waiting to be accepted."),"invitations/send":t("POST",INVITATIONS_PATH,e.strictObject({email:e.email(),role:e.enum(["member","admin"])}),n,"Invites a person by email; one invited already is sent a new invitation."),"invitations/cancel":t("DELETE",`${INVITATIONS_PATH}/:id`,e.strictObject({id:e.string().min(1)}),n,"An invitation cancelled."),"team/create":t("POST",P,e.strictObject({name:d}),e.object({id:e.string()}),"A new team, the person its owner."),"team/rename":t("PUT",I,e.strictObject({name:d}),n,"The team renamed."),"team/leave":t("POST",LEAVE_PATH,i,n,"The person leaves the team; its last owner cannot."),"team/dissolve":t("DELETE",I,i,n,"The team dissolved by its owner; it can be restored for 30 days."),"team/restore":t("POST",`${P}/:id/restore`,e.strictObject({id:e.string().min(1)}),n,"A dissolved team restored by its owner."),keys:t("GET",KEYS_PATH,i,KeysSchema,"The person's API keys for the organization."),"keys/create":t("POST",KEYS_PATH,e.strictObject({name:d}),e.object({id:e.string(),key:e.string()}),"A new API key; its secret is in this answer alone."),"keys/enable":t("PUT",`${KEYS_PATH}/:id`,e.strictObject({id:e.string().min(1),enabled:e.boolean()}),n,"An API key turned off or on again."),"keys/remove":t("DELETE",`${KEYS_PATH}/:id`,e.strictObject({id:e.string().min(1)}),n,"An API key deleted."),mail:t("GET",W,i,S,"The person's mailbox in the organization: its addresses and settings."),"mail/settings":t("PUT",`${te}?${ee}`,se,S,"The mailbox's display name, whom its agents may write to, and how long it keeps mail."),"mail/messages":t("GET",g,oe,ne,"The mailbox's messages, newest first."),"mail/message":t("GET",`${g}/:id`,e.strictObject({id:e.string().min(1)}),ie,"One message, read whole."),profile:t("GET",PROFILE_PATH,i,ProfileSchema,"The person's name and email, whether Google signs them in, and AllyHub's previous version while it is open to them."),"profile/set":t("PUT",PROFILE_PATH,e.strictObject({name:d}),n,"The person's name."),devices:t("GET",p,i,y,"The computers signed in as the person."),"devices/signOut":t("DELETE",`${p}/:id`,e.strictObject({id:e.string().min(1)}),n,"A computer signed out."),"devices/signOutOthers":t("DELETE",p,i,n,"Every computer signed out but the one that asks."),export:t("GET",f,i,e.record(e.string(),e.unknown()),"Everything kept about the person."),close:t("POST",_,i,n,"Mails the link that deletes the person's account: a browser's session alone, so a computer opens the page in the browser.")};export function accountRequest(o,h){const m=h,c=new Set,s=o.route.replace(/:([A-Za-z]+)/gu,(r,a)=>(c.add(a),encodeURIComponent(String(m[a])))),T=Object.entries(m).filter(([r,a])=>!c.has(r)&&a!==void 0);if(o.http==="GET"||o.http==="DELETE"){const r=T.map(([a,O])=>`${encodeURIComponent(a)}=${encodeURIComponent(String(O))}`).join("&");return{method:o.http,path:r===""?s:`${s}?${r}`}}return T.length===0?{method:o.http,path:s}:{method:o.http,path:s,body:Object.fromEntries(T)}}
2
+ import{z as e}from"zod";import{ACCOUNT_DELETE_PATH as L,ACCOUNT_EXPORT_PATH as v,DEVICES_PATH as E,DevicesSchema as G}from"./auth.js";import{AUTO_TOP_UP_PATH as g,AutoTopUpRequestSchema as j,BILLING_CHECKOUT_PATH as H,BILLING_PAYMENT_PATH as U,BILLING_PLANS_PATH as k,BILLING_PORTAL_PATH as N,BILLING_REQUEST_PATH as C,BILLING_RESUME_PATH as R,BILLING_SUMMARY_PATH as x,BILLING_TOP_UP_PATH as M,BILLING_USAGE_PATH as B,BillingPaymentSchema as D,BillingPlansSchema as $,BillingSummarySchema as S,BillingUsageSchema as z,CheckoutRequestSchema as q,PortalRequestSchema as Y,TopUpRequestSchema as K,BILLING_INVOICES_PATH as V,BILLING_SPENDS_PATH as Z,BillingInvoicesSchema as F,IDEMPOTENCY_KEY_HEADER as Q,CAPABILITIES_PATH as P,CATALOG_PATH as X,EDITORS_PATH as J,EditorsSchema as W,CapabilitiesSchema as w,CapabilityRequestSchema as ee,CatalogSchema as te,BillingSpendsSchema as se}from"./cloud.js";import{MAIL_MESSAGES_PATH as I,MAIL_PATH as ne,MAIL_PERSON_QUERY as ie,MAIL_SETTINGS_PATH as oe,MailMessageSchema as ae,MailSearchResponseSchema as re,MailSearchSchema as me,MailSettingsSchema as ce,MailboxSchema as O}from"./mail.js";import{MEMBERS_PATH as h,MemberLimitSchema as le,MembersSchema as de,ORGANIZATIONS_PATH as _,ORGANIZATION_PATH as y}from"./teams.js";export const INVITATIONS_PATH="/api/organization/invitations",InvitationsSchema=e.object({invitations:e.array(e.object({id:e.string(),email:e.string(),role:e.string(),expiresAt:e.iso.datetime()}))}),LEAVE_PATH="/api/organization/leave",KEYS_PATH="/api/keys",KeysSchema=e.object({keys:e.array(e.object({id:e.string(),name:e.string().nullable(),start:e.string().nullable(),enabled:e.boolean(),createdAt:e.iso.datetime(),lastUsedAt:e.iso.datetime().nullable()}))}),PROFILE_PATH="/api/account/profile",ProfileSchema=e.object({name:e.string(),email:e.string(),google:e.boolean(),v1:e.object({url:e.url(),closesAt:e.iso.datetime({offset:!0}),bonusCredits:e.number().int().nonnegative().default(0)}).optional()}),ROLES=["member","admin","owner"];const s=e.strictObject({}),n=e.object({}),f=e.object({url:e.url()}),T=e.string().trim().min(1).max(100),t=(i,p,m,l,r,c)=>({http:i,route:p,params:m,result:l,about:r,...c===void 0?{}:{headers:c}});export const ACCOUNT_CALLS={balance:t("GET",x,s,S,"The organization's credits, this month's plan credits, its plan and its auto top-up."),plans:t("GET",k,s,$,"The plans, their prices, and what a top-up buys."),usage:t("GET",B,e.strictObject({days:e.int().min(1).max(400),timeZone:e.string().min(1)}),z,"Credits spent each day by what they were spent on, the days with none left out."),catalog:t("GET",X,s,te,"The cloud tools' catalog: its works and every tool, with what it costs."),editors:t("GET",J,s,W,"The editors the console lists, free in every product, in their order."),capabilities:t("GET",P,s,w,"The cloud tools the team turned off: works and tools."),"capabilities/set":t("PUT",P,ee,w,"A work or a tool switched on or off for the team, an owner's or an admin's; what is off now."),spends:t("GET",Z,e.strictObject({days:e.int().min(1).max(400),limit:e.int().min(1).max(5e3).optional()}),se,"Each spend of the last days, the latest first: when, by whom, on what and how many credits; a member reads their own."),checkout:t("POST",H,q,f,"Stripe Checkout for a plan or a top-up, to open in a browser."),portal:t("POST",N,Y,f,"Stripe's Customer Portal at its home (the card, billing details, invoices) or at a flow (a new card, a change of plan, the plan's cancellation), to open in a browser."),resume:t("POST",R,s,S,"A plan cancelled at its period's end taken up again."),payment:t("GET",U,s,D,"The card charged without the person there, and where Stripe's emails go."),invoices:t("GET",V,s,F,"The organization's invoices, the latest first, each with its PDF."),topUp:t("POST",M,K.extend({key:e.uuid()}),e.object({credits:e.number()}),"Credits bought with the saved card at once, once by the purchase's key; answers what was added. A browser's session alone.",{key:Q}),"autoTopUp/set":t("PUT",g,j,e.union([e.object({on:e.literal(!0)}),e.object({saveCard:e.url()})]),"Auto top-up on, or Stripe Checkout that saves a card first (or another), to open in a browser. A browser's session alone."),"autoTopUp/off":t("DELETE",g,s,n,"Auto top-up off."),"credits/request":t("POST",C,s,e.object({asked:e.literal(!0)}),"The organization's owners and admins asked by email to add credits, at most once a day for each member."),members:t("GET",h,s,de,"The members with their limits and spend; a member sees their own row."),"members/limit":t("PUT",`${h}/:userId/limit`,e.strictObject({userId:e.string().min(1)}).extend(le.shape),n,"A member's limit in credits a month, null for none."),"members/role":t("PUT",`${h}/:userId/role`,e.strictObject({userId:e.string().min(1),role:e.enum(ROLES)}),n,"A member's role; only an owner makes or unmakes an owner."),"members/remove":t("DELETE",`${h}/:userId`,e.strictObject({userId:e.string().min(1)}),n,"A member removed from the team."),invitations:t("GET",INVITATIONS_PATH,s,InvitationsSchema,"The invitations waiting to be accepted."),"invitations/send":t("POST",INVITATIONS_PATH,e.strictObject({email:e.email(),role:e.enum(["member","admin"])}),n,"Invites a person by email; one invited already is sent a new invitation."),"invitations/cancel":t("DELETE",`${INVITATIONS_PATH}/:id`,e.strictObject({id:e.string().min(1)}),n,"An invitation cancelled."),"team/create":t("POST",_,e.strictObject({name:T}),e.object({id:e.string()}),"A new team, the person its owner."),"team/rename":t("PUT",y,e.strictObject({name:T}),n,"The team renamed."),"team/leave":t("POST",LEAVE_PATH,s,n,"The person leaves the team; its last owner cannot."),"team/dissolve":t("DELETE",y,s,n,"The team dissolved by its owner; it can be restored for 30 days."),"team/restore":t("POST",`${_}/:id/restore`,e.strictObject({id:e.string().min(1)}),n,"A dissolved team restored by its owner."),keys:t("GET",KEYS_PATH,s,KeysSchema,"The person's API keys for the organization."),"keys/create":t("POST",KEYS_PATH,e.strictObject({name:T}),e.object({id:e.string(),key:e.string()}),"A new API key; its secret is in this answer alone."),"keys/enable":t("PUT",`${KEYS_PATH}/:id`,e.strictObject({id:e.string().min(1),enabled:e.boolean()}),n,"An API key turned off or on again."),"keys/remove":t("DELETE",`${KEYS_PATH}/:id`,e.strictObject({id:e.string().min(1)}),n,"An API key deleted."),mail:t("GET",ne,s,O,"The person's mailbox in the organization: its addresses and settings."),"mail/settings":t("PUT",`${oe}?${ie}`,ce,O,"The mailbox's display name, whom its agents may write to, and how long it keeps mail."),"mail/messages":t("GET",I,me,re,"The mailbox's messages, newest first."),"mail/message":t("GET",`${I}/:id`,e.strictObject({id:e.string().min(1)}),ae,"One message, read whole."),profile:t("GET",PROFILE_PATH,s,ProfileSchema,"The person's name and email, whether Google signs them in, and AllyHub's previous version while it is open to them."),"profile/set":t("PUT",PROFILE_PATH,e.strictObject({name:T}),n,"The person's name."),devices:t("GET",E,s,G,"The computers signed in as the person."),"devices/signOut":t("DELETE",`${E}/:id`,e.strictObject({id:e.string().min(1)}),n,"A computer signed out."),"devices/signOutOthers":t("DELETE",E,s,n,"Every computer signed out but the one that asks."),export:t("GET",v,s,e.record(e.string(),e.unknown()),"Everything kept about the person."),close:t("POST",L,s,n,"Mails the link that deletes the person's account: a browser's session alone, so a computer opens the page in the browser.")};export function accountRequest(i,p){const m=p,l=new Set,r=i.route.replace(/:([A-Za-z]+)/gu,(o,a)=>(l.add(a),encodeURIComponent(String(m[a])))),c=i.headers??{},A=Object.entries(c).flatMap(([o,a])=>{const d=m[o];return typeof d=="string"?[[a,d]]:[]}),b=A.length===0?{}:{headers:Object.fromEntries(A)},u=Object.entries(m).filter(([o,a])=>!l.has(o)&&!(o in c)&&a!==void 0);if(i.http==="GET"||i.http==="DELETE"){const o=u.map(([a,d])=>`${encodeURIComponent(a)}=${encodeURIComponent(String(d))}`).join("&");return{method:i.http,path:o===""?r:`${r}?${o}`,...b}}return u.length===0?{method:i.http,path:r,...b}:{method:i.http,path:r,body:Object.fromEntries(u),...b}}
@@ -66,6 +66,62 @@ export declare const BrowserLinkSchema: z.ZodObject<{
66
66
  url: z.ZodURL;
67
67
  }, z.core.$strip>;
68
68
  export type BrowserLink = z.infer<typeof BrowserLinkSchema>;
69
+ /**
70
+ * `GET`, open to anyone: what AllyHub's own sign-in page needs before it
71
+ * asks for a sign-in link. `turnstile` is there where a link is sent only
72
+ * to a request that carries Cloudflare Turnstile's token (the page draws
73
+ * the widget with `siteKey` and sends its token as `CAPTCHA_HEADER`).
74
+ */
75
+ export declare const SIGN_IN_PATH = "/api/sign-in";
76
+ export declare const SignInSchema: z.ZodObject<{
77
+ turnstile: z.ZodOptional<z.ZodObject<{
78
+ siteKey: z.ZodString;
79
+ }, z.core.$strip>>;
80
+ }, z.core.$strip>;
81
+ export type SignIn = z.infer<typeof SignInSchema>;
82
+ /** The header a request for a sign-in link carries Turnstile's token in (Better Auth's captcha plugin's name for it). */
83
+ export declare const CAPTCHA_HEADER = "x-captcha-response";
84
+ /**
85
+ * `POST { email, authorization }`, open to anyone, a few times in ten
86
+ * minutes from one address: AllyHub mails `email` a link that signs a
87
+ * browser in and goes on to `authorization`, the authorization a program
88
+ * on this computer began for its own sign-in (AllyHub's client, the code
89
+ * back to its loopback; anything else is refused). It is how a program
90
+ * with no page of AllyHub's to ask from signs in by email (Studio's
91
+ * Welcome): the person stays in the program, and the link, followed in a
92
+ * browser on that computer, signs the computer in. AllyHub's own sign-in
93
+ * page asks Better Auth's route instead, with Turnstile's token where its
94
+ * keys are set; this route takes none, a program having nowhere to get
95
+ * one. Answers `{}` whether or not the address has an account.
96
+ */
97
+ export declare const SIGN_IN_LINK_PATH = "/api/auth/sign-in/link";
98
+ export declare const SignInLinkRequestSchema: z.ZodObject<{
99
+ email: z.ZodEmail;
100
+ authorization: z.ZodURL;
101
+ }, z.core.$strict>;
102
+ export type SignInLinkRequest = z.infer<typeof SignInLinkRequestSchema>;
103
+ /**
104
+ * The scheme of the link that brings AllyHub's desktop app to the front (a
105
+ * private-use scheme, as RFC 8252 7.1 names them): the app registers it,
106
+ * and a page of AllyHub's links to it. A link of it carries nothing. A
107
+ * computer's sign-in comes back by the loopback, never by it, so a program
108
+ * that took the scheme for itself would learn nothing.
109
+ */
110
+ export declare const DESKTOP_SCHEME = "allyhub";
111
+ /** The link that brings the desktop app to the front, and does nothing else. */
112
+ export declare const DESKTOP_OPEN = "allyhub://open";
113
+ /**
114
+ * The page a computer's sign-in lands on in the browser (its loopback
115
+ * sends the browser there). `desktop` says the sign-in was the desktop
116
+ * app's and a link opens it (`DESKTOP_OPEN`): the page then offers to
117
+ * bring it forward, which an app cannot do for itself from behind the
118
+ * browser the person is in.
119
+ */
120
+ export declare function signedInAddress(origin: string, o?: {
121
+ desktop?: boolean | undefined;
122
+ }): string;
123
+ /** Whether the signed-in page's address says the sign-in was the desktop app's. */
124
+ export declare function signedInFromDesktop(search: string): boolean;
69
125
  /** The credentials file, relative to the home folder (ALLYHUB_HOME moves it). */
70
126
  export declare const CREDENTIALS_FILE = ".allyhub/credentials.json";
71
127
  /** A token endpoint's answer (RFC 6749 5.1). */
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as e}from"zod";export const AuthServerSchema=e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),device_authorization_endpoint:e.url(),revocation_endpoint:e.url(),code_challenge_methods_supported:e.array(e.string()).refine(t=>t.includes("S256"),{message:"The server must take S256 PKCE challenges."})}),CLIENT_ID="allyhub-cli",ISSUER_PATH="/api/auth",METADATA_PATH=`/.well-known/oauth-authorization-server${ISSUER_PATH}`,SCOPES="openid profile email offline_access",ACCOUNT_PATH="/api/account",ORGANIZATION_HEADER="x-allyhub-organization",DEVICES_PATH="/api/account/devices",DEVICE_HEADER="x-allyhub-device",DEVICE_NAME_HEADER="x-allyhub-device-name",DeviceIdSchema=e.string().regex(/^[\w-]{16,64}$/u),ACCOUNT_EXPORT_PATH="/api/account/export",ACCOUNT_DELETE_PATH="/api/account/delete",DevicesSchema=e.object({devices:e.array(e.object({id:e.string(),client:e.string(),signedInAt:e.iso.datetime(),lastActiveAt:e.iso.datetime(),name:e.string().nullable().optional(),app:e.string().nullable().optional(),os:e.string().nullable().optional(),city:e.string().nullable().optional(),country:e.string().nullable().optional(),current:e.boolean().optional()}))}),BROWSER_LINK_PATH="/api/account/browser-link",BrowserLinkRequestSchema=e.strictObject({to:e.string().startsWith("/")}),BrowserLinkSchema=e.object({url:e.url()}),CREDENTIALS_FILE=".allyhub/credentials.json",TokenResponseSchema=e.object({access_token:e.string().min(1),token_type:e.string(),expires_in:e.number().positive(),refresh_token:e.string().min(1).optional(),scope:e.string().optional()}),OAuthErrorSchema=e.object({error:e.string(),error_description:e.string().optional()}),DeviceAuthorizationSchema=e.object({device_code:e.string().min(1),user_code:e.string().min(1),verification_uri:e.url(),verification_uri_complete:e.url().optional(),expires_in:e.number().positive(),interval:e.number().positive().optional()}),AccountSchema=e.object({id:e.string().min(1),email:e.email(),name:e.string().optional(),organization:e.object({id:e.string().min(1),name:e.string()}).optional()}),CredentialsFileSchema=e.object({version:e.literal(1),url:e.url(),issuer:e.url(),account:AccountSchema,refreshToken:e.string().min(1).optional(),access:e.object({token:e.string().min(1),expiresAt:e.iso.datetime({offset:!0})}).optional(),keychain:e.string().min(1).optional(),since:e.iso.datetime({offset:!0}),device:e.string().min(1).optional()});
2
+ import{z as e}from"zod";export const AuthServerSchema=e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),device_authorization_endpoint:e.url(),revocation_endpoint:e.url(),code_challenge_methods_supported:e.array(e.string()).refine(t=>t.includes("S256"),{message:"The server must take S256 PKCE challenges."})}),CLIENT_ID="allyhub-cli",ISSUER_PATH="/api/auth",METADATA_PATH=`/.well-known/oauth-authorization-server${ISSUER_PATH}`,SCOPES="openid profile email offline_access",ACCOUNT_PATH="/api/account",ORGANIZATION_HEADER="x-allyhub-organization",DEVICES_PATH="/api/account/devices",DEVICE_HEADER="x-allyhub-device",DEVICE_NAME_HEADER="x-allyhub-device-name",DeviceIdSchema=e.string().regex(/^[\w-]{16,64}$/u),ACCOUNT_EXPORT_PATH="/api/account/export",ACCOUNT_DELETE_PATH="/api/account/delete",DevicesSchema=e.object({devices:e.array(e.object({id:e.string(),client:e.string(),signedInAt:e.iso.datetime(),lastActiveAt:e.iso.datetime(),name:e.string().nullable().optional(),app:e.string().nullable().optional(),os:e.string().nullable().optional(),city:e.string().nullable().optional(),country:e.string().nullable().optional(),current:e.boolean().optional()}))}),BROWSER_LINK_PATH="/api/account/browser-link",BrowserLinkRequestSchema=e.strictObject({to:e.string().startsWith("/")}),BrowserLinkSchema=e.object({url:e.url()}),SIGN_IN_PATH="/api/sign-in",SignInSchema=e.object({turnstile:e.object({siteKey:e.string().min(1)}).optional()}),CAPTCHA_HEADER="x-captcha-response",SIGN_IN_LINK_PATH=`${ISSUER_PATH}/sign-in/link`,SignInLinkRequestSchema=e.strictObject({email:e.email(),authorization:e.url()}),DESKTOP_SCHEME="allyhub",DESKTOP_OPEN=`${DESKTOP_SCHEME}://open`;export function signedInAddress(t,o={}){return`${t}/signed-in${o.desktop===!0?"?from=desktop":""}`}export function signedInFromDesktop(t){return new URLSearchParams(t).get("from")==="desktop"}export const CREDENTIALS_FILE=".allyhub/credentials.json",TokenResponseSchema=e.object({access_token:e.string().min(1),token_type:e.string(),expires_in:e.number().positive(),refresh_token:e.string().min(1).optional(),scope:e.string().optional()}),OAuthErrorSchema=e.object({error:e.string(),error_description:e.string().optional()}),DeviceAuthorizationSchema=e.object({device_code:e.string().min(1),user_code:e.string().min(1),verification_uri:e.url(),verification_uri_complete:e.url().optional(),expires_in:e.number().positive(),interval:e.number().positive().optional()}),AccountSchema=e.object({id:e.string().min(1),email:e.email(),name:e.string().optional(),organization:e.object({id:e.string().min(1),name:e.string()}).optional()}),CredentialsFileSchema=e.object({version:e.literal(1),url:e.url(),issuer:e.url(),account:AccountSchema,refreshToken:e.string().min(1).optional(),access:e.object({token:e.string().min(1),expiresAt:e.iso.datetime({offset:!0})}).optional(),keychain:e.string().min(1).optional(),since:e.iso.datetime({offset:!0}),device:e.string().min(1).optional()});
@@ -42,6 +42,10 @@ export declare const BillingSummarySchema: z.ZodObject<{
42
42
  renewsAt: z.ZodISODateTime;
43
43
  }, z.core.$strip>>>;
44
44
  bought: z.ZodDefault<z.ZodNumber>;
45
+ expiring: z.ZodDefault<z.ZodArray<z.ZodObject<{
46
+ credits: z.ZodNumber;
47
+ expiresAt: z.ZodISODateTime;
48
+ }, z.core.$strip>>>;
45
49
  customer: z.ZodDefault<z.ZodBoolean>;
46
50
  autoTopUp: z.ZodNullable<z.ZodObject<{
47
51
  below: z.ZodNumber;
@@ -192,18 +196,34 @@ export declare const BillingInvoicesSchema: z.ZodObject<{
192
196
  }, z.core.$strip>>;
193
197
  }, z.core.$strip>;
194
198
  export type BillingInvoices = z.infer<typeof BillingInvoicesSchema>;
195
- /** `POST { topUpCents }`, an owner's or an admin's: credits bought with the saved card at once; answers `{ credits }`, what was added. */
199
+ /**
200
+ * `POST { topUpCents }`, an owner's or an admin's in a browser on AllyHub's
201
+ * site (never a computer's sign-in: it takes money with no person at
202
+ * Stripe's page): credits bought with the saved card at once; answers
203
+ * `{ credits }`, what was added. It needs `IDEMPOTENCY_KEY_HEADER`, and is
204
+ * refused (`too_many_charges`) past a day's charges of the card.
205
+ */
196
206
  export declare const BILLING_TOP_UP_PATH = "/api/billing/top-up";
197
207
  export declare const TopUpRequestSchema: z.ZodObject<{
198
208
  topUpCents: z.ZodNumber;
199
209
  }, z.core.$strict>;
210
+ /**
211
+ * The request header that makes what a request does once (IETF's httpapi
212
+ * draft, "The Idempotency-Key HTTP Header Field"): a key the client makes
213
+ * for one purchase or one call, a UUID. A top-up with the saved card needs
214
+ * it: the same key sent again is answered as the first was, the card
215
+ * charged once; without it the request is refused (400), and with another
216
+ * request's it is refused too. A tool call may carry it (below).
217
+ */
218
+ export declare const IDEMPOTENCY_KEY_HEADER = "idempotency-key";
200
219
  /** `POST`, any member's: the organization's owners and admins are asked by email to add credits, at most once a day for each member. */
201
220
  export declare const BILLING_REQUEST_PATH = "/api/billing/request";
202
221
  /**
203
222
  * `PUT { below, amountCents, monthlyLimitCents?, newCard? }`, an owner's or
204
- * an admin's: auto top-up on, answered `{ on: true }`, or `{ saveCard: url }`,
205
- * a Checkout that saves a card first (or a new one, `newCard`); `DELETE`
206
- * turns it off.
223
+ * an admin's in a browser on AllyHub's site (never a computer's sign-in: it
224
+ * agrees to charges made with no person there): auto top-up on, answered
225
+ * `{ on: true }`, or `{ saveCard: url }`, a Checkout that saves a card first
226
+ * (or a new one, `newCard`); `DELETE` turns it off.
207
227
  */
208
228
  export declare const AUTO_TOP_UP_PATH = "/api/billing/auto-top-up";
209
229
  export declare const AutoTopUpRequestSchema: z.ZodObject<{
@@ -218,14 +238,33 @@ export declare const AutoTopUpRequestSchema: z.ZodObject<{
218
238
  * bounds (`min`, `max`, in cents), a monthly limit under the amount, a
219
239
  * plan already bought, a plan not offered, nothing to pay with, an
220
240
  * organization frozen by a dispute, a card that could not be charged
221
- * (`why`, an auto top-up stop's), a request asked already today.
241
+ * (`why`, an auto top-up stop's), a request asked already today, the saved
242
+ * card charged as often as a day allows (`most`, in 24 hours).
222
243
  */
223
- export declare const BILLING_REFUSALS: readonly ["top_up_amount", "monthly_limit", "has_plan", "no_plan", "no_such_plan", "not_customer", "no_card", "frozen", "not_charged", "asked_today"];
244
+ export declare const BILLING_REFUSALS: readonly ["top_up_amount", "monthly_limit", "has_plan", "no_plan", "no_such_plan", "not_customer", "no_card", "frozen", "not_charged", "asked_today", "too_many_charges"];
224
245
  export type BillingRefusal = (typeof BILLING_REFUSALS)[number];
225
- /** The plan's section of Settings, where a payment that was not made comes back to. */
246
+ /** The plan's section of Settings. */
226
247
  export declare const BILLING_PAGE_PATH = "/settings/plan";
227
- /** Where Stripe's Checkout lands once paid: the plan's section, which follows the balance until what was paid for is there. */
228
- export declare const BILLING_PAID_PATH = "/settings/plan?paid=1";
248
+ /** The team a page of Settings acts in, in its address (`?team=`): the organization's id. Without it, the team the browser works in. */
249
+ export declare const TEAM_PARAM = "team";
250
+ /** Where the plan page opens, in its address (`?view=`): `plans`, or `credits` to buy. */
251
+ export declare const PLAN_VIEW_PARAM = "view";
252
+ /** Back from paying, in the plan page's address (`?paid=1`): the page follows the balance until what was paid for is there. */
253
+ export declare const PAID_PARAM = "paid";
254
+ /** What the plan page opens at: its plans, credits to buy, or back from paying. */
255
+ export declare const PLAN_PAGE_OPENS: readonly ["plans", "credits", "paid"];
256
+ export type PlanPageOpen = (typeof PLAN_PAGE_OPENS)[number];
257
+ /**
258
+ * The plan page's address on a site (its origin), in the team it acts in
259
+ * and at what it opens. Everything that sends a person to the plan page
260
+ * makes its address here: Stripe's way back, the billing emails, the CLI's
261
+ * hint.
262
+ */
263
+ export declare function planPageAddress(origin: string, o?: {
264
+ /** The team it acts in, by the organization's id. */
265
+ organization?: string | undefined;
266
+ open?: PlanPageOpen | undefined;
267
+ }): string;
229
268
  /** The models the organization may use. */
230
269
  export declare const LLM_MODELS_PATH = "/api/llm/models";
231
270
  /** Anthropic's Messages API (`POST`), streamed or not. */
@@ -413,6 +452,15 @@ export declare const EditorsSchema: z.ZodObject<{
413
452
  export type Editors = z.infer<typeof EditorsSchema>;
414
453
  /** Where a tool's calls are made (POST). */
415
454
  export declare const toolCallsPath: (tool: string) => string;
455
+ /**
456
+ * A call's POST may carry `IDEMPOTENCY_KEY_HEADER` so that a call sent
457
+ * again is one call: the same key from the same person in the same
458
+ * organization, with the same tool and input, answers the call there is,
459
+ * whatever its state, and starts nothing; with another tool or input it
460
+ * is a `conflict`. A new key a new call (a UUID), this many characters at
461
+ * most.
462
+ */
463
+ export declare const IDEMPOTENCY_KEY_MAX = 255;
416
464
  /** Where a call is read again (GET). */
417
465
  export declare const callPath: (id: string) => string;
418
466
  export declare const ToolCallRequestSchema: z.ZodObject<{