@uru-intelligence/cli 0.4.19 → 0.5.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.
package/dist/uru.mjs CHANGED
@@ -233,6 +233,7 @@ function buildGemOperations(op) {
233
233
  op("gem.git_source_import", "gems", "Import an inspected exact Git commit as a Git-backed Gem.", "gem_control_plane", "git_source_import", "write"),
234
234
  op("gem.git_source_status", "gems", "Read Git source binding, policy, import, preview, and allowed-action state for a Gem.", "gem_query", "git_source_status", "read"),
235
235
  op("gem.git_source_command", "gems", "Apply a bounded Git source command such as refresh, retry, policy change, publish, or preview approval.", "gem_control_plane", "git_source_command", "write"),
236
+ op("gem.git_source_copy", "gems", "Make a new, unlinked, editable Gem from a GitHub-linked Gem's latest saved Version. The copy carries no Links, secrets, tool grants, schedules or Git binding.", "gem_control_plane", "git_source_copy", "write"),
236
237
  op("gem.git_source_preview_inspect", "gems", "Inspect the exact preview head and resource policy before approval.", "gem_query", "git_source_preview_inspect", "read"),
237
238
  op("gem.git_source_preview_open", "gems", "Mint an authenticated URL for a ready Git source preview.", "gem_query", "git_source_preview_open", "read"),
238
239
  op("gem.inspect", "gems", "Inspect Gem release readiness, bindings, secrets, and setup checks. Thumbnail image bytes are omitted by default; pass include_thumbnail=true to include them.", "gem_query", "inspect", "read"),
@@ -259,10 +260,11 @@ function buildGemOperations(op) {
259
260
  op("gem.version_save", "gems", "Save Current as a frozen Version without changing Links.", "gem_control_plane", "version_save", "write"),
260
261
  op("gem.version_restore", "gems", "Restore one Version into Current as a new Edit without changing Links.", "gem_control_plane", "version_restore", "write"),
261
262
  op("gem.version_preview", "gems", "Open or provision an isolated preview for one Version without changing Links.", "gem_control_plane", "version_preview", "write"),
263
+ op("gem.version_retry", "gems", "Re-queue the build of a Version that failed and never sealed a Build, keeping the same Version identity and source snapshot. Available for every Gem, whether its source is Uru or GitHub. Only a failed Version qualifies, and a build already in flight is refused.", "gem_control_plane", "version_retry", "write"),
262
264
  op("gem.build_logs", "gems", "Read build diagnostics for a Gem build.", "gem_query", "build_logs", "read"),
263
265
  op("gem.build_job", "gems", "Read hosted compile status by hosted_job_id. Reports queued, pending, running, succeeded, failed, or expired, plus build_id when a durable Build was persisted, plus compact logs and failure_kind.", "gem_query", "build_job", "read"),
264
266
  op("gem.build_inspect", "gems", "Inspect a Gem runtime contract and release overview.", "gem_query", "build_inspect", "read"),
265
- op("gem.upsert_binding", "gems", "Bind a declared Gem need to an approved platform resource.", "gem_control_plane", "upsert_binding", "write"),
267
+ op("gem.upsert_binding", "gems", "Bind a declared Gem need to an approved platform resource. A generic tool target uses the exact unique visible wrapper and unchanged plain subtool as target_resource_ref. A tool role may also use the expected binding-set version and hash with a complete binding_choices map of opaque connection_ref values read from gem.inspect. A Gem has one set of tool bindings: its preview builds and its releases use it alike.", "gem_control_plane", "upsert_binding", "write"),
266
268
  op("gem.resolve_safe_bindings", "gems", "Resolve deterministic safe bindings for a ready Gem build.", "gem_control_plane", "resolve_safe_bindings", "write"),
267
269
  op("gem.store_secret", "gems", "Store a user-supplied Gem secret value server-side.", "gem_control_plane", "store_secret", "write"),
268
270
  op("gem.releases_list", "gems", "List logical hosted Releases.", "gem_query", "releases_list", "read"),
@@ -272,6 +274,7 @@ function buildGemOperations(op) {
272
274
  op("gem.status", "gems", "Read Gem deployment status, checks, runtime runs, and recent logs.", "gem_query", "deployment_status", "read"),
273
275
  op("gem.checks", "gems", "Inspect registered checks for a Gem deployment or immutable version.", "gem_query", "checks", "read"),
274
276
  op("gem.logs", "gems", "Read server-side Gem runtime logs with filters.", "gem_query", "logs", "read"),
277
+ op("gem.debug_token", "gems", "Mint a short-lived, single-deployment debug session for live Gem inspection.", "gem_control_plane", "debug_token", "write"),
275
278
  op("gem.browser_verify", "gems", "Run browser verification for a Gem deployment.", "gem_control_plane", "browser_verify", "write"),
276
279
  op("gem.security_scan", "gems", "Run a Gem security scan.", "gem_control_plane", "security_scan", "write"),
277
280
  op("gem.links_list", "gems", "List published links for a Gem.", "gem_query", "links_list", "read"),
@@ -296,6 +299,9 @@ function buildGemOperations(op) {
296
299
  op("gem.schedule_pause", "gems", "Pause one declared Gem job schedule.", "gem_control_plane", "schedule_pause", "write"),
297
300
  op("gem.schedule_resume", "gems", "Resume one declared Gem job schedule.", "gem_control_plane", "schedule_resume", "write"),
298
301
  op("gem.schedule_run_now", "gems", "Run one active Gem job schedule now.", "gem_control_plane", "schedule_run_now", "write"),
302
+ op("gem.event_targets_list", "gems", "List a Gem's event rules that start jobs from reported platform events.", "gem_query", "event_targets_list", "read"),
303
+ op("gem.event_target_update", "gems", "Update one Gem event rule's paused state or job input.", "gem_control_plane", "event_target_update", "write"),
304
+ op("gem.event_target_run_now", "gems", "Run one active Gem event rule now.", "gem_control_plane", "event_target_run_now", "write"),
299
305
  op("gem.analytics", "gems", "Read access-checked Link view summaries and run-ledger totals for a Gem without returning customer content.", "gem_query", "get_gem_analytics", "read"),
300
306
  op("gem.domains_set", "gems", "Attach or update a custom domain for a Gem. Pass the hostname only; " + "the current Release is resolved for you. Requires a ready Release.", "gem_control_plane", "domains_set", "write"),
301
307
  op("gem.domains_list", "gems", "List custom domains for a Gem.", "gem_query", "domains_list", "read"),
@@ -332,6 +338,18 @@ function buildOperationGroups(op) {
332
338
  op("library.empty_trash", "library", "Permanently empty Library trash.", "library_fs", "empty_trash", "destructive"),
333
339
  op("library.favorite", "library", "Add a visible Library item to the caller's favorites.", "library_fs", "favorite", "write"),
334
340
  op("library.unfavorite", "library", "Remove a visible Library item from the caller's favorites.", "library_fs", "unfavorite", "write"),
341
+ op("library.sources_list", "library", "List the caller’s connected Library sources.", "library_external_sources_query", "list", "read"),
342
+ op("library.sources_get", "library", "Inspect one connected Library source and its mirrored items.", "library_external_sources_query", "get", "read"),
343
+ op("library.sources_create", "library", "Connect Google Drive files or folders to the Library.", "library_external_sources", "create", "write"),
344
+ op("library.sources_edit", "library", "Change a connected Library source schedule or enable state.", "library_external_sources", "edit", "write"),
345
+ op("library.sources_pause", "library", "Pause a connected Library source.", "library_external_sources", "pause", "write"),
346
+ op("library.sources_resume", "library", "Resume a paused Library source.", "library_external_sources", "resume", "write"),
347
+ op("library.sources_run_now", "library", "Run a connected Library source sync now.", "library_external_sources", "run_now", "write"),
348
+ op("library.sources_cancel", "library", "Cancel the active sync for a connected Library source.", "library_external_sources", "cancel", "write"),
349
+ op("library.sources_reconnect", "library", "Reconnect a source after its Google Drive access expires.", "library_external_sources", "reconnect", "write"),
350
+ op("library.sources_remove", "library", "Remove a connected source and move confirmed mirrors to Library trash.", "library_external_sources", "remove", "destructive"),
351
+ op("library.history_list", "library", "List immutable history for an authorized Library resource.", "library_history", "list", "read"),
352
+ op("library.history_get", "library", "Read one immutable history revision for an authorized Library resource.", "library_history", "get", "read"),
335
353
  op("library.upload_preflight", "library", "Preflight a Library upload.", "library_upload", "preflight", "read"),
336
354
  op("library.upload_create_session", "library", "Create a direct Library upload session.", "library_upload", "create_session", "write"),
337
355
  op("library.upload_complete_session", "library", "Complete a direct Library upload session.", "library_upload", "complete_session", "write")
@@ -378,6 +396,10 @@ function buildOperationGroups(op) {
378
396
  op("dataset.create", "datasets", "Create a typed Dataset.", "dataset_manage", "create", "write"),
379
397
  op("dataset.update", "datasets", "Update Dataset metadata and schema.", "dataset_manage", "update", "write"),
380
398
  op("dataset.get", "datasets", "Read Dataset metadata and stable property identities.", "dataset_get", undefined, "read"),
399
+ op("dataset.external_source_get", "datasets", "Read the external source binding for a Dataset.", "dataset_external_source_get", undefined, "read"),
400
+ op("dataset.external_source_put", "datasets", "Create or update the external source binding for a Dataset.", "dataset_external_source_put", undefined, "write"),
401
+ op("dataset.external_source_test", "datasets", "Test a Dataset external source connection and query preview.", "dataset_external_source_test", undefined, "read"),
402
+ op("dataset.external_source_sync", "datasets", "Start a one-shot refresh from a Dataset external source.", "dataset_external_source_sync", undefined, "write"),
381
403
  op("dataset.query", "datasets", "Query Dataset rows with filters, search, sorting, pages, totals, and aggregates.", "dataset_query", undefined, "read"),
382
404
  op("dataset.history", "datasets", "List Dataset change history.", "dataset_history", undefined, "read"),
383
405
  op("dataset.rows_upsert", "datasets", "Insert or update Dataset rows.", "dataset_rows", "upsert", "write"),
@@ -1722,6 +1744,7 @@ var cliCommandPathSpecs = [
1722
1744
  pathSpec(["gems", "runs"], "gems"),
1723
1745
  pathSpec(["gems", "capabilities"], "gems"),
1724
1746
  pathSpec(["gems", "schedules"], "gems"),
1747
+ pathSpec(["gems", "events"], "gems"),
1725
1748
  pathSpec(["gems", "bindings"], "gems"),
1726
1749
  pathSpec(["gems", "api"], "gems"),
1727
1750
  pathSpec(["gems", "components"], "gems"),
@@ -1755,6 +1778,36 @@ function datasetPathSpecs() {
1755
1778
  valueFlag("--version-id")
1756
1779
  ]),
1757
1780
  pathSpec(["datasets", "jobs"], "datasets", datasetId, pageFlags),
1781
+ pathSpec(["datasets", "jobs", "get"], "datasets", [
1782
+ required("dataset-id"),
1783
+ required("job-id")
1784
+ ]),
1785
+ pathSpec(["datasets", "jobs", "cancel"], "datasets", [
1786
+ required("dataset-id"),
1787
+ required("job-id")
1788
+ ]),
1789
+ pathSpec(["datasets", "source"], "datasets", [optional("operation")], [
1790
+ paramsJsonFlag(),
1791
+ valueFlag("--idempotency-key")
1792
+ ]),
1793
+ pathSpec(["datasets", "source", "get"], "datasets", datasetId, [], {
1794
+ aliases: [["datasets", "source", "inspect"]]
1795
+ }),
1796
+ pathSpec(["datasets", "source", "put"], "datasets", datasetId, [paramsJsonFlag()], {
1797
+ aliases: [
1798
+ ["datasets", "source", "edit"],
1799
+ ["datasets", "source", "connect"],
1800
+ ["datasets", "source", "create"],
1801
+ ["datasets", "source", "reconnect"]
1802
+ ]
1803
+ }),
1804
+ pathSpec(["datasets", "source", "test"], "datasets", datasetId, [paramsJsonFlag()]),
1805
+ pathSpec(["datasets", "source", "pause"], "datasets", datasetId),
1806
+ pathSpec(["datasets", "source", "resume"], "datasets", datasetId),
1807
+ pathSpec(["datasets", "source", "sync"], "datasets", datasetId, [
1808
+ paramsJsonFlag(),
1809
+ valueFlag("--idempotency-key")
1810
+ ], { aliases: [["datasets", "source", "run-now"]] }),
1758
1811
  pathSpec(["datasets", "query"], "datasets", datasetId, [
1759
1812
  paramsJsonFlag(),
1760
1813
  ...pageFlags,
@@ -1826,6 +1879,58 @@ function distributionPathSpecs() {
1826
1879
  }
1827
1880
  function libraryPathSpecs() {
1828
1881
  return [
1882
+ pathSpec(["library", "source"], "library", [optional("operation")], [paramsJsonFlag(), valueFlag("--limit"), valueFlag("--cursor"), booleanFlag("--yes")], { aliases: [["library", "sources"]] }),
1883
+ pathSpec(["library", "source", "list"], "library", [], [], { aliases: [["library", "source", "ls"], ["library", "sources", "list"], ["library", "sources", "ls"]] }),
1884
+ pathSpec(["library", "source", "get"], "library", [required("source-id")], [], {
1885
+ aliases: [
1886
+ ["library", "source", "inspect"],
1887
+ ["library", "sources", "get"],
1888
+ ["library", "sources", "inspect"]
1889
+ ]
1890
+ }),
1891
+ pathSpec(["library", "source", "create"], "library", [], [paramsJsonFlag()], {
1892
+ aliases: [
1893
+ ["library", "source", "connect"],
1894
+ ["library", "sources", "create"],
1895
+ ["library", "sources", "connect"]
1896
+ ]
1897
+ }),
1898
+ pathSpec(["library", "source", "edit"], "library", [required("source-id")], [paramsJsonFlag()], {
1899
+ aliases: [
1900
+ ["library", "source", "set"],
1901
+ ["library", "sources", "edit"],
1902
+ ["library", "sources", "set"]
1903
+ ]
1904
+ }),
1905
+ pathSpec(["library", "source", "pause"], "library", [required("source-id")], [], { aliases: [["library", "sources", "pause"]] }),
1906
+ pathSpec(["library", "source", "resume"], "library", [required("source-id")], [], { aliases: [["library", "sources", "resume"]] }),
1907
+ pathSpec(["library", "source", "run-now"], "library", [required("source-id")], [], {
1908
+ aliases: [
1909
+ ["library", "source", "run"],
1910
+ ["library", "source", "sync"],
1911
+ ["library", "sources", "run-now"],
1912
+ ["library", "sources", "run"],
1913
+ ["library", "sources", "sync"]
1914
+ ]
1915
+ }),
1916
+ pathSpec(["library", "source", "cancel"], "library", [required("source-id")], [], { aliases: [["library", "sources", "cancel"]] }),
1917
+ pathSpec(["library", "source", "reconnect"], "library", [required("source-id")], [paramsJsonFlag()], { aliases: [["library", "sources", "reconnect"]] }),
1918
+ pathSpec(["library", "source", "remove"], "library", [required("source-id")], [booleanFlag("--yes")], {
1919
+ aliases: [
1920
+ ["library", "source", "rm"],
1921
+ ["library", "source", "delete"],
1922
+ ["library", "sources", "remove"],
1923
+ ["library", "sources", "rm"],
1924
+ ["library", "sources", "delete"]
1925
+ ]
1926
+ }),
1927
+ pathSpec(["library", "history"], "library", [required("resource-type"), required("resource-id")], [valueFlag("--limit"), valueFlag("--cursor")]),
1928
+ pathSpec(["library", "history", "get"], "library", [required("resource-type"), required("resource-id"), required("revision")], [], {
1929
+ aliases: [
1930
+ ["library", "history", "inspect"],
1931
+ ["library", "history", "show"]
1932
+ ]
1933
+ }),
1829
1934
  pathSpec(["library", "ls"], "library", [optional("path")], [valueFlag("--limit"), valueFlag("--offset")]),
1830
1935
  pathSpec(["library", "stat"], "library", [required("path")]),
1831
1936
  pathSpec(["library", "search"], "library", [required("query")], [valueFlag("--limit"), valueFlag("--offset")]),
@@ -1973,15 +2078,19 @@ function topLevelPathSpecs() {
1973
2078
  pathSpec(["diff"], "diff", [optional("gem-path")], [valueFlag("--gem"), valueFlag("--mode"), valueFlag("--path")]),
1974
2079
  pathSpec(["push"], "push", [optional("gem-path")], [booleanFlag("--force"), ...gemRefFlags]),
1975
2080
  pathSpec(["logs"], "logs", [optional("gem-path")], [
2081
+ valueFlag("--cursor"),
2082
+ valueFlag("--export"),
1976
2083
  valueFlag("--follow-duration-ms"),
1977
2084
  booleanFlag("--follow"),
1978
2085
  valueFlag("--gem"),
1979
2086
  valueFlag("--level"),
1980
2087
  valueFlag("--limit"),
1981
2088
  valueFlag("--path"),
1982
- valueFlag("--poll-interval-ms"),
1983
2089
  valueFlag("--release"),
1984
- valueFlag("--run")
2090
+ valueFlag("--run"),
2091
+ valueFlag("--request-id"),
2092
+ valueFlag("--since"),
2093
+ valueFlag("--until")
1985
2094
  ]),
1986
2095
  pathSpec(["open"], "open", [optional("gem-path")], [valueFlag("--gem"), valueFlag("--link"), valueFlag("--path")]),
1987
2096
  pathSpec(["gems"], "gems"),
@@ -2113,14 +2222,23 @@ function gemPathSpecs() {
2113
2222
  enumFlag("--checks", ["quick", "full"])
2114
2223
  ]),
2115
2224
  pathSpec(["gems", "checks"], "gems", [required("version"), optional("gem")], gemRefFlags),
2225
+ pathSpec(["gems", "debug-token"], "gems", [optional("gem")], [
2226
+ valueFlag("--deployment"),
2227
+ valueFlag("--ttl-seconds"),
2228
+ ...gemRefFlags
2229
+ ]),
2116
2230
  pathSpec(["gems", "logs"], "gems", [optional("gem")], [
2231
+ valueFlag("--cursor"),
2232
+ valueFlag("--export"),
2117
2233
  valueFlag("--follow-duration-ms"),
2118
2234
  booleanFlag("--follow"),
2119
2235
  valueFlag("--level"),
2120
2236
  valueFlag("--release"),
2121
2237
  valueFlag("--run"),
2238
+ valueFlag("--request-id"),
2239
+ valueFlag("--since"),
2240
+ valueFlag("--until"),
2122
2241
  valueFlag("--limit"),
2123
- valueFlag("--poll-interval-ms"),
2124
2242
  ...gemRefFlags
2125
2243
  ]),
2126
2244
  pathSpec(["gems", "status"], "gems", [optional("gem")], gemRefFlags),
@@ -2163,6 +2281,7 @@ function gemPathSpecs() {
2163
2281
  pathSpec(["gems", "versions", "diff"], "gems", [required("from-version"), required("to-version"), optional("gem")], gemRefFlags),
2164
2282
  pathSpec(["gems", "versions", "restore"], "gems", [required("version"), optional("gem")], gemRefFlags),
2165
2283
  pathSpec(["gems", "versions", "preview"], "gems", [required("version"), optional("gem")], gemRefFlags),
2284
+ pathSpec(["gems", "versions", "retry"], "gems", [required("version"), optional("gem")], gemRefFlags),
2166
2285
  pathSpec(["gems", "edits", "list"], "gems", [optional("gem")], [
2167
2286
  valueFlag("--cursor"),
2168
2287
  valueFlag("--gem"),
@@ -2211,10 +2330,12 @@ function gemPathSpecs() {
2211
2330
  pathSpec(["gems", "links", "revoke"], "gems", [required("link"), optional("gem")], [...gemRefFlags, valueFlag("--idempotency-key")]),
2212
2331
  pathSpec(["gems", "runs", "list"], "gems", [optional("gem")], [
2213
2332
  valueFlag("--cursor"),
2333
+ valueFlag("--environment"),
2214
2334
  valueFlag("--gem"),
2215
2335
  valueFlag("--limit"),
2216
2336
  valueFlag("--path"),
2217
- valueFlag("--status")
2337
+ valueFlag("--status"),
2338
+ valueFlag("--version")
2218
2339
  ]),
2219
2340
  pathSpec(["gems", "runs", "show"], "gems", [required("run"), optional("gem")], gemRefFlags),
2220
2341
  pathSpec(["gems", "runs", "cancel"], "gems", [required("run"), optional("gem")], [...gemRefFlags, booleanFlag("--yes")]),
@@ -2236,6 +2357,12 @@ function gemPathSpecs() {
2236
2357
  pathSpec(["gems", "schedules", "pause"], "gems", [required("capability"), optional("gem")], gemRefFlags),
2237
2358
  pathSpec(["gems", "schedules", "resume"], "gems", [required("capability"), optional("gem")], gemRefFlags),
2238
2359
  pathSpec(["gems", "schedules", "run"], "gems", [required("capability"), optional("gem")], [...gemRefFlags, valueFlag("--idempotency-key")]),
2360
+ pathSpec(["gems", "events", "list"], "gems", [optional("gem")], gemRefFlags),
2361
+ pathSpec(["gems", "events", "update"], "gems", [required("target-id"), optional("gem")], [...gemRefFlags, valueFlag("--state"), valueFlag("--input-json")]),
2362
+ pathSpec(["gems", "events", "pause"], "gems", [required("target-id"), optional("gem")], gemRefFlags),
2363
+ pathSpec(["gems", "events", "resume"], "gems", [required("target-id"), optional("gem")], gemRefFlags),
2364
+ pathSpec(["gems", "events", "run"], "gems", [required("target-id"), optional("gem")], [...gemRefFlags, valueFlag("--idempotency-key")]),
2365
+ pathSpec(["gems", "events", "run-now"], "gems", [required("target-id"), optional("gem")], [...gemRefFlags, valueFlag("--idempotency-key")]),
2239
2366
  pathSpec(["gems", "domains", "list"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--limit")]),
2240
2367
  pathSpec(["gems", "domains", "set"], "gems", [required("hostname"), optional("gem")], gemRefFlags),
2241
2368
  pathSpec(["gems", "domains", "check"], "gems", [required("domain-id"), optional("gem")], gemRefFlags),
@@ -2278,11 +2405,11 @@ function gemPathSpecs() {
2278
2405
  valueFlag("--target-resource-type"),
2279
2406
  valueFlag("--target-resource-id"),
2280
2407
  valueFlag("--target-resource-ref"),
2281
- valueFlag("--tool-connection-id"),
2282
- valueFlag("--tool-capability-id"),
2283
- valueFlag("--environment-key"),
2284
2408
  valueFlag("--binding-status"),
2285
- valueFlag("--policy-level")
2409
+ valueFlag("--policy-level"),
2410
+ valueFlag("--binding-choices"),
2411
+ valueFlag("--expected-binding-set-version"),
2412
+ valueFlag("--expected-binding-set-hash")
2286
2413
  ]),
2287
2414
  pathSpec(["gems", "bindings", "resolve"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--build")]),
2288
2415
  pathSpec(["gems", "api", "describe"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--build"), valueFlag("--deployment")]),
@@ -2646,7 +2773,7 @@ var cliRootHelpGroups = [
2646
2773
  {
2647
2774
  command: "logs",
2648
2775
  lines: [
2649
- " uru logs [library/name.gem] [--limit 100] [--follow]",
2776
+ " uru logs [library/name.gem] [--limit 100] [--follow] [--export <file>]",
2650
2777
  " Runtime logs"
2651
2778
  ]
2652
2779
  },
@@ -2671,18 +2798,19 @@ var cliRootHelpGroups = [
2671
2798
  " uru gems edits list|show [library/name.gem]",
2672
2799
  ' uru gems versions save|upload [library/name.gem] [--name "..."] [--message "..."]',
2673
2800
  " uru gems versions deploy [library/name.gem] <version>",
2674
- " uru gems versions list|show|diff|restore|preview [library/name.gem]",
2801
+ " uru gems versions list|show|diff|restore|preview|retry [library/name.gem]",
2675
2802
  " uru gems releases list|show|create|retry [library/name.gem]",
2676
2803
  " create takes a positional <version>, not --version",
2677
2804
  " uru gems links list|create|set-version|promote|rollback|set-access|set-notifications|rotate|revoke",
2678
2805
  " uru gems runs list|show|cancel [library/name.gem]",
2679
2806
  " uru gems capabilities list|enable|disable [library/name.gem]",
2680
2807
  " uru gems schedules list|arm|pause|resume|run [library/name.gem]",
2808
+ " uru gems events list|update|pause|resume|run [library/name.gem]",
2681
2809
  " uru gems api describe|query|action|job [library/name.gem]",
2682
2810
  " uru gems domains list|set|check|delete [library/name.gem]",
2683
2811
  " uru gems analytics [library/name.gem] [--link <id>] [--limit <n>]",
2684
2812
  " uru gems power stop|start|restart [library/name.gem]",
2685
- " uru gems logs [library/name.gem] [--release <id>|--run <id>]",
2813
+ " uru gems logs [library/name.gem] [--release <id>|--run <id>] [--follow] [--export <file>]",
2686
2814
  " uru gems read <library/name.gem> <file>",
2687
2815
  " uru gems write <library/name.gem> <file> --file ./local.html"
2688
2816
  ]
@@ -2698,6 +2826,12 @@ var cliRootHelpGroups = [
2698
2826
  " uru library ls [path] List Library items",
2699
2827
  " uru library stat <path> Read Library item metadata",
2700
2828
  " uru library search <query> Search Library items",
2829
+ " uru library source list|get|inspect Manage connected Library sources",
2830
+ " uru library source create --params-json Create a source",
2831
+ " uru library source edit <id> --params-json Edit a source",
2832
+ " uru library source pause|resume|run-now|cancel <id>",
2833
+ " uru library source reconnect <id> --params-json Restore Drive access",
2834
+ " uru library history <type> <id> Read Library history",
2701
2835
  " uru library mkdir <path> Create a Library folder",
2702
2836
  " uru library read <path> Print a text-backed Library resource",
2703
2837
  " uru library write <path> --file ./note.md --create [--folder-id <id>]",
@@ -2717,6 +2851,10 @@ var cliRootHelpGroups = [
2717
2851
  lines: [
2718
2852
  " uru datasets ls [path] List Datasets in the Library",
2719
2853
  " uru datasets get|inspect|history|jobs|query <dataset-id>",
2854
+ " uru datasets source get|inspect <dataset-id> Inspect the source binding",
2855
+ " uru datasets source put|edit|connect|create|reconnect|test <dataset-id> --params-json {...}",
2856
+ " uru datasets source pause|resume|sync|run-now <dataset-id>",
2857
+ " uru datasets jobs get|cancel <dataset-id> <job-id>",
2720
2858
  " uru datasets create|update|rows|restore|sql|sql-write --params-json {...}",
2721
2859
  " Use the canonical Dataset tools"
2722
2860
  ]
@@ -2854,7 +2992,7 @@ function spec(id, summary, auth, workspace, safety, outputModes, cancellation =
2854
2992
  // package.json
2855
2993
  var package_default = {
2856
2994
  name: "@uru-intelligence/cli",
2857
- version: "0.4.19",
2995
+ version: "0.5.0",
2858
2996
  private: false,
2859
2997
  description: "Uru full-platform command line interface",
2860
2998
  repository: {
@@ -8960,6 +9098,17 @@ var zAppJobRun = object({
8960
9098
  inputSummary: record(string2(), unknown()).nullish(),
8961
9099
  jobKey: string2().nullish(),
8962
9100
  lastStatusAt: string2().nullish(),
9101
+ latestAttempt: object({
9102
+ attemptNumber: number2(),
9103
+ error: record(string2(), unknown()),
9104
+ hasCheckpoint: boolean2(),
9105
+ id: string2(),
9106
+ progress: record(string2(), unknown()),
9107
+ startedAt: string2(),
9108
+ status: string2(),
9109
+ stoppedAt: string2().nullable(),
9110
+ updatedAt: string2()
9111
+ }).nullish(),
8963
9112
  maxAttempts: number2().nullish(),
8964
9113
  metadata: record(string2(), unknown()).nullish(),
8965
9114
  nextRetryAt: string2().nullish(),
@@ -8998,6 +9147,10 @@ var zAppLogRecord = object({
8998
9147
  status: string2().nullish(),
8999
9148
  workspaceId: string2()
9000
9149
  });
9150
+ var zAppLogPage = object({
9151
+ logs: array(zAppLogRecord),
9152
+ nextCursor: string2().nullable()
9153
+ });
9001
9154
  var zAppPublishCheck = object({
9002
9155
  artifactId: string2(),
9003
9156
  checkKey: string2().nullish(),
@@ -9078,9 +9231,7 @@ var zAppResourceBindingUpsertRequest = object({
9078
9231
  "job",
9079
9232
  "endpoint",
9080
9233
  "storage"
9081
- ]),
9082
- toolCapabilityId: uuid2().nullish(),
9083
- toolConnectionId: string2().nullish()
9234
+ ])
9084
9235
  });
9085
9236
  var zAppRouteManifestRecord = object({
9086
9237
  accessPolicy: string2(),
@@ -9133,6 +9284,10 @@ var zAppRuntimeInvocationResponse = object({
9133
9284
  state: string2(),
9134
9285
  status: string2()
9135
9286
  });
9287
+ var zAppRuntimeLogStoreStatus = object({
9288
+ availability: _enum(["available", "not_configured", "unavailable"]),
9289
+ code: string2().nullish()
9290
+ });
9136
9291
  var zAppRuntimePowerAction = _enum(["stop", "start", "restart"]);
9137
9292
  var zAppRuntimePowerRequest = object({
9138
9293
  action: zAppRuntimePowerAction
@@ -9210,6 +9365,7 @@ var zAppReleaseOverview = object({
9210
9365
  environments: array(zAppEnvironment),
9211
9366
  jobRuns: array(zAppJobRun).optional(),
9212
9367
  linkTargets: array(zAppReleaseLinkTarget).optional(),
9368
+ logStoreStatus: zAppRuntimeLogStoreStatus.optional(),
9213
9369
  logs: array(zAppLogRecord),
9214
9370
  providerDeployments: array(zAppRuntimeProviderDeployment).optional(),
9215
9371
  providerReadiness: record(string2(), zAppRuntimeProviderReadinessReport).nullish(),
@@ -9218,8 +9374,7 @@ var zAppReleaseOverview = object({
9218
9374
  runtimeProfile: record(string2(), unknown()).nullable()
9219
9375
  });
9220
9376
  var zAppSafeBindingResolveRequest = object({
9221
- buildId: string2().min(1),
9222
- environmentKey: _enum(["preview", "release"]).optional().default("release")
9377
+ buildId: string2().min(1)
9223
9378
  });
9224
9379
  var zAppSafeBindingResolveResponse = object({
9225
9380
  artifactId: string2(),
@@ -9246,7 +9401,6 @@ var zAppSecretMetadata = object({
9246
9401
  workspaceId: string2()
9247
9402
  });
9248
9403
  var zAppSecretValueUpsertRequest = object({
9249
- environmentKey: _enum(["preview", "release"]).optional().default("release"),
9250
9404
  metadata: record(string2(), unknown()).optional().default({}),
9251
9405
  secretName: string2().min(1).max(128),
9252
9406
  secretValue: string2().min(1)
@@ -9335,6 +9489,38 @@ var zAppSupportBundleResponse = object({
9335
9489
  bundle: record(string2(), unknown()),
9336
9490
  record: zAppSupportBundleRecord
9337
9491
  });
9492
+ var zAppUploadCompleteResponse = object({
9493
+ cleanupFailed: boolean2(),
9494
+ contentType: string2(),
9495
+ filename: string2(),
9496
+ outcome: _enum([
9497
+ "verified",
9498
+ "pending",
9499
+ "absent",
9500
+ "expired",
9501
+ "unverifiable",
9502
+ "size_mismatch",
9503
+ "type_mismatch"
9504
+ ]),
9505
+ sizeBytes: number2().nullable(),
9506
+ state: _enum(["granted", "verified", "rejected", "expired"]),
9507
+ uploadId: string2()
9508
+ });
9509
+ var zAppUploadGrantRequest = strictObject({
9510
+ contentType: string2().min(3).max(255),
9511
+ filename: string2().min(1).max(255),
9512
+ sizeBytes: int().gte(1).lte(104857600)
9513
+ });
9514
+ var zAppUploadGrantResponse = object({
9515
+ contentType: string2(),
9516
+ expiresAt: string2(),
9517
+ filename: string2(),
9518
+ method: _enum(["PUT"]),
9519
+ requiredHeaders: record(string2(), string2()),
9520
+ sizeBytes: number2(),
9521
+ uploadId: string2(),
9522
+ uploadUrl: string2()
9523
+ });
9338
9524
  var zArtifactAiMessage = object({
9339
9525
  content: union([
9340
9526
  record(string2(), unknown()),
@@ -10957,11 +11143,16 @@ var zGemEditsPage = strictObject({
10957
11143
  edits: array(zGemEdit),
10958
11144
  nextCursor: string2().nullable()
10959
11145
  });
11146
+ var zGemGitSourceBindingError = strictObject({
11147
+ at: exports_iso.datetime({ offset: true }),
11148
+ code: string2().min(1).max(128),
11149
+ message: string2().min(1).max(512)
11150
+ }).nullable();
10960
11151
  var zGemGitSourceCallbackRequest = strictObject({
10961
11152
  code: string2().min(1).max(2048).optional(),
10962
- installationId: string2().regex(/^[1-9][0-9]{0,19}$\/u/).optional(),
11153
+ installationId: string2().regex(/^[1-9][0-9]{0,19}$/).optional(),
10963
11154
  setupAction: _enum(["install", "update", "request"]).optional(),
10964
- state: string2().regex(/^[A-Za-z0-9_-]{43}$\/u/)
11155
+ state: string2().regex(/^[A-Za-z0-9_-]{43}$/)
10965
11156
  });
10966
11157
  var zGemGitSourceCommand = union([
10967
11158
  strictObject({
@@ -10969,7 +11160,7 @@ var zGemGitSourceCommand = union([
10969
11160
  }),
10970
11161
  strictObject({
10971
11162
  action: _enum(["retry"]),
10972
- idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$\/u/),
11163
+ idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$/),
10973
11164
  importId: uuid2()
10974
11165
  }),
10975
11166
  strictObject({
@@ -10989,14 +11180,14 @@ var zGemGitSourceCommand = union([
10989
11180
  }),
10990
11181
  strictObject({
10991
11182
  action: _enum(["create_branch_preview"]),
10992
- commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11183
+ commitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
10993
11184
  ref: string2().min(1).max(512)
10994
11185
  }),
10995
11186
  strictObject({
10996
11187
  action: _enum(["approve_preview"]),
10997
- headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11188
+ headSha: string2().regex(/^[0-9a-fA-F]{40}$/),
10998
11189
  previewId: uuid2(),
10999
- resourcePolicyHash: string2().regex(/^[0-9a-f]{64}$\/iu/)
11190
+ resourcePolicyHash: string2().regex(/^[0-9a-fA-F]{64}$/)
11000
11191
  }),
11001
11192
  strictObject({
11002
11193
  action: _enum(["expire_preview"]),
@@ -11013,7 +11204,7 @@ var zGemGitSourceCommand = union([
11013
11204
  strictObject({
11014
11205
  action: _enum(["change_source"]),
11015
11206
  appDirectory: string2().max(240),
11016
- commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11207
+ commitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11017
11208
  expectedRevision: int().gt(0),
11018
11209
  ref: string2().min(1).max(512)
11019
11210
  })
@@ -11021,13 +11212,23 @@ var zGemGitSourceCommand = union([
11021
11212
  var zGemGitSourceConnectRequest = strictObject({
11022
11213
  appDirectory: string2().max(240),
11023
11214
  automaticPublishing: boolean2(),
11024
- commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11215
+ commitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11025
11216
  connectionId: uuid2(),
11026
11217
  folderId: uuid2().nullish(),
11027
- idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$\/u/),
11218
+ idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$/),
11028
11219
  previewsEnabled: boolean2(),
11029
11220
  ref: string2().min(1).max(512),
11030
- repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
11221
+ repositoryId: string2().regex(/^[1-9][0-9]{0,19}$/),
11222
+ title: string2().min(1).max(256)
11223
+ });
11224
+ var zGemGitSourceCopyResult = strictObject({
11225
+ artifactId: uuid2(),
11226
+ copiedFromArtifactId: uuid2(),
11227
+ copiedFromCommitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11228
+ copiedFromVersionId: uuid2(),
11229
+ copiedFromVersionNumber: int().gte(1),
11230
+ libraryItemId: uuid2().nullable(),
11231
+ slug: string2().min(1).max(256),
11031
11232
  title: string2().min(1).max(256)
11032
11233
  });
11033
11234
  var zGemGitSourceImportError = strictObject({
@@ -11038,7 +11239,7 @@ var zGemGitSourceImport = strictObject({
11038
11239
  attempt: int().gte(0),
11039
11240
  buildId: uuid2().nullable(),
11040
11241
  commitMessage: string2().max(16384),
11041
- commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11242
+ commitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11042
11243
  completedAt: exports_iso.datetime({ offset: true }).nullable(),
11043
11244
  createdAt: exports_iso.datetime({ offset: true }),
11044
11245
  error: zGemGitSourceImportError,
@@ -11058,13 +11259,11 @@ var zGemGitSourceImport = strictObject({
11058
11259
  "queued",
11059
11260
  "fetching",
11060
11261
  "validating",
11061
- "needs_version",
11062
11262
  "preparing",
11063
11263
  "ready",
11064
11264
  "needs_access",
11065
11265
  "needs_configuration",
11066
11266
  "needs_resource_grant",
11067
- "budget_blocked",
11068
11267
  "failed",
11069
11268
  "canceled",
11070
11269
  "superseded"
@@ -11076,7 +11275,7 @@ var zGemGitSourceInspectRequest = strictObject({
11076
11275
  appDirectory: string2().max(240),
11077
11276
  connectionId: uuid2(),
11078
11277
  ref: string2().min(1).max(512),
11079
- repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/)
11278
+ repositoryId: string2().regex(/^[1-9][0-9]{0,19}$/)
11080
11279
  });
11081
11280
  var zGemGitSourceInspectionDiagnostic = strictObject({
11082
11281
  code: string2().min(1).max(128),
@@ -11087,14 +11286,14 @@ var zGemGitSourceInspection = strictObject({
11087
11286
  appDirectory: string2().max(240),
11088
11287
  candidateDirectories: array(string2().max(240)).max(5000),
11089
11288
  commitMessage: string2().max(16384),
11090
- commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11289
+ commitSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11091
11290
  connectionId: uuid2(),
11092
11291
  diagnostics: array(zGemGitSourceInspectionDiagnostic).max(100),
11093
11292
  fileCount: int().gte(0).lte(5000),
11094
11293
  framework: string2().max(128).nullable(),
11095
11294
  proposedConfiguration: string2().max(65536).nullable(),
11096
11295
  ref: string2().min(1).max(512),
11097
- repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
11296
+ repositoryId: string2().regex(/^[1-9][0-9]{0,19}$/),
11098
11297
  resourceNeeds: array(object({
11099
11298
  kind: string2().min(1).max(128),
11100
11299
  name: string2().min(1).max(512)
@@ -11103,12 +11302,12 @@ var zGemGitSourceInspection = strictObject({
11103
11302
  totalBytes: int().gte(0).lte(25165824)
11104
11303
  });
11105
11304
  var zGemGitSourcePreview = strictObject({
11106
- approvedHeadSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
11305
+ approvedHeadSha: string2().regex(/^[0-9a-fA-F]{40}$/).nullable(),
11107
11306
  canOpen: boolean2(),
11108
11307
  error: zGemGitSourceImportError,
11109
11308
  expiresAt: exports_iso.datetime({ offset: true }),
11110
11309
  fork: boolean2(),
11111
- headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11310
+ headSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11112
11311
  id: uuid2(),
11113
11312
  pullRequestNumber: int().gt(0).nullable(),
11114
11313
  ref: string2().min(1).max(512),
@@ -11123,12 +11322,12 @@ var zGemGitSourcePreview = strictObject({
11123
11322
  title: string2().max(16384)
11124
11323
  });
11125
11324
  var zGemGitSourcePreviewInspectRequest = strictObject({
11126
- headSha: string2().regex(/^[0-9a-f]{40}$\/iu/)
11325
+ headSha: string2().regex(/^[0-9a-fA-F]{40}$/)
11127
11326
  });
11128
11327
  var zGemGitSourcePreviewInspection = strictObject({
11129
11328
  appDirectory: string2().max(240),
11130
11329
  diagnostics: array(zGemGitSourceInspectionDiagnostic).max(100),
11131
- headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
11330
+ headSha: string2().regex(/^[0-9a-fA-F]{40}$/),
11132
11331
  previewId: uuid2(),
11133
11332
  proposedConfiguration: string2().max(65536).nullable(),
11134
11333
  ref: string2().min(1).max(512),
@@ -11136,26 +11335,33 @@ var zGemGitSourcePreviewInspection = strictObject({
11136
11335
  kind: string2().min(1).max(128),
11137
11336
  name: string2().min(1).max(512)
11138
11337
  })).max(100),
11139
- resourcePolicyHash: string2().regex(/^[0-9a-f]{64}$\/iu/).nullable(),
11338
+ resourcePolicyHash: string2().regex(/^[0-9a-fA-F]{64}$/).nullable(),
11140
11339
  state: _enum(["ready", "needs_configuration", "rejected"])
11141
11340
  });
11142
- var zGemGitSourceRefs = array(object({
11341
+ var zGemGitSourceRef = strictObject({
11143
11342
  kind: _enum(["branch", "tag"]),
11144
11343
  name: string2().min(1).max(512),
11145
11344
  ref: string2().min(1).max(512)
11146
- })).max(2000);
11345
+ });
11346
+ var zGemGitSourceRefs = strictObject({
11347
+ defaultBranch: zGemGitSourceRef,
11348
+ nextPage: int().gte(2).lte(100).nullable(),
11349
+ refs: array(zGemGitSourceRef).max(300)
11350
+ });
11147
11351
  var zGemGitSourceRefsRequest = strictObject({
11148
11352
  connectionId: uuid2(),
11149
- repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/)
11353
+ page: int().gte(1).lte(100).optional(),
11354
+ query: string2().max(512).optional(),
11355
+ repositoryId: string2().regex(/^[1-9][0-9]{0,19}$/)
11150
11356
  });
11151
11357
  var zGemGitSourceRepository = strictObject({
11152
11358
  connectionId: uuid2(),
11153
11359
  defaultBranch: string2().min(1).max(512),
11154
- installationId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
11360
+ installationId: string2().regex(/^[1-9][0-9]{0,19}$/),
11155
11361
  name: string2().min(1).max(255),
11156
11362
  owner: string2().min(1).max(255),
11157
11363
  private: boolean2(),
11158
- repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
11364
+ repositoryId: string2().regex(/^[1-9][0-9]{0,19}$/),
11159
11365
  url: url().max(2048)
11160
11366
  });
11161
11367
  var zGemGitSourceConnection = strictObject({
@@ -11196,11 +11402,12 @@ var zGemGitSourceState = strictObject({
11196
11402
  access: _enum(["active", "suspended", "revoked", "needs_access"]),
11197
11403
  active: boolean2(),
11198
11404
  appDirectory: string2().max(240),
11199
- currentCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
11200
- desiredCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
11405
+ currentCommitSha: string2().regex(/^[0-9a-fA-F]{40}$/).nullable(),
11406
+ desiredCommitSha: string2().regex(/^[0-9a-fA-F]{40}$/).nullable(),
11201
11407
  generation: int().gte(0),
11202
11408
  id: uuid2(),
11203
- lastBuiltCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
11409
+ lastBuiltCommitSha: string2().regex(/^[0-9a-fA-F]{40}$/).nullable(),
11410
+ lastError: zGemGitSourceBindingError,
11204
11411
  ref: string2().min(1).max(512),
11205
11412
  repository: zGemGitSourceRepository
11206
11413
  }).nullable(),
@@ -12019,6 +12226,7 @@ var zLibraryExternalSourceStatus = _enum([
12019
12226
  "pending",
12020
12227
  "ready",
12021
12228
  "syncing",
12229
+ "deleting",
12022
12230
  "error",
12023
12231
  "rebind_required"
12024
12232
  ]);
@@ -12814,6 +13022,24 @@ var zModelRelayForwardRequest = strictObject({
12814
13022
  opaqueToken: string2().min(1),
12815
13023
  provider: string2().min(1)
12816
13024
  });
13025
+ var zModelRelayImageRequest = strictObject({
13026
+ opaqueToken: string2().min(1),
13027
+ outputFormat: _enum(["png", "jpeg", "webp"]).optional().default("png"),
13028
+ prompt: string2().min(1).max(4000),
13029
+ quality: _enum(["low", "medium", "high", "auto"]).optional().default("auto"),
13030
+ size: _enum(["1024x1024", "1536x1024", "1024x1536", "auto"]).optional().default("auto")
13031
+ });
13032
+ var zModelRelayImageResponse = object({
13033
+ costUsd: string2(),
13034
+ imageBase64: string2(),
13035
+ mimeType: string2(),
13036
+ model: string2(),
13037
+ usage: object({
13038
+ imageOutputTokens: int().gte(0),
13039
+ inputTokens: int().gte(0),
13040
+ textOutputTokens: int().gte(0)
13041
+ })
13042
+ });
12817
13043
  var zModelRelayKillSwitchEngageRequest = object({
12818
13044
  reason: string2().min(1)
12819
13045
  });
@@ -13284,6 +13510,15 @@ var zProtectedResourceMetadata = object({
13284
13510
  });
13285
13511
  var zProviderAppRuntimePanelLogsResponse = object({
13286
13512
  deploymentId: string2(),
13513
+ logStatus: object({
13514
+ code: string2().nullable(),
13515
+ historicalComplete: boolean2(),
13516
+ sink: object({
13517
+ availability: _enum(["available", "not_configured", "unavailable"]),
13518
+ code: string2().nullable()
13519
+ }),
13520
+ state: _enum(["complete", "partial", "delayed", "lost"])
13521
+ }),
13287
13522
  logs: array(object({
13288
13523
  capabilityName: string2().nullable(),
13289
13524
  durationMs: number2().nullable(),
@@ -13293,7 +13528,7 @@ var zProviderAppRuntimePanelLogsResponse = object({
13293
13528
  message: string2().nullable(),
13294
13529
  metadata: record(string2(), unknown()),
13295
13530
  requestId: string2().nullable(),
13296
- source: _enum(["app_logs", "tenant_tail"]),
13531
+ source: _enum(["app_logs", "tenant_tail", "tenant_loki"]),
13297
13532
  status: string2().nullable(),
13298
13533
  timestamp: string2()
13299
13534
  })),
@@ -13625,6 +13860,10 @@ var zRestoreGemVersionResponse = strictObject({
13625
13860
  var zRetryGemReleaseRequest = strictObject({
13626
13861
  idempotencyKey: string2().min(1).max(128)
13627
13862
  });
13863
+ var zRetryGemVersionResponse = strictObject({
13864
+ linksChanged: literal(false),
13865
+ version: zGemVersion
13866
+ });
13628
13867
  var zRevokeCrossWorkspaceShareRequest = object({
13629
13868
  reason: string2().nullish(),
13630
13869
  shareId: uuid2()
@@ -13914,6 +14153,7 @@ var zPersonaIntegrationResponse = object({
13914
14153
  data: zPersonaIntegration
13915
14154
  });
13916
14155
  var zSupabaseExternalDatasetWebhookRequest = object({
14156
+ eventId: string2().min(1).max(64).optional(),
13917
14157
  schema: string2().nullish(),
13918
14158
  table: string2().nullish()
13919
14159
  });
@@ -14839,6 +15079,7 @@ var zThreadMessagePart = union([
14839
15079
  "provider_content_filtered",
14840
15080
  "context_window_exceeded",
14841
15081
  "compaction_loop_exceeded",
15082
+ "compaction_refused",
14842
15083
  "automation_turn_budget_exceeded",
14843
15084
  "output_length_limit_reached",
14844
15085
  "out_of_usage",
@@ -15293,6 +15534,10 @@ var zUpdateConnectionLabelResponse = object({
15293
15534
  var zUpdateExternalPermissionsRequest = object({
15294
15535
  permissions: zExternalPermissions
15295
15536
  });
15537
+ var zUpdateLibraryExternalSourceRequest = object({
15538
+ enabled: boolean2().optional(),
15539
+ syncIntervalMinutes: int().gte(1).lte(10080).optional()
15540
+ });
15296
15541
  var zUpdatePersonaIdentity = object({
15297
15542
  avatarUrl: string2().nullish(),
15298
15543
  departments: array(string2()).nullish(),
@@ -15346,7 +15591,7 @@ var zUpdatePersonaRequest = object({
15346
15591
  var zUpdatePublishedPageLinkGateRequest = object({
15347
15592
  emailAllowlist: array(string2()).nullish(),
15348
15593
  emailGateEnabled: boolean2().nullish(),
15349
- expiresAt: string2().nullish(),
15594
+ expiresAt: exports_iso.datetime({ offset: true }).nullish(),
15350
15595
  gateType: _enum(["none", "passcode", "email_otp", "passcode_email_otp"]).nullish(),
15351
15596
  passcode: string2().max(128).nullish(),
15352
15597
  searchIndexingDisabled: boolean2().nullish(),
@@ -15924,7 +16169,13 @@ var zGetToolAccessMatrixApiAccessControlToolsToolMatrixGetPath = object({
15924
16169
  });
15925
16170
  var zGetAdminAuditLogApiAdminAuditLogGetQuery = object({
15926
16171
  limit: int().gte(1).lte(100).optional().default(50),
15927
- offset: int().gte(0).nullish().default(0)
16172
+ offset: int().gte(0).nullish().default(0),
16173
+ actorUserId: string2().optional(),
16174
+ action: string2().min(1).max(120).optional(),
16175
+ targetType: string2().min(1).max(80).optional(),
16176
+ targetId: string2().min(1).max(200).optional(),
16177
+ since: exports_iso.datetime({ offset: true }).optional(),
16178
+ until: exports_iso.datetime({ offset: true }).optional()
15928
16179
  });
15929
16180
  var zAdminListInvitationsApiAdminInvitationsGetQuery = object({
15930
16181
  limit: int().gte(1).lte(100).optional().default(50),
@@ -16914,9 +17165,25 @@ var zGetAvailableModelsApiModelsAvailableGetQuery = object({
16914
17165
  });
16915
17166
  var zExportActivityLogsApiMonitoringActivityExportGetQuery = object({
16916
17167
  dateRange: string2().optional().default("7d"),
16917
- format: string2().optional().default("json")
17168
+ format: string2().optional().default("json"),
17169
+ action: string2().nullish(),
17170
+ resourceType: string2().nullish(),
17171
+ actorUserId: string2().nullish()
16918
17172
  });
16919
17173
  var zExportActivityLogsApiMonitoringActivityExportGetResponse = record(string2(), unknown());
17174
+ var zListAuditLedgerApiMonitoringActivityLedgersLedgerGetPath = object({
17175
+ ledger: _enum([
17176
+ "rubric_events",
17177
+ "webhook_credential_events",
17178
+ "dataset_sql_writes"
17179
+ ])
17180
+ });
17181
+ var zListAuditLedgerApiMonitoringActivityLedgersLedgerGetQuery = object({
17182
+ page: int().gte(1).optional().default(1),
17183
+ pageSize: int().gte(1).lte(200).optional().default(50),
17184
+ dateRange: string2().optional().default("7d")
17185
+ });
17186
+ var zListAuditLedgerApiMonitoringActivityLedgersLedgerGetResponse = record(string2(), unknown());
16920
17187
  var zGetRecentActivityApiMonitoringActivityRecentGetQuery = object({
16921
17188
  limit: int().gte(1).lte(500).optional().default(100)
16922
17189
  });
@@ -17373,11 +17640,14 @@ var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetPath = object({
17373
17640
  var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetQuery = object({
17374
17641
  limit: int().gte(1).lte(500).optional().default(100),
17375
17642
  deploymentId: string2().nullish(),
17643
+ releaseId: string2().nullish(),
17376
17644
  runtimeRunId: string2().nullish(),
17377
17645
  level: string2().nullish(),
17378
- requestId: string2().nullish()
17646
+ requestId: string2().nullish(),
17647
+ cursor: string2().nullish(),
17648
+ since: string2().nullish(),
17649
+ until: string2().nullish()
17379
17650
  });
17380
- var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetResponse = array(zAppLogRecord);
17381
17651
  var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetPath = object({
17382
17652
  artifactSlug: string2()
17383
17653
  });
@@ -17388,7 +17658,9 @@ var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetQuery = object
17388
17658
  releaseId: string2().nullish(),
17389
17659
  runtimeRunId: string2().nullish(),
17390
17660
  level: string2().nullish(),
17391
- requestId: string2().nullish()
17661
+ requestId: string2().nullish(),
17662
+ since: string2().nullish(),
17663
+ until: string2().nullish()
17392
17664
  });
17393
17665
  var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetResponse = string2();
17394
17666
  var zGetAppReleaseOverviewApiPlatformArtifactsArtifactSlugAppReleaseOverviewGetPath = object({
@@ -18154,6 +18426,8 @@ var zDatasetExternalSourceGetResponse = object({
18154
18426
  relationName: string2().nullable(),
18155
18427
  relationSchema: string2().nullable(),
18156
18428
  supabaseRef: string2(),
18429
+ syncIntervalSeconds: int(),
18430
+ syncMode: _enum(["manual", "scheduled"]),
18157
18431
  workspaceId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
18158
18432
  writeEnabled: boolean2().nullable()
18159
18433
  }).nullable();
@@ -18176,6 +18450,8 @@ var zDatasetExternalSourcePutBody = object({
18176
18450
  relationName: string2().nullish().default(null),
18177
18451
  relationSchema: string2().nullish().default(null),
18178
18452
  supabaseRef: string2().min(1),
18453
+ syncIntervalSeconds: int().gte(60).lte(86400).optional().default(1800),
18454
+ syncMode: _enum(["manual", "scheduled"]).optional().default("manual"),
18179
18455
  writeEnabled: boolean2().nullish().default(null)
18180
18456
  });
18181
18457
  var zDatasetExternalSourcePutPath = object({
@@ -18204,9 +18480,38 @@ var zDatasetExternalSourcePutResponse = object({
18204
18480
  relationName: string2().nullable(),
18205
18481
  relationSchema: string2().nullable(),
18206
18482
  supabaseRef: string2(),
18483
+ syncIntervalSeconds: int(),
18484
+ syncMode: _enum(["manual", "scheduled"]),
18207
18485
  workspaceId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
18208
18486
  writeEnabled: boolean2().nullable()
18209
18487
  });
18488
+ var zDatasetExternalSourceSyncBody = strictObject({
18489
+ expectedDatasetRevision: string2().regex(/^(0|[1-9][0-9]{0,19})$/),
18490
+ expectedSchemaRevision: string2().regex(/^(0|[1-9][0-9]{0,19})$/),
18491
+ idempotencyKey: string2().min(1).max(128)
18492
+ });
18493
+ var zDatasetExternalSourceSyncPath = object({
18494
+ datasetId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)
18495
+ });
18496
+ var zDatasetExternalSourceSyncResponse = object({
18497
+ commandId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
18498
+ currentDatasetRevision: string2().regex(/^(0|[1-9][0-9]{0,19})$/),
18499
+ currentSchemaRevision: string2().regex(/^(0|[1-9][0-9]{0,19})$/),
18500
+ datasetId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
18501
+ jobId: string2().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
18502
+ operation: _enum(["external_source"]),
18503
+ replayed: boolean2(),
18504
+ state: _enum([
18505
+ "queued",
18506
+ "claimed",
18507
+ "running",
18508
+ "cancelRequested",
18509
+ "finalizing",
18510
+ "succeeded",
18511
+ "failed",
18512
+ "cancelled"
18513
+ ])
18514
+ });
18210
18515
  var zDatasetExternalSourceTestBody = object({
18211
18516
  allowedColumns: array(string2().min(1)).nullish().default(null),
18212
18517
  allowedWriteColumns: array(string2()).nullish().default(null),
@@ -18226,6 +18531,8 @@ var zDatasetExternalSourceTestBody = object({
18226
18531
  relationName: string2().nullish().default(null),
18227
18532
  relationSchema: string2().nullish().default(null),
18228
18533
  supabaseRef: string2().min(1),
18534
+ syncIntervalSeconds: int().gte(60).lte(86400).optional().default(1800),
18535
+ syncMode: _enum(["manual", "scheduled"]).optional().default("manual"),
18229
18536
  writeEnabled: boolean2().nullish().default(null)
18230
18537
  });
18231
18538
  var zDatasetExternalSourceTestPath = object({
@@ -18972,6 +19279,9 @@ var zGetFrictionReportCleanupResponse = object({
18972
19279
  severity: string2(),
18973
19280
  status: string2()
18974
19281
  });
19282
+ var zDeleteGemLinkHeaders = object({
19283
+ "idempotency-key": string2().min(1).max(200)
19284
+ });
18975
19285
  var zDeleteGemLinkPath = object({
18976
19286
  linkId: string2()
18977
19287
  });
@@ -18983,10 +19293,16 @@ var zUpdateGemLinkAccessResponse = record(string2(), unknown());
18983
19293
  var zCreateGemLinkEmailCaptureDatasetPath = object({
18984
19294
  linkId: string2()
18985
19295
  });
19296
+ var zRevokeGemLinkHeaders = object({
19297
+ "idempotency-key": string2().min(1).max(200)
19298
+ });
18986
19299
  var zRevokeGemLinkPath = object({
18987
19300
  linkId: string2()
18988
19301
  });
18989
19302
  var zRevokeGemLinkResponse = record(string2(), unknown());
19303
+ var zRotateGemLinkHeaders = object({
19304
+ "idempotency-key": string2().min(1).max(200)
19305
+ });
18990
19306
  var zRotateGemLinkPath = object({
18991
19307
  linkId: string2()
18992
19308
  });
@@ -19104,6 +19420,10 @@ var zRestoreGemVersionPath = object({
19104
19420
  gemRef: string2().min(1),
19105
19421
  resourceId: string2().min(1)
19106
19422
  });
19423
+ var zRetryGemVersionPath = object({
19424
+ gemRef: string2().min(1),
19425
+ resourceId: string2().min(1)
19426
+ });
19107
19427
  var zGetAvailableLibrariesApiPlatformLibrariesAvailableGetResponse = record(string2(), unknown());
19108
19428
  var zGetAvailableIconsApiPlatformLibrariesIconsGetResponse = record(string2(), unknown());
19109
19429
  var zGetLibrariesManifestApiPlatformLibrariesManifestGetResponse = record(string2(), unknown());
@@ -19128,9 +19448,24 @@ var zDeleteLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdDeleteP
19128
19448
  var zGetLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdGetPath = object({
19129
19449
  sourceId: string2()
19130
19450
  });
19451
+ var zUpdateLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdPatchPath = object({
19452
+ sourceId: string2()
19453
+ });
19454
+ var zCancelLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdCancelPostPath = object({
19455
+ sourceId: string2()
19456
+ });
19457
+ var zPauseLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdPausePostPath = object({
19458
+ sourceId: string2()
19459
+ });
19131
19460
  var zRebindLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdRebindPostPath = object({
19132
19461
  sourceId: string2()
19133
19462
  });
19463
+ var zResumeLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdResumePostPath = object({
19464
+ sourceId: string2()
19465
+ });
19466
+ var zRunNowLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdRunNowPostPath = object({
19467
+ sourceId: string2()
19468
+ });
19134
19469
  var zSyncLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdSyncPostPath = object({
19135
19470
  sourceId: string2()
19136
19471
  });
@@ -19750,8 +20085,9 @@ var zGetPublishedPagePreviewImageApiPublicPagesSlugPreviewImagePublicPreviewRout
19750
20085
  var zPublicArtifactToolProxyExecuteApiPublicPagesSlugToolProxyExecutePostBody = strictObject({
19751
20086
  forceRefresh: boolean2().optional().default(false),
19752
20087
  idempotencyKey: string2().max(128).nullish(),
19753
- operation: string2().min(1).max(256).regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/),
20088
+ operation: string2().min(1).max(256),
19754
20089
  parameters: record(string2(), unknown()).optional().default({}),
20090
+ requestId: string2().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/).optional(),
19755
20091
  role: string2().min(1).max(64).regex(/^[a-z][a-z0-9_]{0,63}$/),
19756
20092
  timeoutMs: int().gte(1000).lte(60000).optional().default(25000)
19757
20093
  });
@@ -19840,6 +20176,13 @@ var zInvokeAppQueryApiRuntimeAppsDeploymentIdQueryCapabilityNamePostPath = objec
19840
20176
  var zAppRuntimeStorageExecutePath = object({
19841
20177
  deploymentId: uuid2()
19842
20178
  });
20179
+ var zAppRuntimeUploadGrantCreatePath = object({
20180
+ deploymentId: uuid2()
20181
+ });
20182
+ var zAppRuntimeUploadGrantCompletePath = object({
20183
+ deploymentId: uuid2(),
20184
+ uploadId: uuid2()
20185
+ });
19843
20186
  var zProviderInvokeAppActionApiRuntimeProviderAppsDeploymentIdActionCapabilityNamePostPath = object({
19844
20187
  deploymentId: string2(),
19845
20188
  capabilityName: string2()
@@ -20308,6 +20651,9 @@ var zGetGemGitSourcePath = object({
20308
20651
  var zCommandGemGitSourcePath = object({
20309
20652
  artifactId: uuid2()
20310
20653
  });
20654
+ var zCopyGemGitSourcePath = object({
20655
+ artifactId: uuid2()
20656
+ });
20311
20657
  var zInspectGemGitPreviewPath = object({
20312
20658
  artifactId: uuid2(),
20313
20659
  previewId: uuid2()
@@ -20369,6 +20715,17 @@ var zRobotsTxtRobotsTxtGetResponse = string2();
20369
20715
 
20370
20716
  // ../../packages/types/src/mcp/gemResult.ts
20371
20717
  var GEM_RESULT_SCHEMA_V1 = "uru.gem.result.v1";
20718
+ // src/terminal-safety.ts
20719
+ function stripTerminalControl(value) {
20720
+ let out = "";
20721
+ for (const ch of value) {
20722
+ const code = ch.codePointAt(0) ?? 0;
20723
+ const isControl = code < 32 && code !== 10 && code !== 9 || code === 127 || code >= 128 && code <= 159;
20724
+ out += isControl ? "�" : ch;
20725
+ }
20726
+ return out;
20727
+ }
20728
+
20372
20729
  // src/json.ts
20373
20730
  function isRecord(value) {
20374
20731
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -20413,17 +20770,6 @@ function pickString(record2, keys) {
20413
20770
  return;
20414
20771
  }
20415
20772
 
20416
- // src/gem-panel-client.ts
20417
- function stripTerminalControl(value) {
20418
- let out = "";
20419
- for (const ch of value) {
20420
- const code = ch.codePointAt(0) ?? 0;
20421
- const isControl = code < 32 && code !== 10 && code !== 9 || code === 127 || code >= 128 && code <= 159;
20422
- out += isControl ? "�" : ch;
20423
- }
20424
- return out;
20425
- }
20426
-
20427
20773
  // src/gem-result.ts
20428
20774
  function gemEnvelope(body, operation) {
20429
20775
  if (!isRecord(body) || body["schema"] !== GEM_RESULT_SCHEMA_V1) {
@@ -21992,19 +22338,24 @@ Upload local Gem source with source-version CAS. Without a matching lock, push
21992
22338
  fails instead of silently overwriting remote edits. Generated directories,
21993
22339
  node_modules, VCS metadata, and local env files are excluded.
21994
22340
  `,
21995
- logs: `Usage: uru logs [library/name.gem] [--release <id>|--run <id>] [--limit 100] [--follow]
22341
+ logs: `Usage: uru logs [library/name.gem] [--release <id>|--run <id>] [--since <time>] [--until <time>] [--request-id <id>] [--limit 100] [--cursor <cursor>] [--follow] [--export <file>]
21996
22342
 
21997
- Print bounded runtime logs for the Gem, one logical Release, or one Run. With --follow,
21998
- the CLI streams runtime logs for up to 30 minutes and polls if the stream is unavailable;
21999
- text status goes to stderr and log lines go to stdout. Use global --output stream-json
22000
- or --output-format stream-json before the command to emit NDJSON events.
22343
+ Print bounded runtime logs for the Gem, one logical Release, or one Run. Filter by
22344
+ ISO time, request, release, run, or level. With --request-id, the lines are
22345
+ grouped into one ordered waterfall per request, each step placed against that
22346
+ request's own start; --json keeps the raw page. With --follow, the CLI streams
22347
+ runtime logs for up to 30 minutes over the same server-sent stream the web
22348
+ Activity tab uses, after one bounded read of the recent page. Use --export to
22349
+ write a JSON array of the returned lines. Text status goes to stderr and log lines
22350
+ go to stdout. Use global --output stream-json or --output-format stream-json before
22351
+ the command to emit NDJSON events.
22001
22352
  `,
22002
22353
  open: `Usage: uru open [library/name.gem] [--link <link-id-or-name>]
22003
22354
 
22004
22355
  Print one explicit active Link URL. When a Gem has more than one active Link,
22005
22356
  use --link to choose the Link rather than guessing which URL you mean.
22006
22357
  `,
22007
- gems: `Usage: uru gems <inspect|validate|build|deploy|verify|fs|status|source|read|write|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|logs> [...]
22358
+ gems: `Usage: uru gems <inspect|validate|build|deploy|verify|fs|status|source|read|write|edits|versions|releases|links|runs|capabilities|schedules|events|bindings|components|delegations|api|domains|analytics|power|logs|debug-token> [...]
22008
22359
  uru gems validate [library/name.gem] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
22009
22360
  uru gems build [library/name.gem] [--force] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
22010
22361
 
@@ -22012,7 +22363,11 @@ Dedicated Gem lifecycle and filesystem commands. These are adapters over the
22012
22363
  same platform operations used by MCP and the web UI.
22013
22364
 
22014
22365
  validate and build return a hosted_job_id immediately. Pass --wait to poll
22015
- gem.build_job until the compile is succeeded, failed, or expired.
22366
+ gem.build_job until the compile is succeeded, failed, or expired. Gem logs accept
22367
+ the same time, request, release, run, follow, and export flags as uru logs.
22368
+ uru gems debug-token mints a read-only debug session for ONE deployment, good
22369
+ for at most 15 minutes. Use it to inspect a running Gem; it authorizes the
22370
+ deployment's log route and nothing else.
22016
22371
  `,
22017
22372
  "gems fs": `Usage: uru gems fs ls [library/name.gem] [path] [--recursive]
22018
22373
  uru gems fs read [library/name.gem] <file>
@@ -22062,9 +22417,11 @@ operation for this grant.
22062
22417
  uru gems versions diff [library/name.gem] <from-version> <to-version>
22063
22418
  uru gems versions restore [library/name.gem] <version>
22064
22419
  uru gems versions preview [library/name.gem] <version>
22420
+ uru gems versions retry [library/name.gem] <version>
22065
22421
 
22066
22422
  Save and inspect frozen Gem checkpoints. Name and message are optional. Saving,
22067
- restoring, previewing, and comparing Versions do not change any Link.
22423
+ restoring, previewing, and comparing Versions do not change any Link. Retry
22424
+ builds a Version that failed again, keeping the same Version number.
22068
22425
  `,
22069
22426
  "gems edits": `Usage: uru gems edits list [library/name.gem]
22070
22427
  uru gems edits show [library/name.gem] <edit>
@@ -22095,12 +22452,14 @@ Version instead. --version on its own is refused, because a following Link would
22095
22452
  discard it and publish something else. Changing one Link does not move any other
22096
22453
  Link.
22097
22454
  `,
22098
- "gems runs": `Usage: uru gems runs list [library/name.gem] [--cursor <cursor>] [--limit <n>] [--status <status>]
22455
+ "gems runs": `Usage: uru gems runs list [library/name.gem] [--cursor <cursor>] [--environment <environment>] [--limit <n>] [--status <status>] [--version <version-id>]
22099
22456
  uru gems runs show [library/name.gem] <run>
22100
22457
  uru gems runs cancel [library/name.gem] <run>
22101
22458
 
22102
- Inspect and control bounded Gem executions. Builds and Release attempts are not
22103
- Runs. Gems without a bounded execution capability do not have Runs.
22459
+ Inspect and control bounded Gem executions. Use --environment and --version to
22460
+ filter runs from one published environment or Version. Builds and Release
22461
+ attempts are not Runs. Gems without a bounded execution capability do not have
22462
+ Runs.
22104
22463
  `,
22105
22464
  "gems capabilities": `Usage: uru gems capabilities list [library/name.gem]
22106
22465
  uru gems capabilities enable|disable [library/name.gem] <capability> --kind <query|action|job>
@@ -22114,24 +22473,38 @@ required when changing a capability because names are not globally unique.
22114
22473
 
22115
22474
  Inspect and control declared Gem job schedules. Run now requires an explicit
22116
22475
  idempotency key so a retry cannot start a second job.
22476
+ `,
22477
+ "gems events": `Usage: uru gems events list [library/name.gem]
22478
+ uru gems events update [library/name.gem] <target-id> [--state active|paused] [--input-json '{...}']
22479
+ uru gems events pause|resume [library/name.gem] <target-id>
22480
+ uru gems events run [library/name.gem] <target-id> --idempotency-key <key>
22481
+
22482
+ Inspect and control Gem event rules that start jobs. Run now requires an
22483
+ explicit idempotency key so a retry cannot start a second job.
22117
22484
  `,
22118
22485
  "gems bindings": `Usage: uru gems bindings list [library/name.gem]
22119
22486
  uru gems bindings upsert [library/name.gem] --source-ref-type <type> --source-ref <ref> --target-resource-type <type>
22487
+ uru gems bindings upsert [library/name.gem] --binding-choices '{"role":"connection_ref"}' --expected-binding-set-version <n> --expected-binding-set-hash <hash>
22120
22488
  uru gems bindings resolve [library/name.gem] --build <build-id>
22121
22489
 
22122
22490
  List declared Gem needs, bind a need to an approved connection or resource, or
22123
22491
  resolve deterministic safe bindings for a ready Build. Source names a logical
22124
- role. Bindings attach the live connection. Do not put connection ids in Gem
22125
- source.
22492
+ role. A tool role binds only through \`--binding-choices\`: read the current
22493
+ version, hash and connection_ref values from \`bindings list\`, then submit the
22494
+ complete role map back. Every other declared need (a dataset, a persona, a
22495
+ query) binds with the plain \`--source-ref-type\` form. Do not put connection
22496
+ ids in Gem source.
22126
22497
  `,
22127
22498
  "gems api": `Usage: uru gems api describe [library/name.gem]
22128
- uru gems api query [library/name.gem] <capability> [--input-json '{...}']
22129
- uru gems api action [library/name.gem] <capability> --idempotency-key <key> [--input-json '{...}']
22130
- uru gems api job [library/name.gem] <capability> --idempotency-key <key> [--input-json '{...}']
22499
+ uru gems api query [library/name.gem] <capability> [--deployment <id>] [--input-json '{...}']
22500
+ uru gems api action [library/name.gem] <capability> --idempotency-key <key> [--deployment <id>] [--input-json '{...}']
22501
+ uru gems api job [library/name.gem] <capability> --idempotency-key <key> [--deployment <id>] [--input-json '{...}']
22131
22502
 
22132
22503
  Describe what a published Gem offers, then run one declared query, action, or
22133
- job. Call describe before query, action, or job. Actions and jobs require an
22134
- idempotency key.
22504
+ job. A job can run a declared tool or a program handler. Call describe before
22505
+ query, action, or job. Actions and jobs require an idempotency key. Save the
22506
+ request, run, and execution ids returned by a job before you inspect or cancel
22507
+ it.
22135
22508
  `,
22136
22509
  "gems domains": `Usage: uru gems domains list [library/name.gem] [--limit <n>]
22137
22510
  uru gems domains set [library/name.gem] <hostname>
@@ -22152,6 +22525,13 @@ requests and need --yes. The runtime alias uses the same operations.
22152
22525
  library: `Usage: uru library ls [path]
22153
22526
  uru library stat <path>
22154
22527
  uru library search <query>
22528
+ uru library source list|get|inspect
22529
+ uru library source create|edit <source-id> --params-json '{...}'
22530
+ uru library source pause|resume|run-now|cancel <source-id>
22531
+ uru library source reconnect <source-id> --params-json '{...}'
22532
+ uru library source remove <source-id> --yes
22533
+ uru library history <resource-type> <resource-id> [--limit 20] [--cursor <cursor>]
22534
+ uru library history get <resource-type> <resource-id> <revision>
22155
22535
  uru library mkdir <path>
22156
22536
  uru library read <path>
22157
22537
  uru library write <path> (--file <local-path>|--content <text>|--stdin) [--create] [--folder-id <id>]
@@ -22175,7 +22555,8 @@ known. Patch and patch-preview take a Codex envelope, not a full file
22175
22555
  replacement. For binary files, use \`uru library upload\`
22176
22556
  (\`library.upload_preflight\`, \`library.upload_create_session\`,
22177
22557
  \`library.upload_complete_session\`); for Gem child source files, use
22178
- \`uru gems read|write\`.
22558
+ \`uru gems read|write\`. Source controls use the same library.sources_* operations
22559
+ as MCP. History reads immutable Library revisions.
22179
22560
  `,
22180
22561
  "library upload": `Usage: uru library upload [path] --file <local-path> [--folder-id <id>] [--conflict replace|keep_both|skip]
22181
22562
  uru library upload preflight [path] [--filename <name>] [--folder-id <id>]
@@ -22190,6 +22571,10 @@ creates a session. PUT the bytes to the returned endpoint, then complete.
22190
22571
  uru datasets get|inspect <dataset-id>
22191
22572
  uru datasets history <dataset-id> [--limit 100] [--cursor <cursor>] [--version-id <id>]
22192
22573
  uru datasets jobs <dataset-id> [--limit 100] [--cursor <cursor>]
22574
+ uru datasets jobs get|cancel <dataset-id> <job-id>
22575
+ uru datasets source get|inspect <dataset-id>
22576
+ uru datasets source put|edit|connect|create|reconnect|test <dataset-id> --params-json '{...}'
22577
+ uru datasets source pause|resume|sync|run-now <dataset-id>
22193
22578
  uru datasets query <dataset-id> [--limit 100] [--cursor <cursor>] [--filter-json '{...}'] [--select name,status]
22194
22579
  uru datasets create|update|rows|restore|sql|sql-write --params-json '{...}'
22195
22580
 
@@ -23638,6 +24023,7 @@ class UruSdkError extends Error {
23638
24023
  }
23639
24024
 
23640
24025
  // src/local-commands.ts
24026
+ import { randomUUID } from "node:crypto";
23641
24027
  import { readFile as readFile3, stat } from "node:fs/promises";
23642
24028
  import { basename, resolve as resolve2 } from "node:path";
23643
24029
  import { setTimeout as sleep } from "node:timers/promises";
@@ -24111,7 +24497,14 @@ var REGISTRY_FAMILY_SNAKE_CASE_ALIASES = new Set([
24111
24497
  "item_id",
24112
24498
  "label_id",
24113
24499
  "label_value",
24114
- "max_results"
24500
+ "max_results",
24501
+ "source_id",
24502
+ "connection_id",
24503
+ "target_folder_id",
24504
+ "drive_id",
24505
+ "file_ids",
24506
+ "folder_ids",
24507
+ "sync_interval_minutes"
24115
24508
  ]);
24116
24509
  function canonicalCliFieldToToolProtocol(key) {
24117
24510
  if (REGISTRY_FAMILY_SNAKE_CASE_ALIASES.has(key)) {
@@ -24161,6 +24554,14 @@ async function dispatchLibrary(ctx, sub, args) {
24161
24554
  }, { textExtractor: extractLibraryTextContent });
24162
24555
  return;
24163
24556
  }
24557
+ if (sub === "source" || sub === "sources") {
24558
+ await dispatchLibrarySource(ctx, args[0], args.slice(1));
24559
+ return;
24560
+ }
24561
+ if (sub === "history") {
24562
+ await dispatchLibraryHistory(ctx, args);
24563
+ return;
24564
+ }
24164
24565
  if (sub === "write") {
24165
24566
  const flags = parseLocalFlags(args, ["library", "write"]);
24166
24567
  const path = requireCommandValue(flags.positionals[0], "Usage: uru library write <path> (--file <local-path>|--content <text>|--stdin) [--create] [--folder-id <id>]");
@@ -24244,7 +24645,96 @@ async function dispatchLibrary(ctx, sub, args) {
24244
24645
  await emitTool(ctx, "library.empty_trash", {});
24245
24646
  return;
24246
24647
  }
24247
- throw new CliError("Usage: uru library ls|stat|search|mkdir|read|write|patch|patch-preview|favorite|unfavorite|upload|cp|mv|rm|restore|empty-trash");
24648
+ throw new CliError("Usage: uru library ls|stat|search|mkdir|read|write|patch|patch-preview|favorite|unfavorite|source|history|upload|cp|mv|rm|restore|empty-trash");
24649
+ }
24650
+ async function dispatchLibrarySource(ctx, verb, args) {
24651
+ const normalizedVerb = verb === undefined || verb === "ls" || verb === "list" ? "list" : verb === "inspect" ? "get" : verb === "edit" || verb === "set" ? "edit" : verb === "connect" ? "create" : verb === "run" || verb === "sync" || verb === "run-now" ? "run-now" : verb === "delete" || verb === "rm" ? "remove" : verb;
24652
+ if (normalizedVerb === "list") {
24653
+ await emitTool(ctx, "library.sources_list", {});
24654
+ return;
24655
+ }
24656
+ if (normalizedVerb === "create") {
24657
+ const params = adaptRegistryFamilyParams(await paramsJson(args, ["library", "source", "create"], paramsJsonOptions(ctx)));
24658
+ await emitTool(ctx, "library.sources_create", params);
24659
+ return;
24660
+ }
24661
+ if (normalizedVerb === "edit") {
24662
+ const flags = parseLocalFlags(args, ["library", "source", "edit"]);
24663
+ const sourceId = requireCommandValue(flags.positionals[0], "Usage: uru library source edit <source-id> --params-json '{...}'");
24664
+ const params = adaptRegistryFamilyParams(await paramsJson(args, ["library", "source", "edit"], paramsJsonOptions(ctx)));
24665
+ params["source_id"] = sourceId;
24666
+ await emitTool(ctx, "library.sources_edit", params);
24667
+ return;
24668
+ }
24669
+ if (normalizedVerb === "get" || normalizedVerb === "pause" || normalizedVerb === "resume" || normalizedVerb === "run-now" || normalizedVerb === "cancel" || normalizedVerb === "remove") {
24670
+ const flags = parseLocalFlags(args, ["library", "source", normalizedVerb]);
24671
+ const sourceId = requireCommandValue(flags.positionals[0], `Usage: uru library source ${normalizedVerb} <source-id>`);
24672
+ const operationByVerb = {
24673
+ get: "library.sources_get",
24674
+ pause: "library.sources_pause",
24675
+ resume: "library.sources_resume",
24676
+ "run-now": "library.sources_run_now",
24677
+ cancel: "library.sources_cancel",
24678
+ remove: "library.sources_remove"
24679
+ };
24680
+ await emitTool(ctx, operationByVerb[normalizedVerb], {
24681
+ source_id: sourceId
24682
+ });
24683
+ return;
24684
+ }
24685
+ if (normalizedVerb === "reconnect") {
24686
+ const flags = parseLocalFlags(args, ["library", "source", "reconnect"]);
24687
+ const sourceId = requireCommandValue(flags.positionals[0], "Usage: uru library source reconnect <source-id> --params-json '{...}'");
24688
+ const params = adaptRegistryFamilyParams(await paramsJson(args, ["library", "source", "reconnect"], paramsJsonOptions(ctx)));
24689
+ params["source_id"] = sourceId;
24690
+ await emitTool(ctx, "library.sources_reconnect", params);
24691
+ return;
24692
+ }
24693
+ throw new CliError("Usage: uru library source list|get|inspect|create|edit|pause|resume|run-now|cancel|reconnect|remove <source-id>");
24694
+ }
24695
+ var LIBRARY_HISTORY_RESOURCE_TYPES = new Set([
24696
+ "prompt",
24697
+ "context",
24698
+ "persona",
24699
+ "automation",
24700
+ "file",
24701
+ "folder",
24702
+ "collection",
24703
+ "shortcut"
24704
+ ]);
24705
+ async function dispatchLibraryHistory(ctx, args) {
24706
+ const flags = parseLocalFlags(args, ["library", "history"]);
24707
+ const firstVerb = flags.positionals[0];
24708
+ const isDetail = firstVerb === "get" || firstVerb === "inspect" || firstVerb === "show";
24709
+ const values = isDetail ? flags.positionals.slice(1) : flags.positionals;
24710
+ const resourceType = requireCommandValue(values[0], "Usage: uru library history <resource-type> <resource-id> [--limit <n>] [--cursor <cursor>]");
24711
+ if (!LIBRARY_HISTORY_RESOURCE_TYPES.has(resourceType)) {
24712
+ throw new CliError(`Unknown Library history resource type ${JSON.stringify(resourceType)}`);
24713
+ }
24714
+ const resourceId = requireCommandValue(values[1], isDetail ? "Usage: uru library history get <resource-type> <resource-id> <revision>" : "Usage: uru library history <resource-type> <resource-id> [--limit <n>] [--cursor <cursor>]");
24715
+ if (isDetail) {
24716
+ const revision = requireCommandValue(values[2], "Usage: uru library history get <resource-type> <resource-id> <revision>");
24717
+ if (!/^[1-9][0-9]{0,19}$/u.test(revision)) {
24718
+ throw new CliError("Library history revision must be a positive integer.");
24719
+ }
24720
+ await emitTool(ctx, "library.history_get", {
24721
+ op: "get",
24722
+ resource_type: resourceType,
24723
+ resource_id: resourceId,
24724
+ revision
24725
+ });
24726
+ return;
24727
+ }
24728
+ const params = {
24729
+ op: "list",
24730
+ resource_type: resourceType,
24731
+ resource_id: resourceId,
24732
+ first: boundedIntegerFlag(flags, "--limit", 20, 100)
24733
+ };
24734
+ const cursor = flags.values["--cursor"];
24735
+ if (cursor !== undefined)
24736
+ params["after"] = cursor;
24737
+ await emitTool(ctx, "library.history_list", params);
24248
24738
  }
24249
24739
  var LIBRARY_UPLOAD_PREFLIGHT_VERBS = new Set([
24250
24740
  "preflight",
@@ -24425,9 +24915,17 @@ async function dispatchDatasets(ctx, sub, args) {
24425
24915
  return;
24426
24916
  }
24427
24917
  if (sub === "get" || sub === "inspect" || sub === "query" || sub === "history" || sub === "jobs") {
24918
+ if (sub === "jobs" && (args[0] === "get" || args[0] === "cancel")) {
24919
+ await dispatchDatasetJobCommand(ctx, args[0], args.slice(1));
24920
+ return;
24921
+ }
24428
24922
  await dispatchDatasetCommand(ctx, sub, args);
24429
24923
  return;
24430
24924
  }
24925
+ if (sub === "source") {
24926
+ await dispatchDatasetSourceCommand(ctx, args[0], args.slice(1));
24927
+ return;
24928
+ }
24431
24929
  await dispatchRegistryFamily(ctx, "datasets", sub, args);
24432
24930
  }
24433
24931
  async function dispatchDatasetCommand(ctx, sub, args) {
@@ -24496,6 +24994,108 @@ async function dispatchDatasetCommand(ctx, sub, args) {
24496
24994
  return;
24497
24995
  }
24498
24996
  }
24997
+ async function dispatchDatasetJobCommand(ctx, verb, args) {
24998
+ const flags = parseLocalFlags(args, ["datasets", "jobs", verb]);
24999
+ const datasetId = requireCommandValue(flags.positionals[0], `Usage: uru datasets jobs ${verb} <dataset-id> <job-id>`);
25000
+ const jobId = requireCommandValue(flags.positionals[1], `Usage: uru datasets jobs ${verb} <dataset-id> <job-id>`);
25001
+ await emitTool(ctx, verb === "get" ? "dataset.job_get" : "dataset.job_cancel", {
25002
+ dataset_id: datasetId,
25003
+ job_id: jobId
25004
+ });
25005
+ }
25006
+ function sourceParam(source, camelCase, snakeCase) {
25007
+ const value = source[camelCase] ?? source[snakeCase];
25008
+ return value === undefined ? undefined : value;
25009
+ }
25010
+ function sourceParamsFromResult(value) {
25011
+ const source = unwrapToolResult(value);
25012
+ if (!isJsonObject2(source)) {
25013
+ throw new CliError("Dataset has no external source to update.");
25014
+ }
25015
+ const params = {};
25016
+ const fields = [
25017
+ ["composioConnectionId", "composio_connection_id"],
25018
+ ["capabilityId", "capability_id"],
25019
+ ["supabaseRef", "supabase_ref"],
25020
+ ["baseQuery", "base_query"],
25021
+ ["idColumn", "id_column"],
25022
+ ["cursorColumn", "cursor_column"],
25023
+ ["allowedColumns", "allowed_columns"],
25024
+ ["cacheTtlSeconds", "cache_ttl_seconds"],
25025
+ ["enabled", "enabled"],
25026
+ ["ownerUserId", "owner_user_id"],
25027
+ ["relationSchema", "relation_schema"],
25028
+ ["relationName", "relation_name"],
25029
+ ["relationKind", "relation_kind"],
25030
+ ["pkColumns", "pk_columns"],
25031
+ ["idStrategy", "id_strategy"],
25032
+ ["cursorStrategy", "cursor_strategy"],
25033
+ ["writeEnabled", "write_enabled"],
25034
+ ["allowedWriteColumns", "allowed_write_columns"],
25035
+ ["optimisticConcurrencyColumn", "optimistic_concurrency_column"],
25036
+ ["syncMode", "sync_mode"],
25037
+ ["syncIntervalSeconds", "sync_interval_seconds"]
25038
+ ];
25039
+ for (const [camelCase, snakeCase] of fields) {
25040
+ const valueForField = sourceParam(source, camelCase, snakeCase);
25041
+ if (valueForField !== undefined) {
25042
+ params[snakeCase] = valueForField;
25043
+ }
25044
+ }
25045
+ return params;
25046
+ }
25047
+ async function dispatchDatasetSourceCommand(ctx, verb, args) {
25048
+ const normalizedVerb = verb === "inspect" ? "get" : verb === "edit" || verb === "connect" || verb === "create" || verb === "reconnect" ? "put" : verb === "run-now" ? "sync" : verb;
25049
+ if (normalizedVerb === "get") {
25050
+ const flags = parseLocalFlags(args, ["datasets", "source", "get"]);
25051
+ await emitTool(ctx, "dataset.external_source_get", {
25052
+ dataset_id: requireCommandValue(flags.positionals[0], "Usage: uru datasets source get|inspect <dataset-id>")
25053
+ });
25054
+ return;
25055
+ }
25056
+ if (normalizedVerb === "put" || normalizedVerb === "test") {
25057
+ const flags = parseLocalFlags(args, ["datasets", "source", normalizedVerb]);
25058
+ const datasetId = requireCommandValue(flags.positionals[0], `Usage: uru datasets source ${normalizedVerb} <dataset-id> --params-json '{...}'`);
25059
+ const params = adaptRegistryFamilyParams(await paramsJson(args, ["datasets", "source", normalizedVerb], paramsJsonOptions(ctx)));
25060
+ params["dataset_id"] ??= datasetId;
25061
+ await emitTool(ctx, normalizedVerb === "put" ? "dataset.external_source_put" : "dataset.external_source_test", params);
25062
+ return;
25063
+ }
25064
+ if (normalizedVerb === "pause" || normalizedVerb === "resume") {
25065
+ const flags = parseLocalFlags(args, ["datasets", "source", normalizedVerb]);
25066
+ const datasetId = requireCommandValue(flags.positionals[0], `Usage: uru datasets source ${normalizedVerb} <dataset-id>`);
25067
+ const current = await executeOperation(ctx, "dataset.external_source_get", {
25068
+ dataset_id: datasetId
25069
+ });
25070
+ const params = sourceParamsFromResult(current);
25071
+ params["dataset_id"] = datasetId;
25072
+ params["enabled"] = normalizedVerb === "resume";
25073
+ await emitTool(ctx, "dataset.external_source_put", params);
25074
+ return;
25075
+ }
25076
+ if (normalizedVerb === "sync") {
25077
+ const flags = parseLocalFlags(args, ["datasets", "source", "sync"]);
25078
+ const datasetId = requireCommandValue(flags.positionals[0], "Usage: uru datasets source sync|run-now <dataset-id> [--params-json '{...}']");
25079
+ const explicitParams = flags.values["--params-json"];
25080
+ const params = explicitParams === undefined ? {} : adaptRegistryFamilyParams(parseParamsJson(await readParamsJsonSource(explicitParams, paramsJsonOptions(ctx)), "--params-json"));
25081
+ params["dataset_id"] = datasetId;
25082
+ params["idempotency_key"] ??= flags.values["--idempotency-key"] ?? randomUUID();
25083
+ if (params["expected_dataset_revision"] === undefined || params["expected_schema_revision"] === undefined) {
25084
+ const dataset = unwrapToolResult(await executeOperation(ctx, "dataset.get", { dataset_id: datasetId }));
25085
+ if (!isJsonObject2(dataset)) {
25086
+ throw new CliError("Dataset metadata did not include revision values.");
25087
+ }
25088
+ params["expected_dataset_revision"] ??= dataset["revision"] ?? dataset["datasetRevision"] ?? null;
25089
+ params["expected_schema_revision"] ??= dataset["schemaRevision"] ?? dataset["schema_revision"] ?? null;
25090
+ }
25091
+ if (typeof params["expected_dataset_revision"] !== "string" || typeof params["expected_schema_revision"] !== "string") {
25092
+ throw new CliError("Dataset metadata did not include revision values.");
25093
+ }
25094
+ await emitTool(ctx, "dataset.external_source_sync", params);
25095
+ return;
25096
+ }
25097
+ throw new CliError("Usage: uru datasets source get|put|connect|create|reconnect|test|pause|resume|sync <dataset-id>");
25098
+ }
24499
25099
  async function dispatchAutomations(ctx, sub, args) {
24500
25100
  if (sub === "ls" || sub === "list") {
24501
25101
  const flags = parseLocalFlags(args, ["automations", "ls"]);
@@ -25709,6 +26309,121 @@ import { mkdir as mkdir4, readFile as readFile8, writeFile as writeFile3 } from
25709
26309
  import { join as join3, resolve as resolve6 } from "node:path";
25710
26310
  import { setTimeout as sleep2 } from "node:timers/promises";
25711
26311
 
26312
+ // ../../packages/types/src/artifacts/gemRequestWaterfall.ts
26313
+ var LEVEL_SEVERITY = {
26314
+ critical: 5,
26315
+ fatal: 5,
26316
+ error: 4,
26317
+ warn: 3,
26318
+ warning: 3,
26319
+ info: 2,
26320
+ debug: 1,
26321
+ trace: 0
26322
+ };
26323
+ var normalizedLevel = (value) => {
26324
+ const trimmed = (value ?? "").trim().toLowerCase();
26325
+ return trimmed === "" ? "info" : trimmed;
26326
+ };
26327
+ var timeOf = (line) => {
26328
+ const parsed = Date.parse(line.createdAt ?? "");
26329
+ return Number.isFinite(parsed) ? parsed : null;
26330
+ };
26331
+ var stepDuration = (line) => {
26332
+ const value = line.durationMs;
26333
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
26334
+ };
26335
+ var requestKey = (line) => {
26336
+ const trimmed = (line.requestId ?? "").trim();
26337
+ return trimmed === "" ? null : trimmed;
26338
+ };
26339
+ function worstLevel(lines) {
26340
+ let worst = "info";
26341
+ let severity = -1;
26342
+ for (const line of lines) {
26343
+ const level = normalizedLevel(line.level);
26344
+ const rank = LEVEL_SEVERITY[level] ?? 2;
26345
+ if (rank > severity) {
26346
+ severity = rank;
26347
+ worst = level;
26348
+ }
26349
+ }
26350
+ return worst;
26351
+ }
26352
+ function buildWaterfall(requestId, lines) {
26353
+ const ordered = [...lines].sort((left, right) => {
26354
+ const leftTime = timeOf(left);
26355
+ const rightTime = timeOf(right);
26356
+ if (leftTime === null && rightTime === null) {
26357
+ return 0;
26358
+ }
26359
+ if (leftTime === null) {
26360
+ return 1;
26361
+ }
26362
+ if (rightTime === null) {
26363
+ return -1;
26364
+ }
26365
+ return leftTime - rightTime;
26366
+ });
26367
+ const startTime = ordered.map(timeOf).find((value) => value !== null) ?? null;
26368
+ const steps = ordered.map((line) => {
26369
+ const time3 = timeOf(line);
26370
+ return {
26371
+ durationMs: stepDuration(line),
26372
+ line,
26373
+ offsetMs: time3 === null || startTime === null ? null : time3 - startTime
26374
+ };
26375
+ });
26376
+ const ends = steps.map((step) => step.offsetMs === null ? null : step.offsetMs + (step.durationMs ?? 0)).filter((value) => value !== null);
26377
+ const longestStep = steps.map((step) => step.durationMs).filter((value) => value !== null);
26378
+ const totalMs = ends.length > 0 ? Math.max(...ends) : longestStep.length > 0 ? Math.max(...longestStep) : null;
26379
+ const startedAt = ordered.find((line) => timeOf(line) !== null)?.createdAt ?? null;
26380
+ return {
26381
+ level: worstLevel(ordered),
26382
+ requestId,
26383
+ startedAt,
26384
+ steps,
26385
+ totalMs
26386
+ };
26387
+ }
26388
+ function gemRequestWaterfalls(lines) {
26389
+ const byRequest = new Map;
26390
+ const looseLines = [];
26391
+ const order = [];
26392
+ for (const line of lines) {
26393
+ const key = requestKey(line);
26394
+ if (key === null) {
26395
+ looseLines.push(line);
26396
+ continue;
26397
+ }
26398
+ const existing = byRequest.get(key);
26399
+ if (existing === undefined) {
26400
+ byRequest.set(key, [line]);
26401
+ order.push(key);
26402
+ continue;
26403
+ }
26404
+ existing.push(line);
26405
+ }
26406
+ return {
26407
+ looseLines,
26408
+ requests: order.map((key) => buildWaterfall(key, byRequest.get(key) ?? []))
26409
+ };
26410
+ }
26411
+ function formatGemRequestDuration(durationMs) {
26412
+ if (durationMs === null) {
26413
+ return "—";
26414
+ }
26415
+ if (durationMs < 1000) {
26416
+ return `${String(Math.round(durationMs))} ms`;
26417
+ }
26418
+ const seconds = durationMs / 1000;
26419
+ if (seconds < 60) {
26420
+ return `${seconds.toFixed(1)} s`;
26421
+ }
26422
+ const minutes = Math.floor(seconds / 60);
26423
+ const rest = Math.round(seconds - minutes * 60);
26424
+ return `${String(minutes)} m ${String(rest).padStart(2, "0")} s`;
26425
+ }
26426
+
25712
26427
  // src/gem-fs-commands.ts
25713
26428
  import { readFile as readFile6 } from "node:fs/promises";
25714
26429
  import { resolve as resolve5 } from "node:path";
@@ -25868,7 +26583,7 @@ async function dispatchGemFs(ctx, verb, args, linkedProject) {
25868
26583
  }
25869
26584
 
25870
26585
  // src/gem-git-source-commands.ts
25871
- import { randomUUID } from "node:crypto";
26586
+ import { randomUUID as randomUUID2 } from "node:crypto";
25872
26587
  var GIT_SOURCE_PATH = "/api/v1/artifacts";
25873
26588
  async function dispatchGemGitSource(ctx, verb, args, linkedProject) {
25874
26589
  if (verb === undefined || verb === "help") {
@@ -25884,8 +26599,8 @@ async function dispatchGemGitSource(ctx, verb, args, linkedProject) {
25884
26599
  const flags = parseLocalFlags(args, ["gems", "source", verb]);
25885
26600
  const reference = await resolveArtifactReference(ctx, flags, linkedProject);
25886
26601
  if (verb === "copy") {
25887
- const result2 = await client(ctx).api(`/api/platform/artifacts/${encodeURIComponent(reference.slug)}/clone`, { method: "POST" });
25888
- emitValue(ctx, result2, formatCloneResult(result2));
26602
+ const result2 = await client(ctx).api(`${GIT_SOURCE_PATH}/${encodeURIComponent(reference.artifactId)}/git-source/copy`, { method: "POST" });
26603
+ emitValue(ctx, result2, formatCopyResult(result2));
25889
26604
  return;
25890
26605
  }
25891
26606
  if (verb === "status") {
@@ -25905,7 +26620,7 @@ function commandFromFlags(verb, flags) {
25905
26620
  return toJsonCommand({
25906
26621
  action: "retry",
25907
26622
  importId: requiredImportId(flags, "retry"),
25908
- idempotencyKey: flags.values["--idempotency-key"]?.trim() || randomUUID()
26623
+ idempotencyKey: flags.values["--idempotency-key"]?.trim() || randomUUID2()
25909
26624
  });
25910
26625
  case "cancel":
25911
26626
  return toJsonCommand({
@@ -25947,10 +26662,7 @@ async function resolveArtifactReference(ctx, flags, linkedProject) {
25947
26662
  if (artifactId === undefined) {
25948
26663
  throw new CliError(`Gem inspection did not return an artifact id for ${reference}.`);
25949
26664
  }
25950
- return {
25951
- artifactId,
25952
- slug: findArtifactSlug(inspected) ?? artifactId
25953
- };
26665
+ return { artifactId };
25954
26666
  }
25955
26667
  function findArtifactId(value) {
25956
26668
  if (isJsonObject2(value)) {
@@ -25984,34 +26696,6 @@ function findArtifactId(value) {
25984
26696
  function isUuid(value) {
25985
26697
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(value);
25986
26698
  }
25987
- function findArtifactSlug(value) {
25988
- if (isJsonObject2(value)) {
25989
- const slug = stringField2(value, [
25990
- "artifact_slug",
25991
- "artifactSlug",
25992
- "slug"
25993
- ]);
25994
- if (slug !== undefined && !slug.includes("/")) {
25995
- return slug;
25996
- }
25997
- for (const nested of Object.values(value)) {
25998
- const found = findArtifactSlug(nested);
25999
- if (found !== undefined) {
26000
- return found;
26001
- }
26002
- }
26003
- return;
26004
- }
26005
- if (Array.isArray(value)) {
26006
- for (const nested of value) {
26007
- const found = findArtifactSlug(nested);
26008
- if (found !== undefined) {
26009
- return found;
26010
- }
26011
- }
26012
- }
26013
- return;
26014
- }
26015
26699
  function requiredImportId(flags, verb) {
26016
26700
  const importId = flags.values["--import-id"]?.trim();
26017
26701
  if (!importId) {
@@ -26119,23 +26803,25 @@ function formatGitSourceState(value) {
26119
26803
  return lines.length === 0 ? JSON.stringify(value, null, 2) : lines.join(`
26120
26804
  `);
26121
26805
  }
26122
- function formatCloneResult(value) {
26806
+ function formatCopyResult(value) {
26123
26807
  const record2 = isJsonObject2(value) ? value : undefined;
26124
- const artifactId = record2 === undefined ? undefined : stringField2(record2, ["id", "artifactId", "artifact_id"]);
26808
+ const artifactId = record2 === undefined ? undefined : stringField2(record2, ["artifactId", "artifact_id", "id"]);
26125
26809
  const title = record2 === undefined ? undefined : stringField2(record2, ["title"]);
26810
+ const commitSha = record2 === undefined ? undefined : stringField2(record2, ["copiedFromCommitSha", "copied_from_commit_sha"]);
26126
26811
  if (artifactId === undefined && title === undefined) {
26127
26812
  return JSON.stringify(value, null, 2);
26128
26813
  }
26129
26814
  return [
26130
- "Gem copied.",
26131
- artifactId === undefined ? undefined : `Artifact: ${artifactId}`,
26132
- title === undefined ? undefined : `Title: ${title}`
26815
+ "Made an editable copy. It is not linked to the repository.",
26816
+ artifactId === undefined ? undefined : `Gem: ${artifactId}`,
26817
+ title === undefined ? undefined : `Title: ${title}`,
26818
+ commitSha === undefined ? undefined : `From commit: ${commitSha.slice(0, 7)}`
26133
26819
  ].filter((line) => line !== undefined).join(`
26134
26820
  `);
26135
26821
  }
26136
26822
 
26137
26823
  // src/held-idempotency-keys.ts
26138
- import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
26824
+ import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
26139
26825
  import { constants } from "node:fs";
26140
26826
  import { chmod, link, mkdir as mkdir3, open, readFile as readFile7, rename, rm as rm2 } from "node:fs/promises";
26141
26827
  import { dirname as dirname4, join as join2 } from "node:path";
@@ -26150,7 +26836,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
26150
26836
  return withHeldEntriesLock(path, async () => {
26151
26837
  const stored = await readHeldEntries(path);
26152
26838
  const existing = stored[fingerprint];
26153
- const owner = `${process.pid}:${randomUUID2()}`;
26839
+ const owner = `${process.pid}:${randomUUID3()}`;
26154
26840
  if (existing !== undefined) {
26155
26841
  const updated = {
26156
26842
  ...existing,
@@ -26162,7 +26848,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
26162
26848
  release: () => releaseHold(io, path, fingerprint, existing.key, owner)
26163
26849
  };
26164
26850
  }
26165
- const key = randomUUID2();
26851
+ const key = randomUUID3();
26166
26852
  await writeHeldEntries(path, {
26167
26853
  ...stored,
26168
26854
  [fingerprint]: { key, heldAt: now.toISOString(), owners: [owner] }
@@ -26272,7 +26958,7 @@ async function withHeldEntriesLock(path, action) {
26272
26958
  continue;
26273
26959
  }
26274
26960
  try {
26275
- const lockToken = randomUUID2();
26961
+ const lockToken = randomUUID3();
26276
26962
  const contents = `${process.pid}
26277
26963
  ${lockToken}
26278
26964
  `;
@@ -26355,7 +27041,7 @@ async function tryCreateHeldLock(path) {
26355
27041
  }
26356
27042
  try {
26357
27043
  const contents = `${process.pid}
26358
- ${randomUUID2()}
27044
+ ${randomUUID3()}
26359
27045
  `;
26360
27046
  await handle.writeFile(contents, "utf8");
26361
27047
  await handle.sync();
@@ -26414,7 +27100,7 @@ async function readHeldLockObservation(path) {
26414
27100
  }
26415
27101
  }
26416
27102
  async function removeHeldLockIfMatches(path, expected) {
26417
- const quarantinePath = `${path}.${process.pid}.${randomUUID2()}.quarantine`;
27103
+ const quarantinePath = `${path}.${process.pid}.${randomUUID3()}.quarantine`;
26418
27104
  try {
26419
27105
  await rename(path, quarantinePath);
26420
27106
  await syncParentDirectory(path);
@@ -26474,7 +27160,7 @@ async function writeHeldEntries(path, entries) {
26474
27160
  }
26475
27161
  const body = `${JSON.stringify(entries, null, 2)}
26476
27162
  `;
26477
- const temporaryPath = `${path}.${process.pid}.${randomUUID2()}.tmp`;
27163
+ const temporaryPath = `${path}.${process.pid}.${randomUUID3()}.tmp`;
26478
27164
  let handle = null;
26479
27165
  try {
26480
27166
  handle = await open(temporaryPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, constants.S_IRUSR | constants.S_IWUSR);
@@ -26594,6 +27280,10 @@ async function dispatchGemLifecycleResourceCommand(ctx, sub, args, linkedProject
26594
27280
  await dispatchGemSchedules(ctx, args, linkedProject);
26595
27281
  return true;
26596
27282
  }
27283
+ if (sub === "events") {
27284
+ await dispatchGemEvents(ctx, args, linkedProject);
27285
+ return true;
27286
+ }
26597
27287
  if (sub === "bindings") {
26598
27288
  await dispatchGemBindings(ctx, args, linkedProject);
26599
27289
  return true;
@@ -26650,11 +27340,11 @@ async function dispatchGemVersions(ctx, args, linkedProject) {
26650
27340
  });
26651
27341
  return;
26652
27342
  }
26653
- if (verb === "show" || verb === "restore" || verb === "preview") {
27343
+ if (verb === "show" || verb === "restore" || verb === "preview" || verb === "retry") {
26654
27344
  const flags = parseLocalFlags(rest, ["gems", "versions", verb]);
26655
27345
  const version2 = lifecycleResourceArg(flags, `Usage: uru gems versions ${verb} <gem> <version>`);
26656
27346
  const path = gemPathFromArgs(flags, linkedProject);
26657
- await emitGemTool(ctx, verb === "show" ? "gem.version_get" : verb === "restore" ? "gem.version_restore" : "gem.version_preview", { path, version_id: version2 }, verb === "restore" ? { textExtractor: extractVersionRestoreSummary } : undefined);
27347
+ await emitGemTool(ctx, verb === "show" ? "gem.version_get" : verb === "restore" ? "gem.version_restore" : verb === "retry" ? "gem.version_retry" : "gem.version_preview", { path, version_id: version2 }, verb === "restore" ? { textExtractor: extractVersionRestoreSummary } : verb === "retry" ? { textExtractor: extractVersionRetrySummary } : undefined);
26658
27348
  return;
26659
27349
  }
26660
27350
  if (verb === "diff") {
@@ -26667,7 +27357,7 @@ async function dispatchGemVersions(ctx, args, linkedProject) {
26667
27357
  });
26668
27358
  return;
26669
27359
  }
26670
- throw new CliError("Usage: uru gems versions list <gem> | save|upload <gem> [--name ...] [--message ...] | deploy <gem> <version> | show <gem> <version> | diff <gem> <from> <to> | restore <gem> <version> | preview <gem> <version>");
27360
+ throw new CliError("Usage: uru gems versions list <gem> | save|upload <gem> [--name ...] [--message ...] | deploy <gem> <version> | show <gem> <version> | diff <gem> <from> <to> | restore <gem> <version> | preview <gem> <version> | retry <gem> <version>");
26671
27361
  }
26672
27362
  async function gemVersionSave(ctx, args, linkedProject, commandPath = ["gems", "versions", "save"]) {
26673
27363
  const flags = parseLocalFlags(args, commandPath);
@@ -26873,6 +27563,8 @@ async function dispatchGemRuns(ctx, args, linkedProject) {
26873
27563
  };
26874
27564
  copyStringFlag(flags, params, "--cursor", "cursor");
26875
27565
  copyStringFlag(flags, params, "--status", "status");
27566
+ copyStringFlag(flags, params, "--environment", "environment");
27567
+ copyStringFlag(flags, params, "--version", "version_id");
26876
27568
  copyOptionalIntegerFlag(flags, params, "--limit", "limit");
26877
27569
  await emitGemTool(ctx, "gem.runs_list", params, {
26878
27570
  textExtractor: (value) => formatGemResourceList("runs", value)
@@ -26946,6 +27638,59 @@ async function dispatchGemSchedules(ctx, args, linkedProject) {
26946
27638
  }
26947
27639
  throw new CliError("Usage: uru gems schedules list <gem> | arm|pause|resume <gem> <capability> | run <gem> <capability> --idempotency-key <key>");
26948
27640
  }
27641
+ async function dispatchGemEvents(ctx, args, linkedProject) {
27642
+ const [verb, ...rest] = args;
27643
+ if (verb === "list") {
27644
+ const flags = parseLocalFlags(rest, ["gems", "events", "list"]);
27645
+ await emitGemTool(ctx, "gem.event_targets_list", {
27646
+ path: gemPathFromArgs(flags, linkedProject)
27647
+ });
27648
+ return;
27649
+ }
27650
+ if (verb === "pause" || verb === "resume") {
27651
+ const flags = parseLocalFlags(rest, ["gems", "events", verb]);
27652
+ const targetId = lifecycleResourceArg(flags, `Usage: uru gems events ${verb} <gem> <target-id>`);
27653
+ await emitGemTool(ctx, "gem.event_target_update", {
27654
+ path: gemPathFromArgs(flags, linkedProject),
27655
+ target_id: targetId,
27656
+ state: verb === "pause" ? "paused" : "active"
27657
+ });
27658
+ return;
27659
+ }
27660
+ if (verb === "update") {
27661
+ const flags = parseLocalFlags(rest, ["gems", "events", "update"]);
27662
+ const targetId = lifecycleResourceArg(flags, "Usage: uru gems events update <gem> <target-id> [--state active|paused] [--input-json '{...}']");
27663
+ const state = flags.values["--state"];
27664
+ const inputJson = flags.values["--input-json"];
27665
+ if (state === undefined && inputJson === undefined) {
27666
+ throw new CliError("Usage: uru gems events update <gem> <target-id> [--state active|paused] [--input-json '{...}']");
27667
+ }
27668
+ if (state !== undefined && state !== "active" && state !== "paused") {
27669
+ throw new CliError("--state must be active or paused");
27670
+ }
27671
+ const params = {
27672
+ path: gemPathFromArgs(flags, linkedProject),
27673
+ target_id: targetId,
27674
+ ...state === undefined ? {} : { state }
27675
+ };
27676
+ if (inputJson !== undefined) {
27677
+ params["input"] = parseParamsJson(inputJson, "--input-json");
27678
+ }
27679
+ await emitGemTool(ctx, "gem.event_target_update", params);
27680
+ return;
27681
+ }
27682
+ if (verb === "run" || verb === "run-now") {
27683
+ const flags = parseLocalFlags(rest, ["gems", "events", verb]);
27684
+ const targetId = lifecycleResourceArg(flags, `Usage: uru gems events ${verb} <gem> <target-id> --idempotency-key <key>`);
27685
+ await emitGemTool(ctx, "gem.event_target_run_now", {
27686
+ path: gemPathFromArgs(flags, linkedProject),
27687
+ target_id: targetId,
27688
+ idempotency_key: requireCommandValue(flags.values["--idempotency-key"], `Usage: uru gems events ${verb} <gem> <target-id> --idempotency-key <key>`)
27689
+ });
27690
+ return;
27691
+ }
27692
+ throw new CliError("Usage: uru gems events list <gem> | update <gem> <target-id> [--state active|paused] [--input-json '{...}'] | pause|resume <gem> <target-id> | run <gem> <target-id> --idempotency-key <key>");
27693
+ }
26949
27694
  async function gemDeployRelease(ctx, args, linkedProject) {
26950
27695
  const flags = parseLocalFlags(args, ["gems", "deploy"]);
26951
27696
  const versionId = lifecycleResourceArg(flags, "Usage: uru gems deploy <version> [library/name.gem] [--link <name>] [--pin]");
@@ -27013,6 +27758,20 @@ async function dispatchGemBuildDiagnostics(ctx, verb, args, linkedProject) {
27013
27758
  path: gemPathFromArgs(flags, linkedProject)
27014
27759
  });
27015
27760
  }
27761
+ async function bindingChoicesUpsert(ctx, flags, path) {
27762
+ const usage = `Usage: uru gems bindings upsert [library/name.gem] --binding-choices '{"role":"connection_ref"}' --expected-binding-set-version <n> --expected-binding-set-hash <hash>`;
27763
+ const bindingChoices = parseParamsJson(requireCommandValue(flags.values["--binding-choices"], usage), "--binding-choices");
27764
+ const version2 = Number.parseInt(requireCommandValue(flags.values["--expected-binding-set-version"], usage), 10);
27765
+ if (!Number.isInteger(version2) || version2 < 1) {
27766
+ throw new CliError("--expected-binding-set-version must be a positive integer");
27767
+ }
27768
+ await emitGemTool(ctx, "gem.upsert_binding", {
27769
+ path,
27770
+ binding_choices: bindingChoices,
27771
+ expected_binding_set_version: version2,
27772
+ expected_binding_set_hash: requireCommandValue(flags.values["--expected-binding-set-hash"], usage)
27773
+ });
27774
+ }
27016
27775
  async function dispatchGemBindings(ctx, args, linkedProject) {
27017
27776
  const [verb, ...rest] = args;
27018
27777
  if (verb === "list") {
@@ -27024,18 +27783,20 @@ async function dispatchGemBindings(ctx, args, linkedProject) {
27024
27783
  }
27025
27784
  if (verb === "upsert") {
27026
27785
  const flags = parseLocalFlags(rest, ["gems", "bindings", "upsert"]);
27786
+ const path = gemPathFromArgs(flags, linkedProject);
27787
+ if (flags.values["--binding-choices"] !== undefined) {
27788
+ await bindingChoicesUpsert(ctx, flags, path);
27789
+ return;
27790
+ }
27027
27791
  const usage = "Usage: uru gems bindings upsert [library/name.gem] --source-ref-type <type> --source-ref <ref> --target-resource-type <type>";
27028
27792
  const params = {
27029
- path: gemPathFromArgs(flags, linkedProject),
27793
+ path,
27030
27794
  source_ref_type: requireCommandValue(flags.values["--source-ref-type"], usage),
27031
27795
  source_ref: requireCommandValue(flags.values["--source-ref"], usage),
27032
27796
  target_resource_type: requireCommandValue(flags.values["--target-resource-type"], usage)
27033
27797
  };
27034
27798
  copyStringFlag(flags, params, "--target-resource-id", "target_resource_id");
27035
27799
  copyStringFlag(flags, params, "--target-resource-ref", "target_resource_ref");
27036
- copyStringFlag(flags, params, "--tool-connection-id", "tool_connection_id");
27037
- copyStringFlag(flags, params, "--tool-capability-id", "tool_capability_id");
27038
- copyStringFlag(flags, params, "--environment-key", "environment_key");
27039
27800
  copyStringFlag(flags, params, "--binding-status", "binding_status");
27040
27801
  copyStringFlag(flags, params, "--policy-level", "policy_level");
27041
27802
  await emitGemTool(ctx, "gem.upsert_binding", params);
@@ -27170,6 +27931,10 @@ function extractVersionRestoreSummary(value) {
27170
27931
  const version2 = versionLabel(value, "version");
27171
27932
  return `Restored Version${version2 === null ? "" : ` ${version2}`} to Draft. No Links changed.`;
27172
27933
  }
27934
+ function extractVersionRetrySummary(value) {
27935
+ const version2 = versionLabel(value, "version");
27936
+ return `Building Version${version2 === null ? "" : ` ${version2}`} again. Read it with uru gems versions show until build_id is set. No Links changed.`;
27937
+ }
27173
27938
  function extractReleaseSummary(value) {
27174
27939
  const release = directResultObject(value, "release");
27175
27940
  const version2 = versionLabelFromObject(release?.["version"] ?? release);
@@ -27342,6 +28107,10 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
27342
28107
  await gemLogs(ctx, args, linkedProject, ["gems", "logs"]);
27343
28108
  return;
27344
28109
  }
28110
+ if (sub === "debug-token") {
28111
+ await gemDebugToken(ctx, args, linkedProject);
28112
+ return;
28113
+ }
27345
28114
  if (sub === "status") {
27346
28115
  const flags = parseLocalFlags(args, ["gems", "status"]);
27347
28116
  await emitGemTool(ctx, "gem.status", {
@@ -27361,7 +28130,7 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
27361
28130
  await gemWrite(ctx, args);
27362
28131
  return;
27363
28132
  }
27364
- throw new CliError("Usage: uru gems inspect|validate|build|deploy|verify|fs|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|checks|status|source|read|write");
28133
+ throw new CliError("Usage: uru gems inspect|validate|build|deploy|verify|fs|edits|versions|releases|links|runs|capabilities|schedules|events|bindings|components|delegations|api|domains|analytics|power|checks|status|source|read|write|logs|debug-token");
27365
28134
  }
27366
28135
  async function dispatchGemOperationalResourceCommand(ctx, sub, args, linkedProject) {
27367
28136
  if (sub === "domains") {
@@ -27546,9 +28315,13 @@ async function gemValidate(ctx, args, linkedProject) {
27546
28315
  async function gemBuild(ctx, args, linkedProject, commandPath = ["build"]) {
27547
28316
  const flags = parseLocalFlags(args, commandPath);
27548
28317
  const outdir = flags.values["--outdir"];
28318
+ const dryRun = flags.booleans.has("--dry-run");
28319
+ if (dryRun && flags.booleans.has("--force")) {
28320
+ throw new CliError("--force cannot be combined with --dry-run. A dry run only validates a build plan; it never rebuilds or persists.");
28321
+ }
27549
28322
  await enqueueGemHostedJob(ctx, flags, linkedProject, {
27550
- operationId: "gem.build",
27551
- force: true,
28323
+ operationId: dryRun ? "gem.validate" : "gem.build",
28324
+ force: !dryRun,
27552
28325
  ...outdir === undefined ? {} : { outdir }
27553
28326
  });
27554
28327
  }
@@ -27567,9 +28340,6 @@ async function enqueueGemHostedJob(ctx, flags, linkedProject, options) {
27567
28340
  if (options.force && flags.booleans.has("--force")) {
27568
28341
  params["force"] = true;
27569
28342
  }
27570
- if (flags.booleans.has("--dry-run")) {
27571
- params["dry_run"] = true;
27572
- }
27573
28343
  copyStringFlag(flags, params, "--source-revision-id", "source_revision_id");
27574
28344
  if (ctx.outputFormat === "stream-json") {
27575
28345
  writeStreamJson(ctx.io, "started", {
@@ -27675,6 +28445,15 @@ function emitGemHostedJobSync(ctx, job) {
27675
28445
  }
27676
28446
  writeText(ctx.io, status === "" ? `hosted_job_id ${hostedJobId}` : `hosted_job_id ${hostedJobId} status ${status}`);
27677
28447
  }
28448
+ async function gemDebugToken(ctx, args, linkedProject) {
28449
+ const flags = parseLocalFlags(args, ["gems", "debug-token"]);
28450
+ const params = {
28451
+ path: gemPathFromArgs(flags, linkedProject)
28452
+ };
28453
+ copyStringFlag(flags, params, "--deployment", "deployment_id");
28454
+ copyOptionalPositiveIntegerFlag(flags, params, "--ttl-seconds", "ttl_seconds");
28455
+ await emitGemTool(ctx, "gem.debug_token", params);
28456
+ }
27678
28457
  async function gemLogs(ctx, args, linkedProject, commandPath = ["logs"]) {
27679
28458
  const flags = parseLocalFlags(args, commandPath);
27680
28459
  const params = {
@@ -27684,28 +28463,71 @@ async function gemLogs(ctx, args, linkedProject, commandPath = ["logs"]) {
27684
28463
  copyStringFlag(flags, params, "--level", "level");
27685
28464
  copyStringFlag(flags, params, "--release", "release_id");
27686
28465
  copyStringFlag(flags, params, "--run", "run_id");
28466
+ copyStringFlag(flags, params, "--request-id", "request_id");
28467
+ copyStringFlag(flags, params, "--since", "since");
28468
+ copyStringFlag(flags, params, "--until", "until");
28469
+ copyStringFlag(flags, params, "--cursor", "cursor");
28470
+ const exportPath = flags.values["--export"];
27687
28471
  if (flags.booleans.has("--follow")) {
27688
28472
  await followGemLogs(ctx, params, {
27689
28473
  durationMs: boundedIntegerFlag(flags, "--follow-duration-ms", DEFAULT_LOG_FOLLOW_DURATION_MS, MAX_LOG_FOLLOW_DURATION_MS),
27690
- pollIntervalMs: boundedIntegerFlag(flags, "--poll-interval-ms", DEFAULT_LOG_FOLLOW_POLL_INTERVAL_MS, MAX_LOG_FOLLOW_POLL_INTERVAL_MS)
28474
+ ...exportPath === undefined ? {} : { exportPath }
27691
28475
  });
27692
28476
  return;
27693
28477
  }
27694
- await emitGemTool(ctx, "gem.logs", params);
28478
+ if (flags.values["--request-id"] !== undefined && !ctx.json && ctx.outputFormat === "text") {
28479
+ const unwrapped = unwrapToolResult(await executeOperation(ctx, "gem.logs", params));
28480
+ const entries = normalizeLogEntries(unwrapped).map((entry) => entry.value);
28481
+ writeText(ctx.io, formatRequestWaterfalls(entries));
28482
+ if (exportPath !== undefined) {
28483
+ await exportLogEntries(ctx, exportPath, entries);
28484
+ }
28485
+ return;
28486
+ }
28487
+ const payload = await emitGemTool(ctx, "gem.logs", params);
28488
+ if (exportPath !== undefined) {
28489
+ await exportLogEntries(ctx, exportPath, normalizeLogEntries(payload ?? null).map((entry) => entry.value));
28490
+ }
28491
+ }
28492
+ function waterfallLine(entry, index) {
28493
+ const durationRaw = entry["duration_ms"] ?? entry["durationMs"];
28494
+ return {
28495
+ createdAt: stringJsonField(entry, ["created_at", "createdAt", "timestamp"]) ?? null,
28496
+ durationMs: typeof durationRaw === "number" ? durationRaw : null,
28497
+ entry,
28498
+ id: stringJsonField(entry, ["id", "log_id"]) ?? `index:${String(index)}`,
28499
+ level: stringJsonField(entry, ["level"]) ?? null,
28500
+ requestId: stringJsonField(entry, ["request_id", "requestId"]) ?? null
28501
+ };
28502
+ }
28503
+ function formatRequestWaterfalls(entries) {
28504
+ const { looseLines, requests } = gemRequestWaterfalls(entries.map((entry, index) => waterfallLine(entry, index)));
28505
+ if (requests.length === 0 && looseLines.length === 0) {
28506
+ return "No log lines for that request.";
28507
+ }
28508
+ const blocks = requests.map((request) => {
28509
+ const head = stripTerminalControl(`${request.requestId} ${request.startedAt ?? "not recorded"} ${formatGemRequestDuration(request.totalMs)} ${request.level.toUpperCase()}`);
28510
+ const steps = request.steps.map((step) => {
28511
+ const offset = step.offsetMs === null ? " —" : `+${formatGemRequestDuration(step.offsetMs)}`;
28512
+ const took = step.durationMs === null ? "" : ` (${formatGemRequestDuration(step.durationMs)})`;
28513
+ return ` ${offset.padStart(10)}${took.padEnd(10)} ${formatLogEntry(step.line.entry)}`;
28514
+ });
28515
+ return [head, ...steps].join(`
28516
+ `);
28517
+ });
28518
+ const loose = looseLines.map((entry) => formatLogEntry(entry.entry));
28519
+ return [...blocks, ...loose].join(`
28520
+ `);
27695
28521
  }
27696
28522
  var DEFAULT_LOG_FOLLOW_DURATION_MS = 30 * 60 * 1000;
27697
28523
  var MAX_LOG_FOLLOW_DURATION_MS = 30 * 60 * 1000;
27698
- var DEFAULT_LOG_FOLLOW_POLL_INTERVAL_MS = 1000;
27699
- var MAX_LOG_FOLLOW_POLL_INTERVAL_MS = 30000;
27700
- var MIN_LOG_FOLLOW_POLLS = 2;
27701
28524
  async function followGemLogs(ctx, params, options) {
27702
28525
  const path = typeof params["path"] === "string" ? params["path"] : undefined;
27703
28526
  if (ctx.outputFormat === "stream-json") {
27704
28527
  writeStreamJson(ctx.io, "started", {
27705
28528
  operation: "gem.logs.follow",
27706
28529
  ...path === undefined ? {} : { path },
27707
- duration_ms: options.durationMs,
27708
- poll_interval_ms: options.pollIntervalMs
28530
+ duration_ms: options.durationMs
27709
28531
  });
27710
28532
  } else {
27711
28533
  ctx.io.stderr.write(`Following Gem logs for up to ${Math.ceil(options.durationMs / 1000)}s. Press Ctrl-C to stop.
@@ -27713,66 +28535,46 @@ async function followGemLogs(ctx, params, options) {
27713
28535
  }
27714
28536
  const seen = new Set;
27715
28537
  const deadline = Date.now() + options.durationMs;
27716
- let pollCount = 0;
27717
28538
  let resumeCursor = null;
27718
- let attemptedStream = false;
27719
- while (true) {
27720
- pollCount += 1;
27721
- emitLogFollowPhase(ctx, "polling", pollCount);
27722
- const result = await executeOperation(ctx, "gem.logs", params);
27723
- const unwrapped = unwrapToolResult(result);
27724
- for (const entry of normalizeLogEntries(unwrapped)) {
27725
- if (seen.has(entry.key)) {
27726
- continue;
27727
- }
27728
- seen.add(entry.key);
27729
- emitFollowLogEntry(ctx, entry.value);
27730
- resumeCursor = newerLogCursor(resumeCursor, entry.value);
27731
- }
27732
- if (!attemptedStream) {
27733
- attemptedStream = true;
27734
- const remainingMs2 = deadline - Date.now();
27735
- const slug = resolveLogStreamArtifactSlug(params, unwrapped);
27736
- if (slug !== null && remainingMs2 > 0) {
27737
- const outcome = await followRuntimeLogSse(ctx, {
27738
- slug,
27739
- params,
27740
- resumeCursor,
27741
- seen,
27742
- remainingMs: remainingMs2
27743
- });
27744
- if (outcome.kind === "ended") {
27745
- emitFollowStreamEnded(ctx, seen.size);
27746
- return;
27747
- }
27748
- if (outcome.kind === "timeout") {
27749
- emitFollowTimeout(ctx, options.durationMs, pollCount, seen.size);
27750
- return;
27751
- }
27752
- resumeCursor = outcome.resumeCursor;
27753
- }
27754
- }
27755
- const remainingMs = deadline - Date.now();
27756
- if (remainingMs <= 0) {
27757
- if (pollCount >= MIN_LOG_FOLLOW_POLLS) {
27758
- break;
27759
- }
27760
- if (ctx.abortSignal.aborted) {
27761
- throw new CliError("Cancelled.", {
27762
- code: ExitCode.Cancelled,
27763
- cause: ctx.abortSignal.reason
27764
- });
27765
- }
28539
+ const exported = [];
28540
+ emitLogFollowPhase(ctx, "history");
28541
+ const unwrapped = unwrapToolResult(await executeOperation(ctx, "gem.logs", params));
28542
+ for (const entry of normalizeLogEntries(unwrapped)) {
28543
+ if (seen.has(entry.key)) {
27766
28544
  continue;
27767
28545
  }
27768
- await sleep2(Math.min(options.pollIntervalMs, remainingMs), undefined, {
27769
- signal: ctx.abortSignal
27770
- });
28546
+ seen.add(entry.key);
28547
+ emitFollowLogEntry(ctx, entry.value);
28548
+ if (options.exportPath !== undefined) {
28549
+ exported.push(entry.value);
28550
+ }
28551
+ resumeCursor = newerLogCursor(resumeCursor, entry.value);
28552
+ }
28553
+ const slug = resolveLogStreamArtifactSlug(params, unwrapped);
28554
+ if (slug === null) {
28555
+ await finishLogExport(ctx, options.exportPath, exported);
28556
+ throw new CliError("Gem logs --follow needs the Gem id. Pass --gem <gem-id> or run inside a linked Gem project.", { errorCode: "gem_logs_follow_gem_unresolved" });
28557
+ }
28558
+ const outcome = await followRuntimeLogSse(ctx, {
28559
+ slug,
28560
+ params,
28561
+ resumeCursor,
28562
+ seen,
28563
+ exported,
28564
+ remainingMs: Math.max(deadline - Date.now(), 0)
28565
+ });
28566
+ await finishLogExport(ctx, options.exportPath, exported);
28567
+ if (outcome.kind === "not_found") {
28568
+ throw new CliError(`Gem ${slug} has no runtime log stream. Create a Release, then follow its logs.`, { errorCode: "gem_logs_stream_unavailable" });
28569
+ }
28570
+ if (outcome.kind === "timeout") {
28571
+ emitFollowTimeout(ctx, options.durationMs, seen.size);
28572
+ return;
27771
28573
  }
27772
- emitFollowTimeout(ctx, options.durationMs, pollCount, seen.size);
28574
+ emitFollowStreamEnded(ctx, seen.size);
27773
28575
  }
27774
28576
  async function followRuntimeLogSse(ctx, args) {
27775
- emitLogFollowPhase(ctx, "streaming", 0);
28577
+ emitLogFollowPhase(ctx, "streaming");
27776
28578
  const timeout = AbortSignal.timeout(args.remainingMs);
27777
28579
  let resumeCursor = args.resumeCursor;
27778
28580
  try {
@@ -27782,14 +28584,17 @@ async function followRuntimeLogSse(ctx, args) {
27782
28584
  ...typeof args.params["limit"] === "number" ? { limit: args.params["limit"] } : {},
27783
28585
  ...typeof args.params["level"] === "string" ? { level: args.params["level"] } : {},
27784
28586
  ...typeof args.params["release_id"] === "string" ? { releaseId: args.params["release_id"] } : {},
27785
- ...typeof args.params["run_id"] === "string" ? { runtimeRunId: args.params["run_id"] } : {}
28587
+ ...typeof args.params["run_id"] === "string" ? { runtimeRunId: args.params["run_id"] } : {},
28588
+ ...typeof args.params["request_id"] === "string" ? { requestId: args.params["request_id"] } : {},
28589
+ ...typeof args.params["since"] === "string" ? { since: args.params["since"] } : {},
28590
+ ...typeof args.params["until"] === "string" ? { until: args.params["until"] } : {}
27786
28591
  },
27787
28592
  ...resumeCursor === null ? {} : { lastEventId: resumeCursor },
27788
28593
  signal: timeout,
27789
28594
  cliOperation: "gem.logs.follow"
27790
28595
  });
27791
28596
  if (streamed.notFound === true || streamed.stream === undefined) {
27792
- return { kind: "not_found", resumeCursor };
28597
+ return { kind: "not_found" };
27793
28598
  }
27794
28599
  for await (const event of parseSseEventStream(streamed.stream)) {
27795
28600
  const payload = sseLogPayload(event.data);
@@ -27802,6 +28607,9 @@ async function followRuntimeLogSse(ctx, args) {
27802
28607
  }
27803
28608
  args.seen.add(key);
27804
28609
  emitFollowLogEntry(ctx, payload);
28610
+ if (args.exported !== undefined) {
28611
+ args.exported.push(payload);
28612
+ }
27805
28613
  resumeCursor = newerLogCursor(resumeCursor, payload);
27806
28614
  }
27807
28615
  return { kind: "ended" };
@@ -27818,6 +28626,21 @@ async function followRuntimeLogSse(ctx, args) {
27818
28626
  throw error2;
27819
28627
  }
27820
28628
  }
28629
+ async function finishLogExport(ctx, exportPath, entries) {
28630
+ if (exportPath === undefined) {
28631
+ return;
28632
+ }
28633
+ await exportLogEntries(ctx, exportPath, entries);
28634
+ }
28635
+ async function exportLogEntries(ctx, exportPath, entries) {
28636
+ const targetPath = resolve6(ctx.cwd, exportPath);
28637
+ await writeFile3(targetPath, `${JSON.stringify(entries, null, 2)}
28638
+ `, "utf8");
28639
+ if (ctx.outputFormat === "text") {
28640
+ ctx.io.stderr.write(`Exported ${entries.length} loaded log lines to ${targetPath}.
28641
+ `);
28642
+ }
28643
+ }
27821
28644
  function sseLogPayload(data) {
27822
28645
  let parsed;
27823
28646
  try {
@@ -27876,13 +28699,12 @@ function isGemUuid(value) {
27876
28699
  function isAbortError2(error2) {
27877
28700
  return error2 instanceof Error && error2.name === "AbortError" || error2 instanceof Error && error2.name === "TimeoutError";
27878
28701
  }
27879
- function emitFollowTimeout(ctx, durationMs, pollCount, emitted) {
28702
+ function emitFollowTimeout(ctx, durationMs, emitted) {
27880
28703
  if (ctx.outputFormat === "stream-json") {
27881
28704
  writeStreamJson(ctx.io, "timeout", {
27882
28705
  operation: "gem.logs.follow",
27883
28706
  reason: "bounded_follow_cap_reached",
27884
28707
  duration_ms: durationMs,
27885
- polls: pollCount,
27886
28708
  emitted
27887
28709
  });
27888
28710
  writeStreamJson(ctx.io, "done", { operation: "gem.logs.follow" });
@@ -27903,20 +28725,17 @@ function emitFollowStreamEnded(ctx, emitted) {
27903
28725
  ctx.io.stderr.write(`Stopped following Gem logs (${emitted} line${emitted === 1 ? "" : "s"} emitted).
27904
28726
  `);
27905
28727
  }
27906
- function emitLogFollowPhase(ctx, phase, pollCount) {
28728
+ function emitLogFollowPhase(ctx, phase) {
27907
28729
  if (ctx.outputFormat === "stream-json") {
27908
28730
  writeStreamJson(ctx.io, "phase", {
27909
28731
  operation: "gem.logs.follow",
27910
- phase,
27911
- poll: pollCount
28732
+ phase
27912
28733
  });
27913
- } else if (phase === "streaming") {
27914
- ctx.io.stderr.write(`Streaming Gem logs...
27915
- `);
27916
- } else {
27917
- ctx.io.stderr.write(`Polling Gem logs (${pollCount})...
27918
- `);
28734
+ return;
27919
28735
  }
28736
+ ctx.io.stderr.write(phase === "streaming" ? `Streaming Gem logs...
28737
+ ` : `Reading recent Gem logs...
28738
+ `);
27920
28739
  }
27921
28740
  function emitFollowLogEntry(ctx, entry) {
27922
28741
  if (ctx.outputFormat === "stream-json") {
@@ -27927,7 +28746,7 @@ function emitFollowLogEntry(ctx, entry) {
27927
28746
  }
27928
28747
  function normalizeLogEntries(value) {
27929
28748
  const root = jsonObjectOrNull2(value);
27930
- const candidate = root === null ? value : root["logs"];
28749
+ const candidate = root === null ? [] : root["logs"];
27931
28750
  if (!Array.isArray(candidate)) {
27932
28751
  return [];
27933
28752
  }
@@ -28493,10 +29312,20 @@ Run \`uru status\` to inspect them, save or push your changes, or re-run \`uru p
28493
29312
  ${preview}${moreLine}`;
28494
29313
  }
28495
29314
  async function remoteSourceOperation(ctx, operationId, params) {
28496
- return {
28497
- available: true,
28498
- result: await executeOperation(ctx, operationId, params)
28499
- };
29315
+ try {
29316
+ return {
29317
+ available: true,
29318
+ result: await executeOperation(ctx, operationId, params)
29319
+ };
29320
+ } catch (error2) {
29321
+ if (ctx.abortSignal.aborted) {
29322
+ throw error2;
29323
+ }
29324
+ return {
29325
+ available: false,
29326
+ error: normalizeError(error2).message
29327
+ };
29328
+ }
28500
29329
  }
28501
29330
  function formatRemoteSummary(remote) {
28502
29331
  if (!remote.available) {
@@ -30408,7 +31237,7 @@ async function dispatchRegistryFamilyCommand({
30408
31237
  // src/config.ts
30409
31238
  import { chmod as chmod3, mkdir as mkdir7, open as open2, readFile as readFile10, rename as rename3, rm as rm4 } from "node:fs/promises";
30410
31239
  import { constants as constants2 } from "node:fs";
30411
- import { randomUUID as randomUUID3 } from "node:crypto";
31240
+ import { randomUUID as randomUUID4 } from "node:crypto";
30412
31241
  import { homedir as homedir2 } from "node:os";
30413
31242
  import { dirname as dirname7, join as join5 } from "node:path";
30414
31243
  function resolveConfigHome(env = process.env) {
@@ -30444,7 +31273,7 @@ function createConfigStore(path = configPath()) {
30444
31273
  await mkdir7(dirname7(path), { recursive: true });
30445
31274
  const body = `${JSON.stringify(sanitizeConfig(config2), null, 2)}
30446
31275
  `;
30447
- const temporaryPath = `${path}.${process.pid}.${randomUUID3()}.tmp`;
31276
+ const temporaryPath = `${path}.${process.pid}.${randomUUID4()}.tmp`;
30448
31277
  let handle = null;
30449
31278
  try {
30450
31279
  handle = await open2(temporaryPath, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY, constants2.S_IRUSR | constants2.S_IWUSR);