@amerged/ohmyhost-cli 0.1.73 → 0.1.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @amerged/ohmyhost-cli
2
2
 
3
- ohmyho.st cli client, version 0.1.73.
3
+ ohmyho.st cli client, version 0.1.75.
4
4
 
5
5
  ```sh
6
6
  npm install --global @amerged/ohmyhost-cli
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __ohmyhostCreateRequire } from "node:module"; const require = __ohmyhostCreateRequire(import.meta.url);
3
3
  import {
4
4
  runProductionCli
5
- } from "./chunk-5R7JYYZD.js";
5
+ } from "./chunk-2APPOPVY.js";
6
6
  import "./chunk-7D2RFLWM.js";
7
7
 
8
8
  // apps/product-cli/dist/bin.js
@@ -46830,7 +46830,7 @@ function exact4(v, keys) {
46830
46830
  // apps/product-cli/package.json
46831
46831
  var package_default = {
46832
46832
  name: "@ohmyhost/product-cli",
46833
- version: "0.1.73",
46833
+ version: "0.1.75",
46834
46834
  private: true,
46835
46835
  ohmyhost: {
46836
46836
  deployment: "production",
@@ -56377,10 +56377,11 @@ function parsePreviewView(value, scope) {
56377
56377
  throw new TypeError("Invalid preview response");
56378
56378
  const row = value;
56379
56379
  const ulid6 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
56380
- if (Object.keys(row).sort().join(",") !== "environment,id,project_id,source,status,url" || typeof row["id"] !== "string" || !ulid6.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid6.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
56380
+ if (Object.keys(row).sort().join(",") !== "applied_source,environment,id,project_id,ready_to_show,source,status,url" || typeof row["id"] !== "string" || !ulid6.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid6.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["ready_to_show"] !== "boolean" || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
56381
56381
  throw new TypeError("Invalid preview response");
56382
- if (row["source"] !== null) {
56383
- const source = row["source"];
56382
+ for (const source of [row["source"], row["applied_source"]]) {
56383
+ if (source === null)
56384
+ continue;
56384
56385
  if (!source || typeof source !== "object" || Array.isArray(source))
56385
56386
  throw new TypeError("Invalid preview response");
56386
56387
  const item = source;
package/dist/index.js CHANGED
@@ -107,7 +107,7 @@ import {
107
107
  selectWorkspace,
108
108
  verifiedUserId,
109
109
  workspaceOf
110
- } from "./chunk-5R7JYYZD.js";
110
+ } from "./chunk-2APPOPVY.js";
111
111
  import {
112
112
  CredentialStoreIntegrityError,
113
113
  CredentialStoreUnavailableError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amerged/ohmyhost-cli",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/product-cli",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "private": true,
5
5
  "ohmyhost": {
6
6
  "deployment": "production",
@@ -30,6 +30,11 @@
30
30
  "types": "./dist/mcp-source-codec.d.ts",
31
31
  "import": "./dist/mcp-source-codec.js"
32
32
  },
33
+ "./chat-guidance": {
34
+ "source": "./src/chat-guidance.ts",
35
+ "types": "./dist/chat-guidance.d.ts",
36
+ "import": "./dist/chat-guidance.js"
37
+ },
33
38
  "./operation-failure": {
34
39
  "source": "./src/operation-failure.ts",
35
40
  "types": "./dist/operation-failure.d.ts",
@@ -0,0 +1,102 @@
1
+ type ChatGuidance = { next_step: string; say_to_user?: string };
2
+ type ChatResult = Readonly<Record<string, unknown>>;
3
+
4
+ export const CHAT_MAIN_PATH_INSTRUCTIONS =
5
+ "ohmyho.st hosts the user's app: create a project, save versions of its source, show a private live preview, publish. Main path: project_create, then source_changes to save a version, then preview_open, which returns the project's private preview link; later saves update the preview without a deployment. To show the app, also when continuing an existing project, use preview_open; the Dev site address needs a share link and is not the preview. When ready_to_show is true, give the user that link and ask whether they would like to see it. Publish with deployment_plan and deployment_create when the user asks or agrees; a request that already says deploy, publish or go live is that agreement. Results may carry next_step, written for you, and say_to_user, a plain sentence for the user, to be said in the user's language; the user needs IDs, commits, states and codes only on request. ";
6
+
7
+ export const PREVIEW_OPEN_DESCRIPTION =
8
+ "Open or create the stable private preview of this exact environment and return its link, state and ready_to_show. Source saves update it without a deployment. The link is for the user: hand it over when ready_to_show is true. Private means: keep it out of source files, notes and logs. It has no expiry until rotated.";
9
+ export const PREVIEW_GET_DESCRIPTION =
10
+ "Read the stable private preview of this exact environment: its link, state, saved and applied version, and ready_to_show. The link is for the user: hand it over when ready_to_show is true. Private means: keep it out of source files, notes and logs.";
11
+
12
+ export function previewGuidance(view: ChatResult): ChatGuidance | null {
13
+ if (view["source"] === null)
14
+ return {
15
+ next_step:
16
+ "Nothing is saved in this project yet, so the preview has nothing to show. Save the app with source_changes first; the preview follows the saved version.",
17
+ };
18
+ const url = view["url"];
19
+ if (typeof url !== "string" || !Object.hasOwn(view, "source")) return null;
20
+ if (view["ready_to_show"] === true)
21
+ return {
22
+ next_step:
23
+ "The preview shows the saved version. Give the user this link and ask whether they want to see it. Publish only when the user asks or agrees.",
24
+ say_to_user: `Your app is ready as a private preview: ${url} Do you want to see it?`,
25
+ };
26
+ if (view["status"] === "sleeping")
27
+ return {
28
+ next_step:
29
+ "The preview is paused and starts again when the link is opened. Give the user the link.",
30
+ say_to_user: `Your preview is paused. It starts again when you open the link: ${url}`,
31
+ };
32
+ return {
33
+ next_step:
34
+ "The preview is still starting or applying the saved version, which usually takes under a minute. Read preview_get again in about 10 seconds, for at most 2 minutes, before giving the user the link.",
35
+ say_to_user: "Your preview is starting. This takes up to a minute.",
36
+ };
37
+ }
38
+
39
+ export function sourceSaveGuidance(result: ChatResult): ChatGuidance | null {
40
+ if (result["state"] === "succeeded")
41
+ return {
42
+ next_step:
43
+ "The version is saved. Open the preview with preview_open for this project (environment dev on a Paid workspace, prod otherwise) and give the user the link when ready_to_show is true.",
44
+ };
45
+ if (result["state"] === "queued" || result["state"] === "running")
46
+ return {
47
+ next_step:
48
+ "The save is being finished. Read operation_get until it succeeds, then open the preview with preview_open for this project (environment dev on a Paid workspace, prod otherwise).",
49
+ };
50
+ return null;
51
+ }
52
+
53
+ export function projectCreateGuidance(
54
+ result: ChatResult,
55
+ starterRequested = true,
56
+ ): ChatGuidance | null {
57
+ if (result["state"] !== "queued" || typeof result["project_id"] !== "string") return null;
58
+ return {
59
+ next_step: starterRequested
60
+ ? "The project exists and its starter files are being prepared, usually in under a minute. Read source_get until the source is ready, then save the app with source_changes using its current commit and generation. Do not initialize the source again."
61
+ : "The project exists. Read operation_get until it succeeds, then read the source binding with source_get. If there is no source, use source_initialize for managed source or source_link for the chosen GitHub repository.",
62
+ say_to_user: "Your project is set up. I am building the first version now.",
63
+ };
64
+ }
65
+
66
+ export function deploymentGuidance(result: ChatResult): ChatGuidance | null {
67
+ return result["status"] === "active"
68
+ ? {
69
+ next_step:
70
+ "The deployment is online, which does not prove the app works. Open its address and try the app's main action before telling the user it works.",
71
+ }
72
+ : null;
73
+ }
74
+
75
+ export function withChatGuidance(
76
+ tool: string,
77
+ value: unknown,
78
+ options: { starterRequested?: boolean } = {},
79
+ ): unknown {
80
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
81
+ const result = value as ChatResult;
82
+ let guidance: ChatGuidance | null;
83
+ switch (tool) {
84
+ case "preview_get":
85
+ case "preview_open":
86
+ guidance = previewGuidance(result);
87
+ break;
88
+ case "source_changes":
89
+ case "source_upload_commit":
90
+ guidance = sourceSaveGuidance(result);
91
+ break;
92
+ case "project_create":
93
+ guidance = projectCreateGuidance(result, options.starterRequested);
94
+ break;
95
+ case "deployment_get":
96
+ guidance = deploymentGuidance(result);
97
+ break;
98
+ default:
99
+ return value;
100
+ }
101
+ return guidance === null ? value : { ...guidance, ...result };
102
+ }
@@ -6,6 +6,8 @@ export interface PreviewView {
6
6
  readonly status: "cold" | "starting" | "ready" | "sleeping";
7
7
  readonly url: string;
8
8
  readonly source: Readonly<{ sequence: number; commit_sha: string }> | null;
9
+ readonly applied_source: PreviewView["source"];
10
+ readonly ready_to_show: boolean;
9
11
  }
10
12
 
11
13
  export function parsePreviewView(
@@ -17,21 +19,23 @@ export function parsePreviewView(
17
19
  const row = value as Record<string, unknown>;
18
20
  const ulid = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
19
21
  if (
20
- Object.keys(row).sort().join(",") !== "environment,id,project_id,source,status,url" ||
22
+ Object.keys(row).sort().join(",") !==
23
+ "applied_source,environment,id,project_id,ready_to_show,source,status,url" ||
21
24
  typeof row["id"] !== "string" ||
22
25
  !ulid.test(row["id"]) ||
23
26
  typeof row["project_id"] !== "string" ||
24
27
  !ulid.test(row["project_id"]) ||
25
28
  (row["environment"] !== "dev" && row["environment"] !== "prod") ||
26
29
  !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) ||
30
+ typeof row["ready_to_show"] !== "boolean" ||
27
31
  typeof row["url"] !== "string" ||
28
32
  !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) ||
29
33
  (scope !== undefined &&
30
34
  (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
31
35
  )
32
36
  throw new TypeError("Invalid preview response");
33
- if (row["source"] !== null) {
34
- const source = row["source"];
37
+ for (const source of [row["source"], row["applied_source"]]) {
38
+ if (source === null) continue;
35
39
  if (!source || typeof source !== "object" || Array.isArray(source))
36
40
  throw new TypeError("Invalid preview response");
37
41
  const item = source as Record<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1036,6 +1036,7 @@ export type {
1036
1036
  PrepareManagedMailWebhookResponses,
1037
1037
  Preview,
1038
1038
  PreviewEnvironment,
1039
+ PreviewSource,
1039
1040
  ProblemDetails,
1040
1041
  Project,
1041
1042
  ProjectContext,
@@ -72,9 +72,9 @@ import {
72
72
  writeProjectDatabase,
73
73
  } from "./sdk.gen.js";
74
74
  export const remoteMcpContractSha256 =
75
- "1cb53afbb2abd3322167436062b0925bc9d931a34da1ab5d9bb33dff0abf8e3c";
75
+ "61ed92a391a6fc6c187cab53c0e0307dcc45652563857384745d0d8aab25dde0";
76
76
  export const remoteMcpContractVersion = "0.0.0";
77
- export const remoteMcpReleaseVersion = "0.1.73";
77
+ export const remoteMcpReleaseVersion = "0.1.75";
78
78
  export interface RemoteMcpOperation {
79
79
  operationId: string;
80
80
  method: string;
@@ -159,7 +159,16 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
159
159
  outputSchema: {
160
160
  type: "object",
161
161
  additionalProperties: false,
162
- required: ["id", "project_id", "environment", "status", "url", "source"],
162
+ required: [
163
+ "id",
164
+ "project_id",
165
+ "environment",
166
+ "status",
167
+ "url",
168
+ "source",
169
+ "applied_source",
170
+ "ready_to_show",
171
+ ],
163
172
  properties: {
164
173
  id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
165
174
  project_id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
@@ -178,11 +187,33 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
178
187
  additionalProperties: false,
179
188
  required: ["sequence", "commit_sha"],
180
189
  properties: {
181
- sequence: { type: "integer", minimum: 1 },
182
- commit_sha: { type: "string", pattern: "^[0-9a-f]{40}$" },
190
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
191
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
183
192
  },
184
193
  },
185
194
  ],
195
+ description: "The saved version selected for this preview, or null if there is none.",
196
+ },
197
+ applied_source: {
198
+ oneOf: [
199
+ { type: "null" },
200
+ {
201
+ type: "object",
202
+ additionalProperties: false,
203
+ required: ["sequence", "commit_sha"],
204
+ properties: {
205
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
206
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
207
+ },
208
+ },
209
+ ],
210
+ description:
211
+ "The version applied to the preview, or null if no version has been applied.",
212
+ },
213
+ ready_to_show: {
214
+ type: "boolean",
215
+ description:
216
+ "True when the preview is ready and its applied version has the same sequence as the saved version.",
186
217
  },
187
218
  },
188
219
  },
@@ -239,7 +270,16 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
239
270
  outputSchema: {
240
271
  type: "object",
241
272
  additionalProperties: false,
242
- required: ["id", "project_id", "environment", "status", "url", "source"],
273
+ required: [
274
+ "id",
275
+ "project_id",
276
+ "environment",
277
+ "status",
278
+ "url",
279
+ "source",
280
+ "applied_source",
281
+ "ready_to_show",
282
+ ],
243
283
  properties: {
244
284
  id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
245
285
  project_id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
@@ -258,11 +298,33 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
258
298
  additionalProperties: false,
259
299
  required: ["sequence", "commit_sha"],
260
300
  properties: {
261
- sequence: { type: "integer", minimum: 1 },
262
- commit_sha: { type: "string", pattern: "^[0-9a-f]{40}$" },
301
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
302
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
263
303
  },
264
304
  },
265
305
  ],
306
+ description: "The saved version selected for this preview, or null if there is none.",
307
+ },
308
+ applied_source: {
309
+ oneOf: [
310
+ { type: "null" },
311
+ {
312
+ type: "object",
313
+ additionalProperties: false,
314
+ required: ["sequence", "commit_sha"],
315
+ properties: {
316
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
317
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
318
+ },
319
+ },
320
+ ],
321
+ description:
322
+ "The version applied to the preview, or null if no version has been applied.",
323
+ },
324
+ ready_to_show: {
325
+ type: "boolean",
326
+ description:
327
+ "True when the preview is ready and its applied version has the same sequence as the saved version.",
266
328
  },
267
329
  },
268
330
  },
@@ -332,7 +394,16 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
332
394
  outputSchema: {
333
395
  type: "object",
334
396
  additionalProperties: false,
335
- required: ["id", "project_id", "environment", "status", "url", "source"],
397
+ required: [
398
+ "id",
399
+ "project_id",
400
+ "environment",
401
+ "status",
402
+ "url",
403
+ "source",
404
+ "applied_source",
405
+ "ready_to_show",
406
+ ],
336
407
  properties: {
337
408
  id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
338
409
  project_id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
@@ -351,11 +422,33 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
351
422
  additionalProperties: false,
352
423
  required: ["sequence", "commit_sha"],
353
424
  properties: {
354
- sequence: { type: "integer", minimum: 1 },
355
- commit_sha: { type: "string", pattern: "^[0-9a-f]{40}$" },
425
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
426
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
356
427
  },
357
428
  },
358
429
  ],
430
+ description: "The saved version selected for this preview, or null if there is none.",
431
+ },
432
+ applied_source: {
433
+ oneOf: [
434
+ { type: "null" },
435
+ {
436
+ type: "object",
437
+ additionalProperties: false,
438
+ required: ["sequence", "commit_sha"],
439
+ properties: {
440
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
441
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
442
+ },
443
+ },
444
+ ],
445
+ description:
446
+ "The version applied to the preview, or null if no version has been applied.",
447
+ },
448
+ ready_to_show: {
449
+ type: "boolean",
450
+ description:
451
+ "True when the preview is ready and its applied version has the same sequence as the saved version.",
359
452
  },
360
453
  },
361
454
  },
@@ -425,7 +518,16 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
425
518
  outputSchema: {
426
519
  type: "object",
427
520
  additionalProperties: false,
428
- required: ["id", "project_id", "environment", "status", "url", "source"],
521
+ required: [
522
+ "id",
523
+ "project_id",
524
+ "environment",
525
+ "status",
526
+ "url",
527
+ "source",
528
+ "applied_source",
529
+ "ready_to_show",
530
+ ],
429
531
  properties: {
430
532
  id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
431
533
  project_id: { type: "string", pattern: "^[0-9A-HJKMNP-TV-Z]{26}$" },
@@ -444,11 +546,33 @@ export const remoteMcpOperations: readonly RemoteMcpOperation[] = [
444
546
  additionalProperties: false,
445
547
  required: ["sequence", "commit_sha"],
446
548
  properties: {
447
- sequence: { type: "integer", minimum: 1 },
448
- commit_sha: { type: "string", pattern: "^[0-9a-f]{40}$" },
549
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
550
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
449
551
  },
450
552
  },
451
553
  ],
554
+ description: "The saved version selected for this preview, or null if there is none.",
555
+ },
556
+ applied_source: {
557
+ oneOf: [
558
+ { type: "null" },
559
+ {
560
+ type: "object",
561
+ additionalProperties: false,
562
+ required: ["sequence", "commit_sha"],
563
+ properties: {
564
+ sequence: { type: "integer", minimum: 1, maximum: 9007199254740991 },
565
+ commit_sha: { type: "string", pattern: "^(?!0{40}$)[0-9a-f]{40}$" },
566
+ },
567
+ },
568
+ ],
569
+ description:
570
+ "The version applied to the preview, or null if no version has been applied.",
571
+ },
572
+ ready_to_show: {
573
+ type: "boolean",
574
+ description:
575
+ "True when the preview is ready and its applied version has the same sequence as the saved version.",
452
576
  },
453
577
  },
454
578
  },
@@ -13,10 +13,23 @@ export type Preview = {
13
13
  * Stable private capability URL without an expiration time.
14
14
  */
15
15
  url: string;
16
- source: null | {
17
- sequence: number;
18
- commit_sha: string;
19
- };
16
+ /**
17
+ * The saved version selected for this preview, or null if there is none.
18
+ */
19
+ source: PreviewSource;
20
+ /**
21
+ * The version applied to the preview, or null if no version has been applied.
22
+ */
23
+ applied_source: PreviewSource;
24
+ /**
25
+ * True when the preview is ready and its applied version has the same sequence as the saved version.
26
+ */
27
+ ready_to_show: boolean;
28
+ };
29
+
30
+ export type PreviewSource = null | {
31
+ sequence: number;
32
+ commit_sha: string;
20
33
  };
21
34
 
22
35
  export type ConnectionBegin = {