@omg-dev/protocol 0.6.137 → 0.6.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/expo-account.d.ts +38 -0
- package/dist/expo-account.d.ts.map +1 -0
- package/dist/expo-account.js +16 -0
- package/dist/expo-account.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/project-preview.d.ts +100 -0
- package/dist/project-preview.d.ts.map +1 -1
- package/dist/project-preview.js +41 -0
- package/dist/project-preview.js.map +1 -1
- package/dist/session-mention-token.d.ts +18 -6
- package/dist/session-mention-token.d.ts.map +1 -1
- package/dist/session-mention-token.js +30 -5
- package/dist/session-mention-token.js.map +1 -1
- package/dist/threads.d.ts +314 -0
- package/dist/threads.d.ts.map +1 -0
- package/dist/threads.js +439 -0
- package/dist/threads.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Expo account of this Computer's Expo CLI, as the preview card sees it.
|
|
3
|
+
*
|
|
4
|
+
* Expo Go on a physical iPhone opens a dev server only when the manifest names
|
|
5
|
+
* the signed-in Expo CLI account (`extra.expoGo.username`) and Expo Go is
|
|
6
|
+
* signed in to the same account. The card checks this before it offers
|
|
7
|
+
* "Open in Expo Go", and offers "Connect Expo" otherwise.
|
|
8
|
+
*
|
|
9
|
+
* TODO(expo-go-58): Expo Go 58 reads `expo_go_prompt_device_auth=1` on the
|
|
10
|
+
* `exps://` link and shows its own "Sign in to Expo Go" sheet (expo/expo#48865).
|
|
11
|
+
* When Expo Go 58 is on the App Store, add it to the "Open in Expo Go" link
|
|
12
|
+
* while `signedIn` is true, so the phone signs in to the same account.
|
|
13
|
+
*/
|
|
14
|
+
export type ExpoConnectState =
|
|
15
|
+
/** `expo login --browser` runs, and the login page is open in the Computer browser. */
|
|
16
|
+
"waiting"
|
|
17
|
+
/** The login finished. The Computer checks the account and the manifest. */
|
|
18
|
+
| "verifying"
|
|
19
|
+
/** Metro restarts so that the manifest names the account. */
|
|
20
|
+
| "restarting" | "done" | "failed" | "cancelled";
|
|
21
|
+
export interface ExpoConnectStatus {
|
|
22
|
+
state: ExpoConnectState;
|
|
23
|
+
startedAt: number;
|
|
24
|
+
/** Short text for the card, for example why the login failed. */
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ExpoAccountSnapshot {
|
|
28
|
+
signedIn: boolean;
|
|
29
|
+
/** The Expo account name, when `signedIn` is true. */
|
|
30
|
+
username?: string;
|
|
31
|
+
/** The last or current "Connect Expo" run on this Computer. */
|
|
32
|
+
connect?: ExpoConnectStatus;
|
|
33
|
+
}
|
|
34
|
+
/** True while a "Connect Expo" run is in progress. */
|
|
35
|
+
export declare function expoConnectActive(status: ExpoConnectStatus | undefined): boolean;
|
|
36
|
+
/** The card text while a "Connect Expo" run is in progress. */
|
|
37
|
+
export declare function expoConnectMessage(status: ExpoConnectStatus): string;
|
|
38
|
+
//# sourceMappingURL=expo-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expo-account.d.ts","sourceRoot":"","sources":["../src/expo-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB;AAC1B,uFAAuF;AACrF,SAAS;AACX,4EAA4E;GAC1E,WAAW;AACb,6DAA6D;GAC3D,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAEhF;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CASpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** True while a "Connect Expo" run is in progress. */
|
|
2
|
+
export function expoConnectActive(status) {
|
|
3
|
+
return status?.state === "waiting" || status?.state === "verifying" || status?.state === "restarting";
|
|
4
|
+
}
|
|
5
|
+
/** The card text while a "Connect Expo" run is in progress. */
|
|
6
|
+
export function expoConnectMessage(status) {
|
|
7
|
+
switch (status.state) {
|
|
8
|
+
case "waiting": return "Sign in to Expo in the Computer window…";
|
|
9
|
+
case "verifying": return "Checking the Expo account…";
|
|
10
|
+
case "restarting": return "Restarting the preview with your Expo account…";
|
|
11
|
+
case "done": return status.message ?? "Expo is connected.";
|
|
12
|
+
case "cancelled": return "Expo sign-in was cancelled.";
|
|
13
|
+
case "failed": return status.message ?? "Expo sign-in did not finish. Try again.";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=expo-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expo-account.js","sourceRoot":"","sources":["../src/expo-account.ts"],"names":[],"mappings":"AAuCA,sDAAsD;AACtD,MAAM,UAAU,iBAAiB,CAAC,MAAqC;IACrE,OAAO,MAAM,EAAE,KAAK,KAAK,SAAS,IAAI,MAAM,EAAE,KAAK,KAAK,WAAW,IAAI,MAAM,EAAE,KAAK,KAAK,YAAY,CAAC;AACxG,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,MAAyB;IAC1D,QAAQ,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,SAAS,EAAE,OAAO,yCAAyC,CAAC;QACjE,KAAK,WAAW,EAAE,OAAO,4BAA4B,CAAC;QACtD,KAAK,YAAY,EAAE,OAAO,gDAAgD,CAAC;QAC3E,KAAK,MAAM,EAAE,OAAO,MAAM,CAAC,OAAO,IAAI,oBAAoB,CAAC;QAC3D,KAAK,WAAW,EAAE,OAAO,6BAA6B,CAAC;QACvD,KAAK,QAAQ,EAAE,OAAO,MAAM,CAAC,OAAO,IAAI,yCAAyC,CAAC;IACpF,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export type { BrowserLoginRequest, BrowserLoginSnapshot, BrowserLoginCookie } from "./browser-login";
|
|
2
|
-
export type { ProjectPreview, ProjectPreviewSnapshot } from "./project-preview";
|
|
3
|
-
export { PROJECT_PREVIEW_RESTART_MESSAGE } from "./project-preview.js";
|
|
2
|
+
export type { PreviewLevel, ProjectPreview, ProjectPreviewSnapshot, SimulatorStream, SimulatorStreamProvider } from "./project-preview";
|
|
3
|
+
export { inlinePreviewUrl, PREVIEW_LEVEL_LABEL, PROJECT_PREVIEW_RESTART_MESSAGE, PROJECT_PREVIEW_SIMULATOR_PATH, previewLevels, simulatorStatusText } from "./project-preview.js";
|
|
4
|
+
export type { ExpoAccountSnapshot, ExpoConnectState, ExpoConnectStatus } from "./expo-account";
|
|
5
|
+
export { expoConnectActive, expoConnectMessage } from "./expo-account.js";
|
|
4
6
|
export type OmgSessionStatus = "ok" | "blocked";
|
|
5
|
-
export type OmgSessionStatusReason = "model_unavailable" | "out_of_credits" | "provider_auth" | "provider_error" | null;
|
|
7
|
+
export type OmgSessionStatusReason = "model_unavailable" | "out_of_credits" | "provider_auth" | "provider_error" | "interrupted" | "out_of_memory" | null;
|
|
6
8
|
export interface OmgSession {
|
|
7
9
|
agent?: string;
|
|
8
10
|
agentLabel?: string | null;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,cAAc,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { PROJECT_PREVIEW_RESTART_MESSAGE } from "./project-preview.js";
|
|
1
|
+
export { inlinePreviewUrl, PREVIEW_LEVEL_LABEL, PROJECT_PREVIEW_RESTART_MESSAGE, PROJECT_PREVIEW_SIMULATOR_PATH, previewLevels, simulatorStatusText } from "./project-preview.js";
|
|
2
|
+
export { expoConnectActive, expoConnectMessage } from "./expo-account.js";
|
|
2
3
|
export * from "./session-mention-token.js";
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAElL,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA8Q1E,cAAc,4BAA4B,CAAC"}
|
|
@@ -27,7 +27,107 @@ export interface ProjectPreviewSnapshot {
|
|
|
27
27
|
expired?: boolean;
|
|
28
28
|
/** True when the preview has not answered on its port even once. Clients hide the card until then. */
|
|
29
29
|
starting?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Level 2 of the preview card: an iOS Simulator streamed into the page.
|
|
32
|
+
* Present only when the Computer has the simulator flag on
|
|
33
|
+
* (`LFG_PREVIEW_SIMULATOR=1`) and the preview is an Expo app. Clients show
|
|
34
|
+
* the "Simulator" level only when this field is present.
|
|
35
|
+
*/
|
|
36
|
+
simulator?: SimulatorStream;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The three levels of one preview card. "web" is Expo Web from the same Metro
|
|
40
|
+
* server, "simulator" is a streamed iOS Simulator, "device" is Expo Go on the
|
|
41
|
+
* user's own phone. A future "install" level (a signed build for the user's
|
|
42
|
+
* device) goes after "device".
|
|
43
|
+
*/
|
|
44
|
+
export type PreviewLevel = "web" | "simulator" | "device";
|
|
45
|
+
/**
|
|
46
|
+
* One streamed simulator for one preview. The card embeds `streamUrl` (an
|
|
47
|
+
* iframe on the web, a WebView in the app). That page draws the screen and
|
|
48
|
+
* sends taps, typing and swipes itself, so the card needs no input protocol.
|
|
49
|
+
* Until the state is "ready", the card keeps the web preview (level 1) under
|
|
50
|
+
* a status overlay, so the user never sees a blank frame.
|
|
51
|
+
*/
|
|
52
|
+
export interface SimulatorStream {
|
|
53
|
+
/**
|
|
54
|
+
* idle: nothing allocated; the card offers "Start simulator".
|
|
55
|
+
* queued: every simulator is busy. Normal, not an error; see `queuePosition`.
|
|
56
|
+
* starting: allocated, booting or opening the app; see `phase`.
|
|
57
|
+
* ready: `streamUrl` works now.
|
|
58
|
+
* unavailable: no simulator can serve this user now; show `message`.
|
|
59
|
+
* error: the last start failed; show `message` and offer a retry.
|
|
60
|
+
*/
|
|
61
|
+
state: "idle" | "queued" | "starting" | "ready" | "unavailable" | "error";
|
|
62
|
+
/**
|
|
63
|
+
* Identity of the allocated stream. The card reloads its frame only when
|
|
64
|
+
* this changes, not when the token inside `streamUrl` rotates. The stream
|
|
65
|
+
* page renews its own token before `expiresAt`.
|
|
66
|
+
*/
|
|
67
|
+
streamId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* HTTPS page that shows the stream and takes input (touch and mouse). It
|
|
70
|
+
* carries a short-lived token scoped to this user and session. Its origin
|
|
71
|
+
* must allow the omg.dev apps as frame ancestors. Required when "ready".
|
|
72
|
+
*/
|
|
73
|
+
streamUrl?: string;
|
|
74
|
+
/** When the token in `streamUrl` stops working, in epoch milliseconds. */
|
|
75
|
+
expiresAt?: number;
|
|
76
|
+
/** 1 is next. Only when "queued". */
|
|
77
|
+
queuePosition?: number;
|
|
78
|
+
/** Estimated wait until "ready", in milliseconds. "queued" or "starting". */
|
|
79
|
+
etaMs?: number;
|
|
80
|
+
/** The current start step. Only when "starting". Openurl to first frame takes 19 to 54 s, so the card names the step. */
|
|
81
|
+
phase?: "allocating" | "booting" | "opening" | "loading_bundle";
|
|
82
|
+
/** Start progress from 0 to 1, when the provider can tell. */
|
|
83
|
+
progress?: number;
|
|
84
|
+
/** One plain sentence for the user when `state` is "unavailable" or "error". */
|
|
85
|
+
message?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The owner of level 2. The Computer calls it; the card never talks to it
|
|
89
|
+
* directly, and the Computer never holds a Mac credential: the provider calls
|
|
90
|
+
* the control plane with the Computer's binding credential.
|
|
91
|
+
*
|
|
92
|
+
* Release rule: the card polls the snapshot about every 3 seconds, and only
|
|
93
|
+
* while its page is visible. A backgrounded mobile tab sends no unload
|
|
94
|
+
* event, so `stop` is best effort. The provider frees a simulator when it has
|
|
95
|
+
* had no `status` call and no stream viewer for 60 seconds.
|
|
96
|
+
*
|
|
97
|
+
* `preview` carries the Metro URL (`url`) and the Expo Go link (`expoGoUrl`)
|
|
98
|
+
* that the simulator must open.
|
|
99
|
+
*/
|
|
100
|
+
export interface SimulatorStreamProvider {
|
|
101
|
+
/**
|
|
102
|
+
* Cheap; called on every card poll. With `autoStart`, the provider may
|
|
103
|
+
* start a simulator from here when Metro is ready, so the user sees the
|
|
104
|
+
* phone without a tap.
|
|
105
|
+
*/
|
|
106
|
+
status(preview: ProjectPreview): Promise<SimulatorStream>;
|
|
107
|
+
/** The user tapped "Start simulator". Returns the new state: "queued" or "starting". */
|
|
108
|
+
start(preview: ProjectPreview): Promise<SimulatorStream>;
|
|
109
|
+
/** The user left the Simulator level. Best effort; see the release rule. */
|
|
110
|
+
stop(preview: ProjectPreview): Promise<void>;
|
|
111
|
+
/** Start from `status` without a tap. Default off. */
|
|
112
|
+
autoStart?: boolean;
|
|
30
113
|
}
|
|
114
|
+
/** Card action for level 2: POST with `{ sessionId, action: "start" | "stop" }`. Answers with a SimulatorStream. */
|
|
115
|
+
export declare const PROJECT_PREVIEW_SIMULATOR_PATH = "/api/project-preview/simulator";
|
|
31
116
|
/** Message a preview card sends to ask the session agent to start the preview again. */
|
|
32
117
|
export declare const PROJECT_PREVIEW_RESTART_MESSAGE = "The preview stopped. Restart it: start the development server again and expose it with omg_expose_port. For an Expo app, request a new Expo Go link.";
|
|
118
|
+
/** One line for the card while level 2 is not ready. Null when the stream shows. */
|
|
119
|
+
export declare function simulatorStatusText(stream: SimulatorStream): string | null;
|
|
120
|
+
/** The levels a card offers, in order. "simulator" only when the Computer sends its state. */
|
|
121
|
+
export declare function previewLevels(snapshot: Pick<ProjectPreviewSnapshot, "simulator">): PreviewLevel[];
|
|
122
|
+
/** Tab labels, shared by the web and native cards. */
|
|
123
|
+
export declare const PREVIEW_LEVEL_LABEL: Record<PreviewLevel, string>;
|
|
124
|
+
/**
|
|
125
|
+
* The URL an inline frame loads for the web level. The owner URL (`url`)
|
|
126
|
+
* needs the preview sign-in cookie, and an embedded frame does not get it:
|
|
127
|
+
* it is a third-party cookie inside app.omg.dev and inside the app's WebView,
|
|
128
|
+
* so the frame showed "Sign in to continue". The Expo Go host is a signed,
|
|
129
|
+
* short-lived capability URL for the same Metro port, and Metro answers it
|
|
130
|
+
* with the Expo Web page. A plain web preview has no such host and keeps `url`.
|
|
131
|
+
*/
|
|
132
|
+
export declare function inlinePreviewUrl(preview: Pick<ProjectPreview, "url" | "expoGoUrl">): string;
|
|
33
133
|
//# sourceMappingURL=project-preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-preview.d.ts","sourceRoot":"","sources":["../src/project-preview.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,yHAAyH;IACzH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"project-preview.d.ts","sourceRoot":"","sources":["../src/project-preview.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC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ACxF,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACzD,4EAA4E;IAC5E,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,sDAAsD;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,oHAAoH;AACpH,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAE/E,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,yJAC4G,CAAC;AASzJ,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAU1E;AAED,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,WAAW,CAAC,GAAG,YAAY,EAAE,CAEjG;AAED,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI5D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,WAAW,CAAC,GAAG,MAAM,CAE3F"}
|
package/dist/project-preview.js
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
/** Card action for level 2: POST with `{ sessionId, action: "start" | "stop" }`. Answers with a SimulatorStream. */
|
|
2
|
+
export const PROJECT_PREVIEW_SIMULATOR_PATH = "/api/project-preview/simulator";
|
|
1
3
|
/** Message a preview card sends to ask the session agent to start the preview again. */
|
|
2
4
|
export const PROJECT_PREVIEW_RESTART_MESSAGE = "The preview stopped. Restart it: start the development server again and expose it with omg_expose_port. For an Expo app, request a new Expo Go link.";
|
|
5
|
+
const SIMULATOR_PHASE_TEXT = {
|
|
6
|
+
allocating: "Finding a free iPhone simulator…",
|
|
7
|
+
booting: "Starting the iPhone simulator…",
|
|
8
|
+
opening: "Opening your app…",
|
|
9
|
+
loading_bundle: "Loading your app…",
|
|
10
|
+
};
|
|
11
|
+
/** One line for the card while level 2 is not ready. Null when the stream shows. */
|
|
12
|
+
export function simulatorStatusText(stream) {
|
|
13
|
+
const eta = stream.etaMs && stream.etaMs > 0 ? ` About ${Math.max(1, Math.round(stream.etaMs / 1000))} s.` : "";
|
|
14
|
+
switch (stream.state) {
|
|
15
|
+
case "ready": return stream.streamUrl ? null : "Opening the simulator…";
|
|
16
|
+
case "idle": return "See your app on an iPhone simulator.";
|
|
17
|
+
case "queued": return `All simulators are busy. You are number ${stream.queuePosition ?? 1} in line.${eta}`;
|
|
18
|
+
case "starting": return `${stream.phase ? SIMULATOR_PHASE_TEXT[stream.phase] : "Starting the iPhone simulator…"}${eta}`;
|
|
19
|
+
case "unavailable": return stream.message ?? "The simulator is not available now.";
|
|
20
|
+
case "error": return stream.message ?? "The simulator did not start.";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** The levels a card offers, in order. "simulator" only when the Computer sends its state. */
|
|
24
|
+
export function previewLevels(snapshot) {
|
|
25
|
+
return snapshot.simulator ? ["web", "simulator", "device"] : ["web", "device"];
|
|
26
|
+
}
|
|
27
|
+
/** Tab labels, shared by the web and native cards. */
|
|
28
|
+
export const PREVIEW_LEVEL_LABEL = {
|
|
29
|
+
web: "Web",
|
|
30
|
+
simulator: "Simulator",
|
|
31
|
+
device: "Your phone",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The URL an inline frame loads for the web level. The owner URL (`url`)
|
|
35
|
+
* needs the preview sign-in cookie, and an embedded frame does not get it:
|
|
36
|
+
* it is a third-party cookie inside app.omg.dev and inside the app's WebView,
|
|
37
|
+
* so the frame showed "Sign in to continue". The Expo Go host is a signed,
|
|
38
|
+
* short-lived capability URL for the same Metro port, and Metro answers it
|
|
39
|
+
* with the Expo Web page. A plain web preview has no such host and keeps `url`.
|
|
40
|
+
*/
|
|
41
|
+
export function inlinePreviewUrl(preview) {
|
|
42
|
+
return preview.expoGoUrl?.startsWith("exps://") ? `https://${preview.expoGoUrl.slice("exps://".length)}` : preview.url;
|
|
43
|
+
}
|
|
3
44
|
//# sourceMappingURL=project-preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-preview.js","sourceRoot":"","sources":["../src/project-preview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-preview.js","sourceRoot":"","sources":["../src/project-preview.ts"],"names":[],"mappings":"AAsHA,oHAAoH;AACpH,MAAM,CAAC,MAAM,8BAA8B,GAAG,gCAAgC,CAAC;AAE/E,wFAAwF;AACxF,MAAM,CAAC,MAAM,+BAA+B,GAC1C,sJAAsJ,CAAC;AAEzJ,MAAM,oBAAoB,GAA0D;IAClF,UAAU,EAAE,kCAAkC;IAC9C,OAAO,EAAE,gCAAgC;IACzC,OAAO,EAAE,mBAAmB;IAC5B,cAAc,EAAE,mBAAmB;CACpC,CAAC;AAEF,oFAAoF;AACpF,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IACzD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAChH,QAAQ,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,OAAO,EAAE,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC;QACxE,KAAK,MAAM,EAAE,OAAO,sCAAsC,CAAC;QAC3D,KAAK,QAAQ,EAAE,OAAO,2CAA2C,MAAM,CAAC,aAAa,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAC5G,KAAK,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gCAAgC,GAAG,GAAG,EAAE,CAAC;QACxH,KAAK,aAAa,EAAE,OAAO,MAAM,CAAC,OAAO,IAAI,qCAAqC,CAAC;QACnF,KAAK,OAAO,EAAE,OAAO,MAAM,CAAC,OAAO,IAAI,8BAA8B,CAAC;IACxE,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,aAAa,CAAC,QAAmD;IAC/E,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAiC;IAC/D,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,YAAY;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAkD;IACjF,OAAO,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;AACzH,CAAC"}
|
|
@@ -31,7 +31,10 @@ export type ParsedSessionMention = {
|
|
|
31
31
|
};
|
|
32
32
|
/** Titles are free text and may contain link-ending characters. */
|
|
33
33
|
export declare function sanitizeSessionLabel(title: string): string;
|
|
34
|
-
export declare function formatSessionMentionToken(sessionId: string, title: string): string;
|
|
34
|
+
export declare function formatSessionMentionToken(sessionId: string, title: string, kind?: "session" | "thread"): string;
|
|
35
|
+
export declare function formatThreadMentionToken(threadId: string, title: string): string;
|
|
36
|
+
/** The thread id inside an `omg:thread_` link, or null for any other href. */
|
|
37
|
+
export declare function threadRefFromHref(href: string): string | null;
|
|
35
38
|
/** The short ref inside an `omg:session_` link, or null for any other href. */
|
|
36
39
|
export declare function sessionRefFromHref(href: string): string | null;
|
|
37
40
|
/** Every reference in `text`, first-appearance order, one entry per session. */
|
|
@@ -50,6 +53,16 @@ export type SessionIds = {
|
|
|
50
53
|
nativeSessionId?: string | null;
|
|
51
54
|
/** Shown in place of a bare id when a reference is rendered. */
|
|
52
55
|
title?: string | null;
|
|
56
|
+
/** Agent kind, for the icon on a rendered reference. */
|
|
57
|
+
agent?: string | null;
|
|
58
|
+
/** Project name, shown as a badge on a rendered reference. */
|
|
59
|
+
project?: string | null;
|
|
60
|
+
};
|
|
61
|
+
/** What a rendered reference shows. Stable per ref, so React can compare it. */
|
|
62
|
+
export type SessionRefLabel = {
|
|
63
|
+
title: string | null;
|
|
64
|
+
agent: string | null;
|
|
65
|
+
project: string | null;
|
|
53
66
|
};
|
|
54
67
|
/** The subset of OmgClient a reference lookup needs, so tests can fake it. */
|
|
55
68
|
export type SessionRefClient = {
|
|
@@ -92,12 +105,11 @@ export declare function createSessionRefOpener(deps: {
|
|
|
92
105
|
/** True when `href` was a session reference and has been taken over. */
|
|
93
106
|
open(href: string): boolean;
|
|
94
107
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* keeps showing the id.
|
|
108
|
+
* Title and agent for `ref`, or null while unknown. The first call for a
|
|
109
|
+
* ref starts one lookup; `subscribe` fires when it lands. A ref that names
|
|
110
|
+
* no session stays null so the caller keeps showing the id.
|
|
99
111
|
*/
|
|
100
|
-
label(ref: string):
|
|
112
|
+
label(ref: string): SessionRefLabel | null;
|
|
101
113
|
subscribe(listener: () => void): () => void;
|
|
102
114
|
};
|
|
103
115
|
//# sourceMappingURL=session-mention-token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-mention-token.d.ts","sourceRoot":"","sources":["../src/session-mention-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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I,EAAE,UAAU,EAAE,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEvF;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAc5B;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAExB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAChF,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;IAChD,wEAAwE;IACxE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;IAC3C,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C,CA6EA"}
|
|
@@ -35,11 +35,29 @@ export function sessionMentionPattern() {
|
|
|
35
35
|
export function sanitizeSessionLabel(title) {
|
|
36
36
|
return title.replace(/[[\]()\r\n]/g, " ").replace(/\s+/g, " ").trim();
|
|
37
37
|
}
|
|
38
|
-
export function formatSessionMentionToken(sessionId, title) {
|
|
38
|
+
export function formatSessionMentionToken(sessionId, title, kind = "session") {
|
|
39
|
+
if (kind === "thread")
|
|
40
|
+
return formatThreadMentionToken(sessionId, title);
|
|
39
41
|
const ref = shortSessionRef(sessionId);
|
|
40
42
|
const label = sanitizeSessionLabel(title) || ref;
|
|
41
43
|
return `[#${label}](omg:session_${ref})`;
|
|
42
44
|
}
|
|
45
|
+
// ---- Threads ---------------------------------------------------------------
|
|
46
|
+
//
|
|
47
|
+
// A thread is referenced the same way, `[#Thread title](omg:thread_<id>)`, so
|
|
48
|
+
// the `#` picker can offer both. The id is the full one: a thread link is
|
|
49
|
+
// opened by a client, which has no prefix lookup for threads, and an agent
|
|
50
|
+
// passes it to the thread tools as written (they accept a prefix too).
|
|
51
|
+
const THREAD_ID = "[0-9a-fA-F-]{8,36}";
|
|
52
|
+
export function formatThreadMentionToken(threadId, title) {
|
|
53
|
+
const label = sanitizeSessionLabel(title) || threadId.slice(0, SHORT_LEN);
|
|
54
|
+
return `[#${label}](omg:thread_${threadId})`;
|
|
55
|
+
}
|
|
56
|
+
/** The thread id inside an `omg:thread_` link, or null for any other href. */
|
|
57
|
+
export function threadRefFromHref(href) {
|
|
58
|
+
const match = href.match(new RegExp(`^omg:thread_(${THREAD_ID})$`));
|
|
59
|
+
return match ? match[1] : null;
|
|
60
|
+
}
|
|
43
61
|
/** The short ref inside an `omg:session_` link, or null for any other href. */
|
|
44
62
|
export function sessionRefFromHref(href) {
|
|
45
63
|
const match = href.match(new RegExp(`^omg:session_(${SESSION_REF})$`));
|
|
@@ -142,6 +160,13 @@ export function createSessionRefOpener(deps) {
|
|
|
142
160
|
let generation = 0;
|
|
143
161
|
// Titles belong to the registered client: a switch clears them.
|
|
144
162
|
let labels = new Map();
|
|
163
|
+
const toLabel = (session) => session
|
|
164
|
+
? {
|
|
165
|
+
title: session.title?.trim() || null,
|
|
166
|
+
agent: session.agent?.trim() || null,
|
|
167
|
+
project: session.project?.trim() || null,
|
|
168
|
+
}
|
|
169
|
+
: null;
|
|
145
170
|
const pending = new Set();
|
|
146
171
|
const listeners = new Set();
|
|
147
172
|
const notify = () => {
|
|
@@ -169,9 +194,9 @@ export function createSessionRefOpener(deps) {
|
|
|
169
194
|
return null;
|
|
170
195
|
const known = findSessionRef(ref, client.peekSessions());
|
|
171
196
|
if (known) {
|
|
172
|
-
const
|
|
173
|
-
labels.set(key,
|
|
174
|
-
return
|
|
197
|
+
const found = toLabel(known);
|
|
198
|
+
labels.set(key, found);
|
|
199
|
+
return found;
|
|
175
200
|
}
|
|
176
201
|
if (pending.has(key))
|
|
177
202
|
return null;
|
|
@@ -184,7 +209,7 @@ export function createSessionRefOpener(deps) {
|
|
|
184
209
|
if (current !== client || generation !== startedAt)
|
|
185
210
|
return;
|
|
186
211
|
pending.delete(key);
|
|
187
|
-
labels.set(key, session
|
|
212
|
+
labels.set(key, toLabel(session));
|
|
188
213
|
notify();
|
|
189
214
|
});
|
|
190
215
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-mention-token.js","sourceRoot":"","sources":["../src/session-mention-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,+EAA+E,CAAC;AAClG,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,MAAM,CAAC,4CAA4C,WAAW,MAAM,EAAE,GAAG,CAAC,CAAC;AACxF,CAAC;AAQD,mEAAmE;AACnE,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,GAA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CAAC;QACD,SAAS,CAAC,QAAQ;YAChB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE;gBACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI;YACP,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,GAAG;gBAAE,OAAO,KAAK,CAAC;YACvB,MAAM,MAAM,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,MAAM,SAAS,GAAG,UAAU,CAAC;YAC7B,OAAO,CAAC,OAAO,EAAE;iBACd,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;iBAChC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACb,IAAI,IAAI,IAAI,OAAO,KAAK,MAAM,IAAI,UAAU,KAAK,SAAS;oBAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAClF,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threads on the wire, and the rules every client draws them with.
|
|
3
|
+
*
|
|
4
|
+
* One owner for the server (src/threads.ts), iOS and the web app. A thread is
|
|
5
|
+
* people-first chat with no agent behind it; omg joins only on `@omg`, and a
|
|
6
|
+
* task it starts is drawn as a card whose state is decided by
|
|
7
|
+
* `taskCardState` below. Keeping that rule here is what stops the phone and
|
|
8
|
+
* the web from disagreeing about whether a task "needs you".
|
|
9
|
+
*/
|
|
10
|
+
export type ThreadAuthor = {
|
|
11
|
+
kind: "human";
|
|
12
|
+
participantId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "omg";
|
|
16
|
+
};
|
|
17
|
+
export type ThreadTaskEvent = "started" | "finished" | "blocked" | "failed";
|
|
18
|
+
export type ThreadMessage = {
|
|
19
|
+
id: string;
|
|
20
|
+
threadId: string;
|
|
21
|
+
ts: number;
|
|
22
|
+
author: ThreadAuthor;
|
|
23
|
+
text: string;
|
|
24
|
+
/** Present on omg's task messages: which task, and what happened to it. */
|
|
25
|
+
task?: {
|
|
26
|
+
sessionId: string;
|
|
27
|
+
event: ThreadTaskEvent;
|
|
28
|
+
title?: string | null;
|
|
29
|
+
project?: string | null;
|
|
30
|
+
agent?: string | null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The top-level message this is a reply to, as in Slack. omg always answers
|
|
34
|
+
* in the replies of the message that mentioned it, and a task's updates go
|
|
35
|
+
* to the same replies. Absent: a top-level message.
|
|
36
|
+
*/
|
|
37
|
+
replyTo?: string | null;
|
|
38
|
+
/** Pictures, videos and files, drawn under the text as the session chat draws them. */
|
|
39
|
+
media?: ThreadMedia[];
|
|
40
|
+
/** An agent session that posted this as omg (omg_send_thread_message). */
|
|
41
|
+
via?: {
|
|
42
|
+
sessionId: string;
|
|
43
|
+
title?: string | null;
|
|
44
|
+
agent?: string | null;
|
|
45
|
+
};
|
|
46
|
+
/** Client only: sent, not yet stored. */
|
|
47
|
+
pending?: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* One picture, video or file in a message. `path` is served by the machine
|
|
51
|
+
* (a thread file, or a task's artifact) and needs the same grant as any
|
|
52
|
+
* other box-served media.
|
|
53
|
+
*/
|
|
54
|
+
export type ThreadMedia = {
|
|
55
|
+
kind: "image" | "video" | "file";
|
|
56
|
+
path: string;
|
|
57
|
+
name?: string | null;
|
|
58
|
+
width?: number | null;
|
|
59
|
+
height?: number | null;
|
|
60
|
+
caption?: string | null;
|
|
61
|
+
};
|
|
62
|
+
/** What a file is, from its name or type, for how a message draws it. */
|
|
63
|
+
export declare function mediaKindFor(name: string, mimeType?: string | null): ThreadMedia["kind"];
|
|
64
|
+
/** Markdown down to the words, for one-line previews and notifications. */
|
|
65
|
+
export declare function plainText(markdown: string): string;
|
|
66
|
+
/** "Photo", "2 photos", "Video", "File": a message's media in a word, for a message with no text. */
|
|
67
|
+
export declare function mediaLabel(media: readonly ThreadMedia[] | undefined): string;
|
|
68
|
+
export type ThreadProject = {
|
|
69
|
+
cwd: string;
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
export type ThreadSummary = {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
createdAt: number;
|
|
76
|
+
updatedAt: number;
|
|
77
|
+
project: ThreadProject | null;
|
|
78
|
+
lastMessage: Pick<ThreadMessage, "author" | "text" | "ts" | "media"> | null;
|
|
79
|
+
};
|
|
80
|
+
export type ThreadTaskRow = {
|
|
81
|
+
sessionId: string;
|
|
82
|
+
title: string | null;
|
|
83
|
+
project: string | null;
|
|
84
|
+
busy: boolean;
|
|
85
|
+
status: string | null;
|
|
86
|
+
/** Not in the live session list any more. */
|
|
87
|
+
ended: boolean;
|
|
88
|
+
/** The coding agent running it, while it is live. */
|
|
89
|
+
agent?: string | null;
|
|
90
|
+
};
|
|
91
|
+
export type ThreadParticipant = {
|
|
92
|
+
id: string;
|
|
93
|
+
kind: string;
|
|
94
|
+
role?: string;
|
|
95
|
+
/** `avatar` is absolute (Gravatar) or box-relative (`/api/avatars/<file>`). */
|
|
96
|
+
display: {
|
|
97
|
+
name?: string | null;
|
|
98
|
+
fallback: string;
|
|
99
|
+
avatar?: string | null;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export type ThreadDetail = {
|
|
103
|
+
/** The caller's participant id, so a client can put their own bubbles on the right. */
|
|
104
|
+
me: string;
|
|
105
|
+
thread: ThreadSummary;
|
|
106
|
+
participants: ThreadParticipant[];
|
|
107
|
+
messages: ThreadMessage[];
|
|
108
|
+
tasks: ThreadTaskRow[];
|
|
109
|
+
/** Who is writing right now, the caller left out. Absent on a machine from before typing. */
|
|
110
|
+
typing?: ThreadTyping[];
|
|
111
|
+
/**
|
|
112
|
+
* Everyone `@` can name: the people on this machine and the thread's
|
|
113
|
+
* members. Naming someone who is not a member adds them. Absent on a
|
|
114
|
+
* machine from before; then only members are offered.
|
|
115
|
+
*/
|
|
116
|
+
people?: ThreadPerson[];
|
|
117
|
+
};
|
|
118
|
+
export type ThreadPerson = {
|
|
119
|
+
participantId: string;
|
|
120
|
+
name: string;
|
|
121
|
+
avatar?: string | null;
|
|
122
|
+
member: boolean;
|
|
123
|
+
};
|
|
124
|
+
/** Someone writing in a thread: a person at their keyboard, or omg preparing an answer. */
|
|
125
|
+
export type ThreadTyping = {
|
|
126
|
+
author: ThreadAuthor;
|
|
127
|
+
/** The top-level message whose replies they are writing in; null for the main list. */
|
|
128
|
+
replyTo: string | null;
|
|
129
|
+
};
|
|
130
|
+
export type TaskCardState = "working" | "needs-you" | "done" | "failed" | "ended";
|
|
131
|
+
export declare const TASK_STATE_LABEL: Record<TaskCardState, string>;
|
|
132
|
+
/** Only an explicit mention wakes omg. An address like x@omg.dev does not. */
|
|
133
|
+
export declare const OMG_MENTION: RegExp;
|
|
134
|
+
export declare function mentionsOmg(text: string): boolean;
|
|
135
|
+
/** The same id in either form: a full uuid or a short prefix. */
|
|
136
|
+
export declare function sameSession(a: string | null | undefined, b: string | null | undefined): boolean;
|
|
137
|
+
/** The newest event omg posted for a task. */
|
|
138
|
+
export declare function latestTaskEvent(messages: readonly ThreadMessage[], sessionId: string): ThreadTaskEvent | null;
|
|
139
|
+
/**
|
|
140
|
+
* A question waiting on the person wins over everything but a running turn.
|
|
141
|
+
* Then the live row: busy is working. An idle task is done once it has
|
|
142
|
+
* reported and working until then; a task gone from the list is its last
|
|
143
|
+
* report, or "ended".
|
|
144
|
+
*/
|
|
145
|
+
export declare function taskCardState(input: {
|
|
146
|
+
event: ThreadTaskEvent | null;
|
|
147
|
+
row: ThreadTaskRow | null | undefined;
|
|
148
|
+
openAsk: boolean;
|
|
149
|
+
}): TaskCardState;
|
|
150
|
+
/**
|
|
151
|
+
* Which messages draw a card. Each task is drawn once, at the message that
|
|
152
|
+
* started it; later messages about the same task are plain omg messages,
|
|
153
|
+
* because the card above already shows the live state.
|
|
154
|
+
*/
|
|
155
|
+
export declare function cardMessageIds(messages: readonly ThreadMessage[]): Set<string>;
|
|
156
|
+
/** One line for a thread row: who spoke last, and what they said. */
|
|
157
|
+
export declare function threadPreview(thread: Pick<ThreadSummary, "lastMessage">): string;
|
|
158
|
+
/** The task a message is about, as the card needs it. Pure, for both clients. */
|
|
159
|
+
export declare function taskCardFor(message: ThreadMessage, detail: Pick<ThreadDetail, "tasks">, messages: readonly ThreadMessage[], openAskSessionIds: readonly (string | null | undefined)[]): {
|
|
160
|
+
sessionId: string;
|
|
161
|
+
title: string;
|
|
162
|
+
project: string | null;
|
|
163
|
+
agent: string | null;
|
|
164
|
+
state: TaskCardState;
|
|
165
|
+
} | null;
|
|
166
|
+
/** Slack's rule: a message joins the one above when the same author wrote it within this long. */
|
|
167
|
+
export declare const THREAD_GROUP_MS: number;
|
|
168
|
+
/**
|
|
169
|
+
* Whether a message starts a new group: its own avatar, name and time. The
|
|
170
|
+
* rest of a group is just text under the first message.
|
|
171
|
+
*/
|
|
172
|
+
export declare function startsMessageGroup(previous: ThreadMessage | undefined, message: ThreadMessage): boolean;
|
|
173
|
+
/** A stable avatar colour for a person, from their participant id. */
|
|
174
|
+
export declare function authorHue(author: ThreadAuthor): number;
|
|
175
|
+
/**
|
|
176
|
+
* Which agent's mark an omg message wears: the agent whose words it carries.
|
|
177
|
+
* A task's result is that task's agent (remembered on the message, or the
|
|
178
|
+
* live task's for a result from before that); a message an agent session
|
|
179
|
+
* posted is that session's. omg's own replies, and the notes it writes when
|
|
180
|
+
* it starts or relays a task, are omg's: null.
|
|
181
|
+
*/
|
|
182
|
+
export declare function authorAgent(message: ThreadMessage, tasks?: readonly ThreadTaskRow[]): string | null;
|
|
183
|
+
export declare function authorName(author: ThreadAuthor): string;
|
|
184
|
+
/** Top-level messages: what the main list shows. */
|
|
185
|
+
export declare function topLevelMessages(messages: readonly ThreadMessage[]): ThreadMessage[];
|
|
186
|
+
/** The replies to one top-level message, oldest first. */
|
|
187
|
+
export declare function repliesTo(messages: readonly ThreadMessage[], rootId: string): ThreadMessage[];
|
|
188
|
+
export type ReplySummary = {
|
|
189
|
+
count: number;
|
|
190
|
+
lastTs: number;
|
|
191
|
+
/** Who replied, first reply first, each once. */
|
|
192
|
+
authors: ThreadAuthor[];
|
|
193
|
+
/** The task started in these replies, if any, for a state chip on the root. */
|
|
194
|
+
taskSessionId: string | null;
|
|
195
|
+
};
|
|
196
|
+
/** The "N replies" line under a top-level message, or null when it has none. */
|
|
197
|
+
export declare function replySummary(messages: readonly ThreadMessage[], rootId: string): ReplySummary | null;
|
|
198
|
+
/**
|
|
199
|
+
* Pull Home's list down past the refresh to start a thread. Distances in
|
|
200
|
+
* points (iOS) or CSS pixels (web). A normal refresh fires well before the
|
|
201
|
+
* first; the second arms the thread, and releasing then opens it.
|
|
202
|
+
*/
|
|
203
|
+
export declare const THREAD_PULL_HINT = 90;
|
|
204
|
+
export declare const THREAD_PULL_ARM = 150;
|
|
205
|
+
/** 0: nothing. 1: show "keep pulling". 2: armed, release starts a thread. */
|
|
206
|
+
export declare function threadPullStage(pull: number): 0 | 1 | 2;
|
|
207
|
+
/** Who `@` offers in a thread. omg is the one member that is not a person. */
|
|
208
|
+
export type ThreadMentionOption = {
|
|
209
|
+
id: string;
|
|
210
|
+
/** What follows the `@`, as typed and as shown. */
|
|
211
|
+
name: string;
|
|
212
|
+
hint: string;
|
|
213
|
+
kind: "omg" | "agent" | "person";
|
|
214
|
+
/** The coding agent's key, for an agent. */
|
|
215
|
+
agent?: string;
|
|
216
|
+
/** The participant, for a person. */
|
|
217
|
+
participantId?: string;
|
|
218
|
+
/** A person's photo, when they have one. */
|
|
219
|
+
avatar?: string | null;
|
|
220
|
+
};
|
|
221
|
+
export declare const THREAD_MENTIONS: readonly ThreadMentionOption[];
|
|
222
|
+
/** A coding agent as the machine lists it (GET /api/bootstrap, /api/coding-agents). */
|
|
223
|
+
export type MentionableAgent = {
|
|
224
|
+
key: string;
|
|
225
|
+
label: string;
|
|
226
|
+
visible?: boolean;
|
|
227
|
+
};
|
|
228
|
+
/** What you type after `@` for an agent: its label's first word. "Claude Code" and "claude" are both "claude". */
|
|
229
|
+
export declare function agentHandle(label: string): string;
|
|
230
|
+
/**
|
|
231
|
+
* The coding agents a thread can @: the ones the machine shows, one per
|
|
232
|
+
* handle (two Claude runtimes are one "@claude"), and never omg's own
|
|
233
|
+
* agent, whose handle would be taken by omg the teammate.
|
|
234
|
+
*/
|
|
235
|
+
export declare function mentionAgents(agents: readonly MentionableAgent[] | undefined): {
|
|
236
|
+
key: string;
|
|
237
|
+
handle: string;
|
|
238
|
+
}[];
|
|
239
|
+
/** Everything `@` offers in a thread: omg, the coding agents, and the other people in it. */
|
|
240
|
+
export declare function threadMentionOptions(agents: readonly MentionableAgent[] | undefined, participants: readonly ThreadParticipant[] | undefined, me?: string | null,
|
|
241
|
+
/** ThreadDetail.people: everyone on the machine. Without it, the members. */
|
|
242
|
+
everyone?: readonly ThreadPerson[]): ThreadMentionOption[];
|
|
243
|
+
/** The coding agent a message asks by name, if any: the first `@handle` in it. */
|
|
244
|
+
export declare function mentionedAgent(text: string, agents: readonly {
|
|
245
|
+
key: string;
|
|
246
|
+
handle: string;
|
|
247
|
+
}[]): {
|
|
248
|
+
key: string;
|
|
249
|
+
handle: string;
|
|
250
|
+
} | null;
|
|
251
|
+
/**
|
|
252
|
+
* An `@word` being typed at the end of the text (the caret is taken to be at
|
|
253
|
+
* the end, as the phone's other pickers do): where it starts and what is
|
|
254
|
+
* typed so far. Null when the text does not end in a mention.
|
|
255
|
+
*/
|
|
256
|
+
export declare function threadMentionAt(text: string): {
|
|
257
|
+
start: number;
|
|
258
|
+
query: string;
|
|
259
|
+
} | null;
|
|
260
|
+
/** The mentions whose name starts with what is typed. */
|
|
261
|
+
export declare function matchThreadMentions(query: string, mentions?: readonly ThreadMentionOption[]): ThreadMentionOption[];
|
|
262
|
+
/** Replace the `@word` being typed with `@name `. */
|
|
263
|
+
export declare function applyThreadMention(text: string, at: {
|
|
264
|
+
start: number;
|
|
265
|
+
}, name: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* How to draw a message's author: the participant's current name and photo
|
|
268
|
+
* when the thread knows them (the server fills both from the roster), else
|
|
269
|
+
* the name the message was written under. omg has no photo; it wears its mark.
|
|
270
|
+
*/
|
|
271
|
+
export declare function authorView(author: ThreadAuthor, participants: readonly ThreadParticipant[] | undefined): {
|
|
272
|
+
name: string;
|
|
273
|
+
avatar: string | null;
|
|
274
|
+
};
|
|
275
|
+
/** A person's typing ping lasts this long, so a closed tab stops showing as typing. */
|
|
276
|
+
export declare const THREAD_TYPING_TTL_MS = 6000;
|
|
277
|
+
/** While the field has text, a client repeats its ping this often. */
|
|
278
|
+
export declare const THREAD_TYPING_PING_MS = 3000;
|
|
279
|
+
/**
|
|
280
|
+
* Who shows as typing in one view. The replies of `rootId`, or the main list
|
|
281
|
+
* when it is null. omg always answers in replies, so the main list also shows
|
|
282
|
+
* omg when it is answering anywhere: otherwise an @omg asked from the main
|
|
283
|
+
* list would look ignored.
|
|
284
|
+
*/
|
|
285
|
+
export declare function typingIn(typing: readonly ThreadTyping[] | undefined, rootId: string | null): ThreadTyping[];
|
|
286
|
+
/** "Alex is typing", "omg is typing", "Alex and Sam are typing", "Several people are typing". */
|
|
287
|
+
export declare function typingLabel(typing: readonly ThreadTyping[], participants?: readonly ThreadParticipant[]): string | null;
|
|
288
|
+
/**
|
|
289
|
+
* The client half of typing: feed it the field's text on every change. It
|
|
290
|
+
* sends `true` when text appears and again every THREAD_TYPING_PING_MS while
|
|
291
|
+
* it stays, and `false` once when the field empties. One owner for the
|
|
292
|
+
* throttle, shared by iOS and the web.
|
|
293
|
+
*/
|
|
294
|
+
export declare function typingPinger(send: (typing: boolean) => void, now?: () => number): (text: string) => void;
|
|
295
|
+
/** Who a mention link names: "omg", or a participant id. Null for any other link. */
|
|
296
|
+
export declare function mentionFromHref(href: string | null | undefined): string | null;
|
|
297
|
+
/**
|
|
298
|
+
* A message with its `@omg` and `@Name` mentions made into links, so the
|
|
299
|
+
* markdown renderer on either client draws them as tags that can be tapped.
|
|
300
|
+
* Code is left as written, and so is an address (`x@omg.dev`): a mention
|
|
301
|
+
* starts a word.
|
|
302
|
+
*/
|
|
303
|
+
export declare function linkMentions(text: string, participants: readonly ThreadParticipant[] | undefined,
|
|
304
|
+
/** The coding agents' handles (mentionAgents), tagged as `agent:<handle>`. */
|
|
305
|
+
agentHandles?: readonly string[]): string;
|
|
306
|
+
/**
|
|
307
|
+
* The people a message names with `@Name`, by participant id: the rule
|
|
308
|
+
* linkMentions draws with, so what is highlighted is who is notified.
|
|
309
|
+
*/
|
|
310
|
+
export declare function mentionedPeople(text: string, people: readonly {
|
|
311
|
+
participantId: string;
|
|
312
|
+
name: string;
|
|
313
|
+
}[]): string[];
|
|
314
|
+
//# sourceMappingURL=threads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../src/threads.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5E,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,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MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,EAAE,CASlH"}
|
package/dist/threads.js
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threads on the wire, and the rules every client draws them with.
|
|
3
|
+
*
|
|
4
|
+
* One owner for the server (src/threads.ts), iOS and the web app. A thread is
|
|
5
|
+
* people-first chat with no agent behind it; omg joins only on `@omg`, and a
|
|
6
|
+
* task it starts is drawn as a card whose state is decided by
|
|
7
|
+
* `taskCardState` below. Keeping that rule here is what stops the phone and
|
|
8
|
+
* the web from disagreeing about whether a task "needs you".
|
|
9
|
+
*/
|
|
10
|
+
const IMAGE_EXT = /\.(png|jpe?g|gif|webp|heic|heif|avif|bmp)$/i;
|
|
11
|
+
const VIDEO_EXT = /\.(mp4|m4v|mov|webm)$/i;
|
|
12
|
+
/** What a file is, from its name or type, for how a message draws it. */
|
|
13
|
+
export function mediaKindFor(name, mimeType) {
|
|
14
|
+
const type = (mimeType ?? "").toLowerCase();
|
|
15
|
+
if (type.startsWith("image/") || IMAGE_EXT.test(name))
|
|
16
|
+
return "image";
|
|
17
|
+
if (type.startsWith("video/") || VIDEO_EXT.test(name))
|
|
18
|
+
return "video";
|
|
19
|
+
return "file";
|
|
20
|
+
}
|
|
21
|
+
/** Markdown down to the words, for one-line previews and notifications. */
|
|
22
|
+
export function plainText(markdown) {
|
|
23
|
+
return markdown
|
|
24
|
+
.replace(/```[\s\S]*?```/g, " ")
|
|
25
|
+
.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1")
|
|
26
|
+
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
|
|
27
|
+
.replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+[.)])\s+/gm, "")
|
|
28
|
+
.replace(/(\*\*|__|~~|`)/g, "")
|
|
29
|
+
.replace(/(^|\s)[*_]([^*_\s][^*_]*)[*_](?=\s|$|[.,!?;:])/g, "$1$2")
|
|
30
|
+
.replace(/\s+/g, " ")
|
|
31
|
+
.trim();
|
|
32
|
+
}
|
|
33
|
+
/** "Photo", "2 photos", "Video", "File": a message's media in a word, for a message with no text. */
|
|
34
|
+
export function mediaLabel(media) {
|
|
35
|
+
if (!media?.length)
|
|
36
|
+
return "";
|
|
37
|
+
const kind = media.every((row) => row.kind === media[0].kind) ? media[0].kind : "file";
|
|
38
|
+
const word = kind === "image" ? "photo" : kind === "video" ? "video" : "file";
|
|
39
|
+
const label = media.length === 1 ? word : `${media.length} ${word}s`;
|
|
40
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
41
|
+
}
|
|
42
|
+
export const TASK_STATE_LABEL = {
|
|
43
|
+
working: "Working",
|
|
44
|
+
"needs-you": "Needs you",
|
|
45
|
+
done: "Done",
|
|
46
|
+
failed: "Failed",
|
|
47
|
+
ended: "Ended",
|
|
48
|
+
};
|
|
49
|
+
/** Only an explicit mention wakes omg. An address like x@omg.dev does not. */
|
|
50
|
+
export const OMG_MENTION = /(^|[^\w@])@omg\b/i;
|
|
51
|
+
export function mentionsOmg(text) {
|
|
52
|
+
return OMG_MENTION.test(text);
|
|
53
|
+
}
|
|
54
|
+
/** The same id in either form: a full uuid or a short prefix. */
|
|
55
|
+
export function sameSession(a, b) {
|
|
56
|
+
if (!a || !b)
|
|
57
|
+
return false;
|
|
58
|
+
const x = a.toLowerCase();
|
|
59
|
+
const y = b.toLowerCase();
|
|
60
|
+
return x === y || (x.length >= 8 && y.startsWith(x)) || (y.length >= 8 && x.startsWith(y));
|
|
61
|
+
}
|
|
62
|
+
/** The newest event omg posted for a task. */
|
|
63
|
+
export function latestTaskEvent(messages, sessionId) {
|
|
64
|
+
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
65
|
+
const task = messages[i].task;
|
|
66
|
+
if (task && sameSession(task.sessionId, sessionId))
|
|
67
|
+
return task.event;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A question waiting on the person wins over everything but a running turn.
|
|
73
|
+
* Then the live row: busy is working. An idle task is done once it has
|
|
74
|
+
* reported and working until then; a task gone from the list is its last
|
|
75
|
+
* report, or "ended".
|
|
76
|
+
*/
|
|
77
|
+
export function taskCardState(input) {
|
|
78
|
+
const waiting = input.openAsk || input.row?.status === "blocked" || input.event === "blocked";
|
|
79
|
+
if (waiting && !input.row?.busy)
|
|
80
|
+
return "needs-you";
|
|
81
|
+
if (input.row?.busy)
|
|
82
|
+
return "working";
|
|
83
|
+
if (input.event === "failed")
|
|
84
|
+
return "failed";
|
|
85
|
+
if (input.event === "finished")
|
|
86
|
+
return "done";
|
|
87
|
+
if (input.row && !input.row.ended)
|
|
88
|
+
return "working";
|
|
89
|
+
return "ended";
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Which messages draw a card. Each task is drawn once, at the message that
|
|
93
|
+
* started it; later messages about the same task are plain omg messages,
|
|
94
|
+
* because the card above already shows the live state.
|
|
95
|
+
*/
|
|
96
|
+
export function cardMessageIds(messages) {
|
|
97
|
+
const seen = new Set();
|
|
98
|
+
const ids = new Set();
|
|
99
|
+
for (const message of messages) {
|
|
100
|
+
const task = message.task;
|
|
101
|
+
if (!task)
|
|
102
|
+
continue;
|
|
103
|
+
const key = task.sessionId.toLowerCase();
|
|
104
|
+
if (seen.has(key))
|
|
105
|
+
continue;
|
|
106
|
+
seen.add(key);
|
|
107
|
+
ids.add(message.id);
|
|
108
|
+
}
|
|
109
|
+
return ids;
|
|
110
|
+
}
|
|
111
|
+
/** One line for a thread row: who spoke last, and what they said. */
|
|
112
|
+
export function threadPreview(thread) {
|
|
113
|
+
const last = thread.lastMessage;
|
|
114
|
+
if (!last)
|
|
115
|
+
return "No messages yet";
|
|
116
|
+
const who = last.author.kind === "omg" ? "omg" : last.author.name;
|
|
117
|
+
return `${who}: ${plainText(last.text) || mediaLabel(last.media)}`;
|
|
118
|
+
}
|
|
119
|
+
/** The task a message is about, as the card needs it. Pure, for both clients. */
|
|
120
|
+
export function taskCardFor(message, detail, messages, openAskSessionIds) {
|
|
121
|
+
const task = message.task;
|
|
122
|
+
if (!task)
|
|
123
|
+
return null;
|
|
124
|
+
const row = detail.tasks.find((t) => sameSession(t.sessionId, task.sessionId));
|
|
125
|
+
// A finished task is gone from the live list; its result remembers the agent.
|
|
126
|
+
const remembered = [...messages].reverse().find((m) => m.task?.agent && sameSession(m.task.sessionId, task.sessionId));
|
|
127
|
+
return {
|
|
128
|
+
sessionId: task.sessionId,
|
|
129
|
+
title: row?.title || task.title || "Task",
|
|
130
|
+
project: row?.project || task.project || null,
|
|
131
|
+
agent: row?.agent || remembered?.task?.agent || null,
|
|
132
|
+
state: taskCardState({
|
|
133
|
+
event: latestTaskEvent(messages, task.sessionId),
|
|
134
|
+
row,
|
|
135
|
+
openAsk: openAskSessionIds.some((id) => sameSession(task.sessionId, id)),
|
|
136
|
+
}),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** Slack's rule: a message joins the one above when the same author wrote it within this long. */
|
|
140
|
+
export const THREAD_GROUP_MS = 5 * 60_000;
|
|
141
|
+
/**
|
|
142
|
+
* Whether a message starts a new group: its own avatar, name and time. The
|
|
143
|
+
* rest of a group is just text under the first message.
|
|
144
|
+
*/
|
|
145
|
+
export function startsMessageGroup(previous, message) {
|
|
146
|
+
if (!previous)
|
|
147
|
+
return true;
|
|
148
|
+
if (message.ts - previous.ts > THREAD_GROUP_MS)
|
|
149
|
+
return true;
|
|
150
|
+
if (previous.author.kind !== message.author.kind)
|
|
151
|
+
return true;
|
|
152
|
+
if (message.author.kind === "human" && previous.author.kind === "human") {
|
|
153
|
+
return previous.author.participantId !== message.author.participantId;
|
|
154
|
+
}
|
|
155
|
+
// omg's note and then Claude's answer are two voices: each shows its own mark.
|
|
156
|
+
return authorAgent(previous) !== authorAgent(message);
|
|
157
|
+
}
|
|
158
|
+
/** A stable avatar colour for a person, from their participant id. */
|
|
159
|
+
export function authorHue(author) {
|
|
160
|
+
if (author.kind === "omg")
|
|
161
|
+
return 11;
|
|
162
|
+
let hash = 0;
|
|
163
|
+
for (const char of author.participantId)
|
|
164
|
+
hash = (hash * 31 + char.charCodeAt(0)) >>> 0;
|
|
165
|
+
return hash % 360;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Which agent's mark an omg message wears: the agent whose words it carries.
|
|
169
|
+
* A task's result is that task's agent (remembered on the message, or the
|
|
170
|
+
* live task's for a result from before that); a message an agent session
|
|
171
|
+
* posted is that session's. omg's own replies, and the notes it writes when
|
|
172
|
+
* it starts or relays a task, are omg's: null.
|
|
173
|
+
*/
|
|
174
|
+
export function authorAgent(message, tasks) {
|
|
175
|
+
if (message.author.kind !== "omg")
|
|
176
|
+
return null;
|
|
177
|
+
const task = message.task;
|
|
178
|
+
if (task && task.event !== "started") {
|
|
179
|
+
return task.agent || tasks?.find((row) => sameSession(row.sessionId, task.sessionId))?.agent || null;
|
|
180
|
+
}
|
|
181
|
+
return message.via?.agent || null;
|
|
182
|
+
}
|
|
183
|
+
export function authorName(author) {
|
|
184
|
+
return author.kind === "omg" ? "omg" : author.name;
|
|
185
|
+
}
|
|
186
|
+
/** Top-level messages: what the main list shows. */
|
|
187
|
+
export function topLevelMessages(messages) {
|
|
188
|
+
return messages.filter((message) => !message.replyTo);
|
|
189
|
+
}
|
|
190
|
+
/** The replies to one top-level message, oldest first. */
|
|
191
|
+
export function repliesTo(messages, rootId) {
|
|
192
|
+
return messages.filter((message) => message.replyTo === rootId);
|
|
193
|
+
}
|
|
194
|
+
/** The "N replies" line under a top-level message, or null when it has none. */
|
|
195
|
+
export function replySummary(messages, rootId) {
|
|
196
|
+
const replies = repliesTo(messages, rootId);
|
|
197
|
+
if (!replies.length)
|
|
198
|
+
return null;
|
|
199
|
+
const authors = [];
|
|
200
|
+
for (const reply of replies) {
|
|
201
|
+
const same = authors.some((a) => a.kind === reply.author.kind &&
|
|
202
|
+
(a.kind === "omg" || (reply.author.kind === "human" && a.participantId === reply.author.participantId)));
|
|
203
|
+
if (!same)
|
|
204
|
+
authors.push(reply.author);
|
|
205
|
+
}
|
|
206
|
+
const task = [...replies].reverse().find((reply) => reply.task)?.task ?? null;
|
|
207
|
+
return { count: replies.length, lastTs: replies[replies.length - 1].ts, authors, taskSessionId: task?.sessionId ?? null };
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Pull Home's list down past the refresh to start a thread. Distances in
|
|
211
|
+
* points (iOS) or CSS pixels (web). A normal refresh fires well before the
|
|
212
|
+
* first; the second arms the thread, and releasing then opens it.
|
|
213
|
+
*/
|
|
214
|
+
export const THREAD_PULL_HINT = 90;
|
|
215
|
+
export const THREAD_PULL_ARM = 150;
|
|
216
|
+
/** 0: nothing. 1: show "keep pulling". 2: armed, release starts a thread. */
|
|
217
|
+
export function threadPullStage(pull) {
|
|
218
|
+
if (pull >= THREAD_PULL_ARM)
|
|
219
|
+
return 2;
|
|
220
|
+
if (pull >= THREAD_PULL_HINT)
|
|
221
|
+
return 1;
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
export const THREAD_MENTIONS = [
|
|
225
|
+
{ id: "omg", name: "omg", hint: "Answer, or start a task", kind: "omg" },
|
|
226
|
+
];
|
|
227
|
+
/** What you type after `@` for an agent: its label's first word. "Claude Code" and "claude" are both "claude". */
|
|
228
|
+
export function agentHandle(label) {
|
|
229
|
+
return (label.trim().split(/\s+/)[0] ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The coding agents a thread can @: the ones the machine shows, one per
|
|
233
|
+
* handle (two Claude runtimes are one "@claude"), and never omg's own
|
|
234
|
+
* agent, whose handle would be taken by omg the teammate.
|
|
235
|
+
*/
|
|
236
|
+
export function mentionAgents(agents) {
|
|
237
|
+
const seen = new Set(["omg"]);
|
|
238
|
+
const out = [];
|
|
239
|
+
for (const agent of agents ?? []) {
|
|
240
|
+
const handle = agentHandle(agent.label);
|
|
241
|
+
if (agent.visible === false || agent.key === "omg" || !handle || seen.has(handle))
|
|
242
|
+
continue;
|
|
243
|
+
seen.add(handle);
|
|
244
|
+
out.push({ key: agent.key, handle });
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
/** Everything `@` offers in a thread: omg, the coding agents, and the other people in it. */
|
|
249
|
+
export function threadMentionOptions(agents, participants, me,
|
|
250
|
+
/** ThreadDetail.people: everyone on the machine. Without it, the members. */
|
|
251
|
+
everyone) {
|
|
252
|
+
const rows = everyone ??
|
|
253
|
+
(participants ?? []).flatMap((row) => {
|
|
254
|
+
const name = row.kind === "human" ? row.display.name?.trim() : null;
|
|
255
|
+
return name ? [{ participantId: row.id, name, avatar: row.display.avatar ?? null, member: true }] : [];
|
|
256
|
+
});
|
|
257
|
+
const people = rows
|
|
258
|
+
.filter((row) => row.participantId !== me && row.name.trim())
|
|
259
|
+
// Members first: they are who a reply is usually for.
|
|
260
|
+
.sort((a, b) => Number(b.member) - Number(a.member))
|
|
261
|
+
.map((row) => ({
|
|
262
|
+
id: row.participantId,
|
|
263
|
+
name: row.name.trim(),
|
|
264
|
+
hint: row.member ? "In this thread" : "Adds them to the thread",
|
|
265
|
+
kind: "person",
|
|
266
|
+
participantId: row.participantId,
|
|
267
|
+
avatar: row.avatar ?? null,
|
|
268
|
+
}));
|
|
269
|
+
return [
|
|
270
|
+
...THREAD_MENTIONS,
|
|
271
|
+
...mentionAgents(agents).map((agent) => ({
|
|
272
|
+
id: `agent:${agent.key}`,
|
|
273
|
+
name: agent.handle,
|
|
274
|
+
hint: `Start a task with ${agent.handle}`,
|
|
275
|
+
kind: "agent",
|
|
276
|
+
agent: agent.key,
|
|
277
|
+
})),
|
|
278
|
+
...people,
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
/** The coding agent a message asks by name, if any: the first `@handle` in it. */
|
|
282
|
+
export function mentionedAgent(text, agents) {
|
|
283
|
+
let best = null;
|
|
284
|
+
for (const agent of agents) {
|
|
285
|
+
const match = new RegExp(`(^|[^\\w@])@${agent.handle}(?![\\w-])`, "i").exec(text);
|
|
286
|
+
if (match && (!best || match.index < best.at))
|
|
287
|
+
best = { ...agent, at: match.index };
|
|
288
|
+
}
|
|
289
|
+
return best ? { key: best.key, handle: best.handle } : null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* An `@word` being typed at the end of the text (the caret is taken to be at
|
|
293
|
+
* the end, as the phone's other pickers do): where it starts and what is
|
|
294
|
+
* typed so far. Null when the text does not end in a mention.
|
|
295
|
+
*/
|
|
296
|
+
export function threadMentionAt(text) {
|
|
297
|
+
const m = text.match(/(^|\s)@([A-Za-z0-9._-]{0,40})$/);
|
|
298
|
+
if (!m)
|
|
299
|
+
return null;
|
|
300
|
+
return { start: text.length - m[2].length - 1, query: m[2] };
|
|
301
|
+
}
|
|
302
|
+
/** The mentions whose name starts with what is typed. */
|
|
303
|
+
export function matchThreadMentions(query, mentions = THREAD_MENTIONS) {
|
|
304
|
+
const q = query.toLowerCase();
|
|
305
|
+
return mentions.filter((mention) => mention.name.toLowerCase().startsWith(q));
|
|
306
|
+
}
|
|
307
|
+
/** Replace the `@word` being typed with `@name `. */
|
|
308
|
+
export function applyThreadMention(text, at, name) {
|
|
309
|
+
return `${text.slice(0, at.start)}@${name} `;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* How to draw a message's author: the participant's current name and photo
|
|
313
|
+
* when the thread knows them (the server fills both from the roster), else
|
|
314
|
+
* the name the message was written under. omg has no photo; it wears its mark.
|
|
315
|
+
*/
|
|
316
|
+
export function authorView(author, participants) {
|
|
317
|
+
if (author.kind === "omg")
|
|
318
|
+
return { name: "omg", avatar: null };
|
|
319
|
+
const row = participants?.find((participant) => participant.id === author.participantId);
|
|
320
|
+
return {
|
|
321
|
+
name: row?.display.name?.trim() || author.name,
|
|
322
|
+
avatar: row?.display.avatar?.trim() || null,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/* -------------------------------------------------------------------------- */
|
|
326
|
+
/* Typing */
|
|
327
|
+
/* -------------------------------------------------------------------------- */
|
|
328
|
+
/** A person's typing ping lasts this long, so a closed tab stops showing as typing. */
|
|
329
|
+
export const THREAD_TYPING_TTL_MS = 6_000;
|
|
330
|
+
/** While the field has text, a client repeats its ping this often. */
|
|
331
|
+
export const THREAD_TYPING_PING_MS = 3_000;
|
|
332
|
+
/**
|
|
333
|
+
* Who shows as typing in one view. The replies of `rootId`, or the main list
|
|
334
|
+
* when it is null. omg always answers in replies, so the main list also shows
|
|
335
|
+
* omg when it is answering anywhere: otherwise an @omg asked from the main
|
|
336
|
+
* list would look ignored.
|
|
337
|
+
*/
|
|
338
|
+
export function typingIn(typing, rootId) {
|
|
339
|
+
return (typing ?? []).filter((row) => row.replyTo === rootId || (rootId === null && row.author.kind === "omg"));
|
|
340
|
+
}
|
|
341
|
+
/** "Alex is typing", "omg is typing", "Alex and Sam are typing", "Several people are typing". */
|
|
342
|
+
export function typingLabel(typing, participants) {
|
|
343
|
+
const names = [...new Set(typing.map((row) => authorView(row.author, participants).name))];
|
|
344
|
+
if (!names.length)
|
|
345
|
+
return null;
|
|
346
|
+
if (names.length === 1)
|
|
347
|
+
return `${names[0]} is typing`;
|
|
348
|
+
if (names.length === 2)
|
|
349
|
+
return `${names[0]} and ${names[1]} are typing`;
|
|
350
|
+
return "Several people are typing";
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* The client half of typing: feed it the field's text on every change. It
|
|
354
|
+
* sends `true` when text appears and again every THREAD_TYPING_PING_MS while
|
|
355
|
+
* it stays, and `false` once when the field empties. One owner for the
|
|
356
|
+
* throttle, shared by iOS and the web.
|
|
357
|
+
*/
|
|
358
|
+
export function typingPinger(send, now = Date.now) {
|
|
359
|
+
let last = 0;
|
|
360
|
+
let on = false;
|
|
361
|
+
return (text) => {
|
|
362
|
+
if (text.trim()) {
|
|
363
|
+
const at = now();
|
|
364
|
+
if (on && at - last < THREAD_TYPING_PING_MS)
|
|
365
|
+
return;
|
|
366
|
+
on = true;
|
|
367
|
+
last = at;
|
|
368
|
+
send(true);
|
|
369
|
+
}
|
|
370
|
+
else if (on) {
|
|
371
|
+
on = false;
|
|
372
|
+
last = 0;
|
|
373
|
+
send(false);
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/* -------------------------------------------------------------------------- */
|
|
378
|
+
/* Mentions */
|
|
379
|
+
/* -------------------------------------------------------------------------- */
|
|
380
|
+
const MENTION_HREF = "omg:mention/";
|
|
381
|
+
/** Who a mention link names: "omg", or a participant id. Null for any other link. */
|
|
382
|
+
export function mentionFromHref(href) {
|
|
383
|
+
if (!href?.startsWith(MENTION_HREF))
|
|
384
|
+
return null;
|
|
385
|
+
try {
|
|
386
|
+
return decodeURIComponent(href.slice(MENTION_HREF.length)) || null;
|
|
387
|
+
}
|
|
388
|
+
catch {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* A message with its `@omg` and `@Name` mentions made into links, so the
|
|
394
|
+
* markdown renderer on either client draws them as tags that can be tapped.
|
|
395
|
+
* Code is left as written, and so is an address (`x@omg.dev`): a mention
|
|
396
|
+
* starts a word.
|
|
397
|
+
*/
|
|
398
|
+
export function linkMentions(text, participants,
|
|
399
|
+
/** The coding agents' handles (mentionAgents), tagged as `agent:<handle>`. */
|
|
400
|
+
agentHandles = []) {
|
|
401
|
+
const targets = new Map([["omg", "omg"]]);
|
|
402
|
+
for (const handle of agentHandles)
|
|
403
|
+
if (!targets.has(handle))
|
|
404
|
+
targets.set(handle, `agent:${handle}`);
|
|
405
|
+
for (const row of participants ?? []) {
|
|
406
|
+
const name = row.kind === "human" ? row.display.name?.trim() : null;
|
|
407
|
+
if (name && !targets.has(name.toLowerCase()))
|
|
408
|
+
targets.set(name.toLowerCase(), row.id);
|
|
409
|
+
}
|
|
410
|
+
// Longest first, so "@Alex Chan" wins over "@Alex".
|
|
411
|
+
const names = [...targets.keys()].sort((a, b) => b.length - a.length);
|
|
412
|
+
const escape = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
413
|
+
const pattern = new RegExp(`(^|[^\\w@\\[\\]/])@(${names.map(escape).join("|")})(?![\\w-])`, "gi");
|
|
414
|
+
return text
|
|
415
|
+
.split(/(```[\s\S]*?```|`[^`\n]*`)/)
|
|
416
|
+
.map((part, index) => index % 2 === 1
|
|
417
|
+
? part
|
|
418
|
+
: part.replace(pattern, (_match, before, name) => {
|
|
419
|
+
const id = targets.get(name.toLowerCase());
|
|
420
|
+
return `${before}[@${name}](${MENTION_HREF}${encodeURIComponent(id)})`;
|
|
421
|
+
}))
|
|
422
|
+
.join("");
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* The people a message names with `@Name`, by participant id: the rule
|
|
426
|
+
* linkMentions draws with, so what is highlighted is who is notified.
|
|
427
|
+
*/
|
|
428
|
+
export function mentionedPeople(text, people) {
|
|
429
|
+
const participants = people.map((row) => ({ id: row.participantId, kind: "human", display: { name: row.name, fallback: row.name } }));
|
|
430
|
+
const linked = linkMentions(text, participants);
|
|
431
|
+
const ids = new Set();
|
|
432
|
+
for (const match of linked.matchAll(/\]\(omg:mention\/([^)]+)\)/g)) {
|
|
433
|
+
const id = mentionFromHref(`omg:mention/${match[1]}`);
|
|
434
|
+
if (id && id !== "omg" && !id.startsWith("agent:"))
|
|
435
|
+
ids.add(id);
|
|
436
|
+
}
|
|
437
|
+
return [...ids];
|
|
438
|
+
}
|
|
439
|
+
//# sourceMappingURL=threads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.js","sourceRoot":"","sources":["../src/threads.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4CH,MAAM,SAAS,GAAG,6CAA6C,CAAC;AAChE,MAAM,SAAS,GAAG,wBAAwB,CAAC;AAE3C,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,QAAwB;IACjE,MA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