@uru-intelligence/cli 0.4.18 → 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.18",
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",
@@ -15266,20 +15507,11 @@ var zTriggersResponse = object({
15266
15507
  success: boolean2(),
15267
15508
  triggers: array(record(string2(), unknown()))
15268
15509
  });
15269
- var zUpdateBillingRequest = object({
15270
- architectEnabled: boolean2().nullish(),
15271
- automationsEnabled: boolean2().nullish(),
15272
- automationsMonthlyPriceUsd: number2().nullish(),
15273
- automationsPlanTier: string2().nullish(),
15510
+ var zUpdateBillingRequest = strictObject({
15274
15511
  automationsWeeklyBudgetUsd: number2().gte(0).nullish(),
15275
15512
  billingEmail: email2().nullish(),
15276
15513
  billingName: string2().nullish(),
15277
- chatEnabled: boolean2().nullish(),
15278
- chatMonthlyPriceUsd: number2().nullish(),
15279
- chatPlanTier: string2().nullish(),
15280
15514
  chatWeeklyBudgetUsd: number2().gte(0).nullish(),
15281
- markupPercentage: number2().nullish(),
15282
- planType: string2().nullish(),
15283
15515
  spendingAlertThresholdUsd: number2().gte(0).nullish(),
15284
15516
  spendingLimitUsd: number2().gte(0).nullish()
15285
15517
  });
@@ -15302,6 +15534,10 @@ var zUpdateConnectionLabelResponse = object({
15302
15534
  var zUpdateExternalPermissionsRequest = object({
15303
15535
  permissions: zExternalPermissions
15304
15536
  });
15537
+ var zUpdateLibraryExternalSourceRequest = object({
15538
+ enabled: boolean2().optional(),
15539
+ syncIntervalMinutes: int().gte(1).lte(10080).optional()
15540
+ });
15305
15541
  var zUpdatePersonaIdentity = object({
15306
15542
  avatarUrl: string2().nullish(),
15307
15543
  departments: array(string2()).nullish(),
@@ -15355,7 +15591,7 @@ var zUpdatePersonaRequest = object({
15355
15591
  var zUpdatePublishedPageLinkGateRequest = object({
15356
15592
  emailAllowlist: array(string2()).nullish(),
15357
15593
  emailGateEnabled: boolean2().nullish(),
15358
- expiresAt: string2().nullish(),
15594
+ expiresAt: exports_iso.datetime({ offset: true }).nullish(),
15359
15595
  gateType: _enum(["none", "passcode", "email_otp", "passcode_email_otp"]).nullish(),
15360
15596
  passcode: string2().max(128).nullish(),
15361
15597
  searchIndexingDisabled: boolean2().nullish(),
@@ -15933,7 +16169,13 @@ var zGetToolAccessMatrixApiAccessControlToolsToolMatrixGetPath = object({
15933
16169
  });
15934
16170
  var zGetAdminAuditLogApiAdminAuditLogGetQuery = object({
15935
16171
  limit: int().gte(1).lte(100).optional().default(50),
15936
- 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()
15937
16179
  });
15938
16180
  var zAdminListInvitationsApiAdminInvitationsGetQuery = object({
15939
16181
  limit: int().gte(1).lte(100).optional().default(50),
@@ -16923,9 +17165,25 @@ var zGetAvailableModelsApiModelsAvailableGetQuery = object({
16923
17165
  });
16924
17166
  var zExportActivityLogsApiMonitoringActivityExportGetQuery = object({
16925
17167
  dateRange: string2().optional().default("7d"),
16926
- format: string2().optional().default("json")
17168
+ format: string2().optional().default("json"),
17169
+ action: string2().nullish(),
17170
+ resourceType: string2().nullish(),
17171
+ actorUserId: string2().nullish()
16927
17172
  });
16928
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());
16929
17187
  var zGetRecentActivityApiMonitoringActivityRecentGetQuery = object({
16930
17188
  limit: int().gte(1).lte(500).optional().default(100)
16931
17189
  });
@@ -17382,11 +17640,14 @@ var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetPath = object({
17382
17640
  var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetQuery = object({
17383
17641
  limit: int().gte(1).lte(500).optional().default(100),
17384
17642
  deploymentId: string2().nullish(),
17643
+ releaseId: string2().nullish(),
17385
17644
  runtimeRunId: string2().nullish(),
17386
17645
  level: string2().nullish(),
17387
- requestId: string2().nullish()
17646
+ requestId: string2().nullish(),
17647
+ cursor: string2().nullish(),
17648
+ since: string2().nullish(),
17649
+ until: string2().nullish()
17388
17650
  });
17389
- var zListAppLogsApiPlatformArtifactsArtifactSlugAppLogsGetResponse = array(zAppLogRecord);
17390
17651
  var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetPath = object({
17391
17652
  artifactSlug: string2()
17392
17653
  });
@@ -17397,7 +17658,9 @@ var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetQuery = object
17397
17658
  releaseId: string2().nullish(),
17398
17659
  runtimeRunId: string2().nullish(),
17399
17660
  level: string2().nullish(),
17400
- requestId: string2().nullish()
17661
+ requestId: string2().nullish(),
17662
+ since: string2().nullish(),
17663
+ until: string2().nullish()
17401
17664
  });
17402
17665
  var zStreamAppLogsApiPlatformArtifactsArtifactSlugAppLogsStreamGetResponse = string2();
17403
17666
  var zGetAppReleaseOverviewApiPlatformArtifactsArtifactSlugAppReleaseOverviewGetPath = object({
@@ -18163,6 +18426,8 @@ var zDatasetExternalSourceGetResponse = object({
18163
18426
  relationName: string2().nullable(),
18164
18427
  relationSchema: string2().nullable(),
18165
18428
  supabaseRef: string2(),
18429
+ syncIntervalSeconds: int(),
18430
+ syncMode: _enum(["manual", "scheduled"]),
18166
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}$/),
18167
18432
  writeEnabled: boolean2().nullable()
18168
18433
  }).nullable();
@@ -18185,6 +18450,8 @@ var zDatasetExternalSourcePutBody = object({
18185
18450
  relationName: string2().nullish().default(null),
18186
18451
  relationSchema: string2().nullish().default(null),
18187
18452
  supabaseRef: string2().min(1),
18453
+ syncIntervalSeconds: int().gte(60).lte(86400).optional().default(1800),
18454
+ syncMode: _enum(["manual", "scheduled"]).optional().default("manual"),
18188
18455
  writeEnabled: boolean2().nullish().default(null)
18189
18456
  });
18190
18457
  var zDatasetExternalSourcePutPath = object({
@@ -18213,9 +18480,38 @@ var zDatasetExternalSourcePutResponse = object({
18213
18480
  relationName: string2().nullable(),
18214
18481
  relationSchema: string2().nullable(),
18215
18482
  supabaseRef: string2(),
18483
+ syncIntervalSeconds: int(),
18484
+ syncMode: _enum(["manual", "scheduled"]),
18216
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}$/),
18217
18486
  writeEnabled: boolean2().nullable()
18218
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
+ });
18219
18515
  var zDatasetExternalSourceTestBody = object({
18220
18516
  allowedColumns: array(string2().min(1)).nullish().default(null),
18221
18517
  allowedWriteColumns: array(string2()).nullish().default(null),
@@ -18235,6 +18531,8 @@ var zDatasetExternalSourceTestBody = object({
18235
18531
  relationName: string2().nullish().default(null),
18236
18532
  relationSchema: string2().nullish().default(null),
18237
18533
  supabaseRef: string2().min(1),
18534
+ syncIntervalSeconds: int().gte(60).lte(86400).optional().default(1800),
18535
+ syncMode: _enum(["manual", "scheduled"]).optional().default("manual"),
18238
18536
  writeEnabled: boolean2().nullish().default(null)
18239
18537
  });
18240
18538
  var zDatasetExternalSourceTestPath = object({
@@ -18981,6 +19279,9 @@ var zGetFrictionReportCleanupResponse = object({
18981
19279
  severity: string2(),
18982
19280
  status: string2()
18983
19281
  });
19282
+ var zDeleteGemLinkHeaders = object({
19283
+ "idempotency-key": string2().min(1).max(200)
19284
+ });
18984
19285
  var zDeleteGemLinkPath = object({
18985
19286
  linkId: string2()
18986
19287
  });
@@ -18992,10 +19293,16 @@ var zUpdateGemLinkAccessResponse = record(string2(), unknown());
18992
19293
  var zCreateGemLinkEmailCaptureDatasetPath = object({
18993
19294
  linkId: string2()
18994
19295
  });
19296
+ var zRevokeGemLinkHeaders = object({
19297
+ "idempotency-key": string2().min(1).max(200)
19298
+ });
18995
19299
  var zRevokeGemLinkPath = object({
18996
19300
  linkId: string2()
18997
19301
  });
18998
19302
  var zRevokeGemLinkResponse = record(string2(), unknown());
19303
+ var zRotateGemLinkHeaders = object({
19304
+ "idempotency-key": string2().min(1).max(200)
19305
+ });
18999
19306
  var zRotateGemLinkPath = object({
19000
19307
  linkId: string2()
19001
19308
  });
@@ -19113,6 +19420,10 @@ var zRestoreGemVersionPath = object({
19113
19420
  gemRef: string2().min(1),
19114
19421
  resourceId: string2().min(1)
19115
19422
  });
19423
+ var zRetryGemVersionPath = object({
19424
+ gemRef: string2().min(1),
19425
+ resourceId: string2().min(1)
19426
+ });
19116
19427
  var zGetAvailableLibrariesApiPlatformLibrariesAvailableGetResponse = record(string2(), unknown());
19117
19428
  var zGetAvailableIconsApiPlatformLibrariesIconsGetResponse = record(string2(), unknown());
19118
19429
  var zGetLibrariesManifestApiPlatformLibrariesManifestGetResponse = record(string2(), unknown());
@@ -19137,9 +19448,24 @@ var zDeleteLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdDeleteP
19137
19448
  var zGetLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdGetPath = object({
19138
19449
  sourceId: string2()
19139
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
+ });
19140
19460
  var zRebindLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdRebindPostPath = object({
19141
19461
  sourceId: string2()
19142
19462
  });
19463
+ var zResumeLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdResumePostPath = object({
19464
+ sourceId: string2()
19465
+ });
19466
+ var zRunNowLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdRunNowPostPath = object({
19467
+ sourceId: string2()
19468
+ });
19143
19469
  var zSyncLibraryExternalSourceApiPlatformLibraryExternalSourcesSourceIdSyncPostPath = object({
19144
19470
  sourceId: string2()
19145
19471
  });
@@ -19759,8 +20085,9 @@ var zGetPublishedPagePreviewImageApiPublicPagesSlugPreviewImagePublicPreviewRout
19759
20085
  var zPublicArtifactToolProxyExecuteApiPublicPagesSlugToolProxyExecutePostBody = strictObject({
19760
20086
  forceRefresh: boolean2().optional().default(false),
19761
20087
  idempotencyKey: string2().max(128).nullish(),
19762
- operation: string2().min(1).max(256).regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/),
20088
+ operation: string2().min(1).max(256),
19763
20089
  parameters: record(string2(), unknown()).optional().default({}),
20090
+ requestId: string2().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/).optional(),
19764
20091
  role: string2().min(1).max(64).regex(/^[a-z][a-z0-9_]{0,63}$/),
19765
20092
  timeoutMs: int().gte(1000).lte(60000).optional().default(25000)
19766
20093
  });
@@ -19849,6 +20176,13 @@ var zInvokeAppQueryApiRuntimeAppsDeploymentIdQueryCapabilityNamePostPath = objec
19849
20176
  var zAppRuntimeStorageExecutePath = object({
19850
20177
  deploymentId: uuid2()
19851
20178
  });
20179
+ var zAppRuntimeUploadGrantCreatePath = object({
20180
+ deploymentId: uuid2()
20181
+ });
20182
+ var zAppRuntimeUploadGrantCompletePath = object({
20183
+ deploymentId: uuid2(),
20184
+ uploadId: uuid2()
20185
+ });
19852
20186
  var zProviderInvokeAppActionApiRuntimeProviderAppsDeploymentIdActionCapabilityNamePostPath = object({
19853
20187
  deploymentId: string2(),
19854
20188
  capabilityName: string2()
@@ -20317,6 +20651,9 @@ var zGetGemGitSourcePath = object({
20317
20651
  var zCommandGemGitSourcePath = object({
20318
20652
  artifactId: uuid2()
20319
20653
  });
20654
+ var zCopyGemGitSourcePath = object({
20655
+ artifactId: uuid2()
20656
+ });
20320
20657
  var zInspectGemGitPreviewPath = object({
20321
20658
  artifactId: uuid2(),
20322
20659
  previewId: uuid2()
@@ -20376,6 +20713,19 @@ var zDeviceAuthorizationOauthDeviceCodePostBody = object({
20376
20713
  var zValidateMcpTokenOauthMcpTokenValidatePostResponse = record(string2(), unknown());
20377
20714
  var zRobotsTxtRobotsTxtGetResponse = string2();
20378
20715
 
20716
+ // ../../packages/types/src/mcp/gemResult.ts
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
+
20379
20729
  // src/json.ts
20380
20730
  function isRecord(value) {
20381
20731
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -20420,23 +20770,11 @@ function pickString(record2, keys) {
20420
20770
  return;
20421
20771
  }
20422
20772
 
20423
- // src/gem-panel-client.ts
20424
- function stripTerminalControl(value) {
20425
- let out = "";
20426
- for (const ch of value) {
20427
- const code = ch.codePointAt(0) ?? 0;
20428
- const isControl = code < 32 && code !== 10 && code !== 9 || code === 127 || code >= 128 && code <= 159;
20429
- out += isControl ? "�" : ch;
20430
- }
20431
- return out;
20432
- }
20433
-
20434
- // ../../packages/types/src/mcp/gemResult.ts
20435
- var GEM_RESULT_SCHEMA_V1 = "uru.gem.result.v1";
20436
20773
  // src/gem-result.ts
20437
20774
  function gemEnvelope(body, operation) {
20438
20775
  if (!isRecord(body) || body["schema"] !== GEM_RESULT_SCHEMA_V1) {
20439
- throw new CliError(`Gem ${operation} returned an unsupported result envelope schema.`);
20776
+ const seen = isRecord(body) && typeof body["schema"] === "string" ? body["schema"] : "none";
20777
+ throw new CliError(`Gem ${operation} answered with a result envelope this CLI does not read ` + `(schema ${seen}; this CLI reads ${GEM_RESULT_SCHEMA_V1}). The operation may ` + "have completed on the server: check with `uru library ls` before you retry, " + "then use the CLI version that matches the server.");
20440
20778
  }
20441
20779
  if (!Object.hasOwn(body, "result") || !Object.hasOwn(body, "error")) {
20442
20780
  throw new CliError(`Gem ${operation} returned an incomplete result envelope.`);
@@ -20663,6 +21001,7 @@ class UruApiClient {
20663
21001
  Accept: "application/json",
20664
21002
  "X-Uru-Client-Name": "uru-cli",
20665
21003
  "X-Uru-Client-Version": CLI_VERSION,
21004
+ "X-Uru-Gem-Result-Schema": GEM_RESULT_SCHEMA_V1,
20666
21005
  ...options.cliOperation === undefined ? {} : { "X-Uru-Client-Operation": options.cliOperation },
20667
21006
  ...this.workspaceId === undefined ? {} : { "X-Uru-Workspace-Id": this.workspaceId },
20668
21007
  ...options.body === undefined ? {} : { "Content-Type": "application/json" }
@@ -20689,6 +21028,7 @@ class UruApiClient {
20689
21028
  Accept: "application/x-ndjson, application/json",
20690
21029
  "X-Uru-Client-Name": "uru-cli",
20691
21030
  "X-Uru-Client-Version": CLI_VERSION,
21031
+ "X-Uru-Gem-Result-Schema": GEM_RESULT_SCHEMA_V1,
20692
21032
  ...options.cliOperation === undefined ? {} : { "X-Uru-Client-Operation": options.cliOperation },
20693
21033
  ...this.workspaceId === undefined ? {} : { "X-Uru-Workspace-Id": this.workspaceId },
20694
21034
  ...options.body === undefined ? {} : { "Content-Type": "application/json" }
@@ -20722,6 +21062,7 @@ class UruApiClient {
20722
21062
  Accept: "text/event-stream",
20723
21063
  "X-Uru-Client-Name": "uru-cli",
20724
21064
  "X-Uru-Client-Version": CLI_VERSION,
21065
+ "X-Uru-Gem-Result-Schema": GEM_RESULT_SCHEMA_V1,
20725
21066
  ...options.cliOperation === undefined ? {} : { "X-Uru-Client-Operation": options.cliOperation },
20726
21067
  ...this.workspaceId === undefined ? {} : { "X-Uru-Workspace-Id": this.workspaceId },
20727
21068
  ...options.lastEventId === undefined || options.lastEventId === "" ? {} : { "Last-Event-ID": options.lastEventId }
@@ -21997,19 +22338,24 @@ Upload local Gem source with source-version CAS. Without a matching lock, push
21997
22338
  fails instead of silently overwriting remote edits. Generated directories,
21998
22339
  node_modules, VCS metadata, and local env files are excluded.
21999
22340
  `,
22000
- 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>]
22001
22342
 
22002
- Print bounded runtime logs for the Gem, one logical Release, or one Run. With --follow,
22003
- the CLI streams runtime logs for up to 30 minutes and polls if the stream is unavailable;
22004
- text status goes to stderr and log lines go to stdout. Use global --output stream-json
22005
- 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.
22006
22352
  `,
22007
22353
  open: `Usage: uru open [library/name.gem] [--link <link-id-or-name>]
22008
22354
 
22009
22355
  Print one explicit active Link URL. When a Gem has more than one active Link,
22010
22356
  use --link to choose the Link rather than guessing which URL you mean.
22011
22357
  `,
22012
- 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> [...]
22013
22359
  uru gems validate [library/name.gem] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
22014
22360
  uru gems build [library/name.gem] [--force] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
22015
22361
 
@@ -22017,7 +22363,11 @@ Dedicated Gem lifecycle and filesystem commands. These are adapters over the
22017
22363
  same platform operations used by MCP and the web UI.
22018
22364
 
22019
22365
  validate and build return a hosted_job_id immediately. Pass --wait to poll
22020
- 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.
22021
22371
  `,
22022
22372
  "gems fs": `Usage: uru gems fs ls [library/name.gem] [path] [--recursive]
22023
22373
  uru gems fs read [library/name.gem] <file>
@@ -22067,9 +22417,11 @@ operation for this grant.
22067
22417
  uru gems versions diff [library/name.gem] <from-version> <to-version>
22068
22418
  uru gems versions restore [library/name.gem] <version>
22069
22419
  uru gems versions preview [library/name.gem] <version>
22420
+ uru gems versions retry [library/name.gem] <version>
22070
22421
 
22071
22422
  Save and inspect frozen Gem checkpoints. Name and message are optional. Saving,
22072
- 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.
22073
22425
  `,
22074
22426
  "gems edits": `Usage: uru gems edits list [library/name.gem]
22075
22427
  uru gems edits show [library/name.gem] <edit>
@@ -22100,12 +22452,14 @@ Version instead. --version on its own is refused, because a following Link would
22100
22452
  discard it and publish something else. Changing one Link does not move any other
22101
22453
  Link.
22102
22454
  `,
22103
- "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>]
22104
22456
  uru gems runs show [library/name.gem] <run>
22105
22457
  uru gems runs cancel [library/name.gem] <run>
22106
22458
 
22107
- Inspect and control bounded Gem executions. Builds and Release attempts are not
22108
- 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.
22109
22463
  `,
22110
22464
  "gems capabilities": `Usage: uru gems capabilities list [library/name.gem]
22111
22465
  uru gems capabilities enable|disable [library/name.gem] <capability> --kind <query|action|job>
@@ -22119,24 +22473,38 @@ required when changing a capability because names are not globally unique.
22119
22473
 
22120
22474
  Inspect and control declared Gem job schedules. Run now requires an explicit
22121
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.
22122
22484
  `,
22123
22485
  "gems bindings": `Usage: uru gems bindings list [library/name.gem]
22124
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>
22125
22488
  uru gems bindings resolve [library/name.gem] --build <build-id>
22126
22489
 
22127
22490
  List declared Gem needs, bind a need to an approved connection or resource, or
22128
22491
  resolve deterministic safe bindings for a ready Build. Source names a logical
22129
- role. Bindings attach the live connection. Do not put connection ids in Gem
22130
- 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.
22131
22497
  `,
22132
22498
  "gems api": `Usage: uru gems api describe [library/name.gem]
22133
- uru gems api query [library/name.gem] <capability> [--input-json '{...}']
22134
- uru gems api action [library/name.gem] <capability> --idempotency-key <key> [--input-json '{...}']
22135
- 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 '{...}']
22136
22502
 
22137
22503
  Describe what a published Gem offers, then run one declared query, action, or
22138
- job. Call describe before query, action, or job. Actions and jobs require an
22139
- 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.
22140
22508
  `,
22141
22509
  "gems domains": `Usage: uru gems domains list [library/name.gem] [--limit <n>]
22142
22510
  uru gems domains set [library/name.gem] <hostname>
@@ -22157,6 +22525,13 @@ requests and need --yes. The runtime alias uses the same operations.
22157
22525
  library: `Usage: uru library ls [path]
22158
22526
  uru library stat <path>
22159
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>
22160
22535
  uru library mkdir <path>
22161
22536
  uru library read <path>
22162
22537
  uru library write <path> (--file <local-path>|--content <text>|--stdin) [--create] [--folder-id <id>]
@@ -22180,7 +22555,8 @@ known. Patch and patch-preview take a Codex envelope, not a full file
22180
22555
  replacement. For binary files, use \`uru library upload\`
22181
22556
  (\`library.upload_preflight\`, \`library.upload_create_session\`,
22182
22557
  \`library.upload_complete_session\`); for Gem child source files, use
22183
- \`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.
22184
22560
  `,
22185
22561
  "library upload": `Usage: uru library upload [path] --file <local-path> [--folder-id <id>] [--conflict replace|keep_both|skip]
22186
22562
  uru library upload preflight [path] [--filename <name>] [--folder-id <id>]
@@ -22195,6 +22571,10 @@ creates a session. PUT the bytes to the returned endpoint, then complete.
22195
22571
  uru datasets get|inspect <dataset-id>
22196
22572
  uru datasets history <dataset-id> [--limit 100] [--cursor <cursor>] [--version-id <id>]
22197
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>
22198
22578
  uru datasets query <dataset-id> [--limit 100] [--cursor <cursor>] [--filter-json '{...}'] [--select name,status]
22199
22579
  uru datasets create|update|rows|restore|sql|sql-write --params-json '{...}'
22200
22580
 
@@ -23643,6 +24023,7 @@ class UruSdkError extends Error {
23643
24023
  }
23644
24024
 
23645
24025
  // src/local-commands.ts
24026
+ import { randomUUID } from "node:crypto";
23646
24027
  import { readFile as readFile3, stat } from "node:fs/promises";
23647
24028
  import { basename, resolve as resolve2 } from "node:path";
23648
24029
  import { setTimeout as sleep } from "node:timers/promises";
@@ -24116,7 +24497,14 @@ var REGISTRY_FAMILY_SNAKE_CASE_ALIASES = new Set([
24116
24497
  "item_id",
24117
24498
  "label_id",
24118
24499
  "label_value",
24119
- "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"
24120
24508
  ]);
24121
24509
  function canonicalCliFieldToToolProtocol(key) {
24122
24510
  if (REGISTRY_FAMILY_SNAKE_CASE_ALIASES.has(key)) {
@@ -24166,6 +24554,14 @@ async function dispatchLibrary(ctx, sub, args) {
24166
24554
  }, { textExtractor: extractLibraryTextContent });
24167
24555
  return;
24168
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
+ }
24169
24565
  if (sub === "write") {
24170
24566
  const flags = parseLocalFlags(args, ["library", "write"]);
24171
24567
  const path = requireCommandValue(flags.positionals[0], "Usage: uru library write <path> (--file <local-path>|--content <text>|--stdin) [--create] [--folder-id <id>]");
@@ -24249,7 +24645,96 @@ async function dispatchLibrary(ctx, sub, args) {
24249
24645
  await emitTool(ctx, "library.empty_trash", {});
24250
24646
  return;
24251
24647
  }
24252
- 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);
24253
24738
  }
24254
24739
  var LIBRARY_UPLOAD_PREFLIGHT_VERBS = new Set([
24255
24740
  "preflight",
@@ -24430,9 +24915,17 @@ async function dispatchDatasets(ctx, sub, args) {
24430
24915
  return;
24431
24916
  }
24432
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
+ }
24433
24922
  await dispatchDatasetCommand(ctx, sub, args);
24434
24923
  return;
24435
24924
  }
24925
+ if (sub === "source") {
24926
+ await dispatchDatasetSourceCommand(ctx, args[0], args.slice(1));
24927
+ return;
24928
+ }
24436
24929
  await dispatchRegistryFamily(ctx, "datasets", sub, args);
24437
24930
  }
24438
24931
  async function dispatchDatasetCommand(ctx, sub, args) {
@@ -24501,6 +24994,108 @@ async function dispatchDatasetCommand(ctx, sub, args) {
24501
24994
  return;
24502
24995
  }
24503
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
+ }
24504
25099
  async function dispatchAutomations(ctx, sub, args) {
24505
25100
  if (sub === "ls" || sub === "list") {
24506
25101
  const flags = parseLocalFlags(args, ["automations", "ls"]);
@@ -25714,6 +26309,121 @@ import { mkdir as mkdir4, readFile as readFile8, writeFile as writeFile3 } from
25714
26309
  import { join as join3, resolve as resolve6 } from "node:path";
25715
26310
  import { setTimeout as sleep2 } from "node:timers/promises";
25716
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
+
25717
26427
  // src/gem-fs-commands.ts
25718
26428
  import { readFile as readFile6 } from "node:fs/promises";
25719
26429
  import { resolve as resolve5 } from "node:path";
@@ -25873,7 +26583,7 @@ async function dispatchGemFs(ctx, verb, args, linkedProject) {
25873
26583
  }
25874
26584
 
25875
26585
  // src/gem-git-source-commands.ts
25876
- import { randomUUID } from "node:crypto";
26586
+ import { randomUUID as randomUUID2 } from "node:crypto";
25877
26587
  var GIT_SOURCE_PATH = "/api/v1/artifacts";
25878
26588
  async function dispatchGemGitSource(ctx, verb, args, linkedProject) {
25879
26589
  if (verb === undefined || verb === "help") {
@@ -25889,8 +26599,8 @@ async function dispatchGemGitSource(ctx, verb, args, linkedProject) {
25889
26599
  const flags = parseLocalFlags(args, ["gems", "source", verb]);
25890
26600
  const reference = await resolveArtifactReference(ctx, flags, linkedProject);
25891
26601
  if (verb === "copy") {
25892
- const result2 = await client(ctx).api(`/api/platform/artifacts/${encodeURIComponent(reference.slug)}/clone`, { method: "POST" });
25893
- 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));
25894
26604
  return;
25895
26605
  }
25896
26606
  if (verb === "status") {
@@ -25910,7 +26620,7 @@ function commandFromFlags(verb, flags) {
25910
26620
  return toJsonCommand({
25911
26621
  action: "retry",
25912
26622
  importId: requiredImportId(flags, "retry"),
25913
- idempotencyKey: flags.values["--idempotency-key"]?.trim() || randomUUID()
26623
+ idempotencyKey: flags.values["--idempotency-key"]?.trim() || randomUUID2()
25914
26624
  });
25915
26625
  case "cancel":
25916
26626
  return toJsonCommand({
@@ -25952,10 +26662,7 @@ async function resolveArtifactReference(ctx, flags, linkedProject) {
25952
26662
  if (artifactId === undefined) {
25953
26663
  throw new CliError(`Gem inspection did not return an artifact id for ${reference}.`);
25954
26664
  }
25955
- return {
25956
- artifactId,
25957
- slug: findArtifactSlug(inspected) ?? artifactId
25958
- };
26665
+ return { artifactId };
25959
26666
  }
25960
26667
  function findArtifactId(value) {
25961
26668
  if (isJsonObject2(value)) {
@@ -25989,34 +26696,6 @@ function findArtifactId(value) {
25989
26696
  function isUuid(value) {
25990
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);
25991
26698
  }
25992
- function findArtifactSlug(value) {
25993
- if (isJsonObject2(value)) {
25994
- const slug = stringField2(value, [
25995
- "artifact_slug",
25996
- "artifactSlug",
25997
- "slug"
25998
- ]);
25999
- if (slug !== undefined && !slug.includes("/")) {
26000
- return slug;
26001
- }
26002
- for (const nested of Object.values(value)) {
26003
- const found = findArtifactSlug(nested);
26004
- if (found !== undefined) {
26005
- return found;
26006
- }
26007
- }
26008
- return;
26009
- }
26010
- if (Array.isArray(value)) {
26011
- for (const nested of value) {
26012
- const found = findArtifactSlug(nested);
26013
- if (found !== undefined) {
26014
- return found;
26015
- }
26016
- }
26017
- }
26018
- return;
26019
- }
26020
26699
  function requiredImportId(flags, verb) {
26021
26700
  const importId = flags.values["--import-id"]?.trim();
26022
26701
  if (!importId) {
@@ -26124,23 +26803,25 @@ function formatGitSourceState(value) {
26124
26803
  return lines.length === 0 ? JSON.stringify(value, null, 2) : lines.join(`
26125
26804
  `);
26126
26805
  }
26127
- function formatCloneResult(value) {
26806
+ function formatCopyResult(value) {
26128
26807
  const record2 = isJsonObject2(value) ? value : undefined;
26129
- const artifactId = record2 === undefined ? undefined : stringField2(record2, ["id", "artifactId", "artifact_id"]);
26808
+ const artifactId = record2 === undefined ? undefined : stringField2(record2, ["artifactId", "artifact_id", "id"]);
26130
26809
  const title = record2 === undefined ? undefined : stringField2(record2, ["title"]);
26810
+ const commitSha = record2 === undefined ? undefined : stringField2(record2, ["copiedFromCommitSha", "copied_from_commit_sha"]);
26131
26811
  if (artifactId === undefined && title === undefined) {
26132
26812
  return JSON.stringify(value, null, 2);
26133
26813
  }
26134
26814
  return [
26135
- "Gem copied.",
26136
- artifactId === undefined ? undefined : `Artifact: ${artifactId}`,
26137
- 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)}`
26138
26819
  ].filter((line) => line !== undefined).join(`
26139
26820
  `);
26140
26821
  }
26141
26822
 
26142
26823
  // src/held-idempotency-keys.ts
26143
- import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
26824
+ import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
26144
26825
  import { constants } from "node:fs";
26145
26826
  import { chmod, link, mkdir as mkdir3, open, readFile as readFile7, rename, rm as rm2 } from "node:fs/promises";
26146
26827
  import { dirname as dirname4, join as join2 } from "node:path";
@@ -26155,7 +26836,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
26155
26836
  return withHeldEntriesLock(path, async () => {
26156
26837
  const stored = await readHeldEntries(path);
26157
26838
  const existing = stored[fingerprint];
26158
- const owner = `${process.pid}:${randomUUID2()}`;
26839
+ const owner = `${process.pid}:${randomUUID3()}`;
26159
26840
  if (existing !== undefined) {
26160
26841
  const updated = {
26161
26842
  ...existing,
@@ -26167,7 +26848,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
26167
26848
  release: () => releaseHold(io, path, fingerprint, existing.key, owner)
26168
26849
  };
26169
26850
  }
26170
- const key = randomUUID2();
26851
+ const key = randomUUID3();
26171
26852
  await writeHeldEntries(path, {
26172
26853
  ...stored,
26173
26854
  [fingerprint]: { key, heldAt: now.toISOString(), owners: [owner] }
@@ -26277,7 +26958,7 @@ async function withHeldEntriesLock(path, action) {
26277
26958
  continue;
26278
26959
  }
26279
26960
  try {
26280
- const lockToken = randomUUID2();
26961
+ const lockToken = randomUUID3();
26281
26962
  const contents = `${process.pid}
26282
26963
  ${lockToken}
26283
26964
  `;
@@ -26360,7 +27041,7 @@ async function tryCreateHeldLock(path) {
26360
27041
  }
26361
27042
  try {
26362
27043
  const contents = `${process.pid}
26363
- ${randomUUID2()}
27044
+ ${randomUUID3()}
26364
27045
  `;
26365
27046
  await handle.writeFile(contents, "utf8");
26366
27047
  await handle.sync();
@@ -26419,7 +27100,7 @@ async function readHeldLockObservation(path) {
26419
27100
  }
26420
27101
  }
26421
27102
  async function removeHeldLockIfMatches(path, expected) {
26422
- const quarantinePath = `${path}.${process.pid}.${randomUUID2()}.quarantine`;
27103
+ const quarantinePath = `${path}.${process.pid}.${randomUUID3()}.quarantine`;
26423
27104
  try {
26424
27105
  await rename(path, quarantinePath);
26425
27106
  await syncParentDirectory(path);
@@ -26479,7 +27160,7 @@ async function writeHeldEntries(path, entries) {
26479
27160
  }
26480
27161
  const body = `${JSON.stringify(entries, null, 2)}
26481
27162
  `;
26482
- const temporaryPath = `${path}.${process.pid}.${randomUUID2()}.tmp`;
27163
+ const temporaryPath = `${path}.${process.pid}.${randomUUID3()}.tmp`;
26483
27164
  let handle = null;
26484
27165
  try {
26485
27166
  handle = await open(temporaryPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, constants.S_IRUSR | constants.S_IWUSR);
@@ -26599,6 +27280,10 @@ async function dispatchGemLifecycleResourceCommand(ctx, sub, args, linkedProject
26599
27280
  await dispatchGemSchedules(ctx, args, linkedProject);
26600
27281
  return true;
26601
27282
  }
27283
+ if (sub === "events") {
27284
+ await dispatchGemEvents(ctx, args, linkedProject);
27285
+ return true;
27286
+ }
26602
27287
  if (sub === "bindings") {
26603
27288
  await dispatchGemBindings(ctx, args, linkedProject);
26604
27289
  return true;
@@ -26655,11 +27340,11 @@ async function dispatchGemVersions(ctx, args, linkedProject) {
26655
27340
  });
26656
27341
  return;
26657
27342
  }
26658
- if (verb === "show" || verb === "restore" || verb === "preview") {
27343
+ if (verb === "show" || verb === "restore" || verb === "preview" || verb === "retry") {
26659
27344
  const flags = parseLocalFlags(rest, ["gems", "versions", verb]);
26660
27345
  const version2 = lifecycleResourceArg(flags, `Usage: uru gems versions ${verb} <gem> <version>`);
26661
27346
  const path = gemPathFromArgs(flags, linkedProject);
26662
- 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);
26663
27348
  return;
26664
27349
  }
26665
27350
  if (verb === "diff") {
@@ -26672,7 +27357,7 @@ async function dispatchGemVersions(ctx, args, linkedProject) {
26672
27357
  });
26673
27358
  return;
26674
27359
  }
26675
- 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>");
26676
27361
  }
26677
27362
  async function gemVersionSave(ctx, args, linkedProject, commandPath = ["gems", "versions", "save"]) {
26678
27363
  const flags = parseLocalFlags(args, commandPath);
@@ -26878,6 +27563,8 @@ async function dispatchGemRuns(ctx, args, linkedProject) {
26878
27563
  };
26879
27564
  copyStringFlag(flags, params, "--cursor", "cursor");
26880
27565
  copyStringFlag(flags, params, "--status", "status");
27566
+ copyStringFlag(flags, params, "--environment", "environment");
27567
+ copyStringFlag(flags, params, "--version", "version_id");
26881
27568
  copyOptionalIntegerFlag(flags, params, "--limit", "limit");
26882
27569
  await emitGemTool(ctx, "gem.runs_list", params, {
26883
27570
  textExtractor: (value) => formatGemResourceList("runs", value)
@@ -26951,6 +27638,59 @@ async function dispatchGemSchedules(ctx, args, linkedProject) {
26951
27638
  }
26952
27639
  throw new CliError("Usage: uru gems schedules list <gem> | arm|pause|resume <gem> <capability> | run <gem> <capability> --idempotency-key <key>");
26953
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
+ }
26954
27694
  async function gemDeployRelease(ctx, args, linkedProject) {
26955
27695
  const flags = parseLocalFlags(args, ["gems", "deploy"]);
26956
27696
  const versionId = lifecycleResourceArg(flags, "Usage: uru gems deploy <version> [library/name.gem] [--link <name>] [--pin]");
@@ -27018,6 +27758,20 @@ async function dispatchGemBuildDiagnostics(ctx, verb, args, linkedProject) {
27018
27758
  path: gemPathFromArgs(flags, linkedProject)
27019
27759
  });
27020
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
+ }
27021
27775
  async function dispatchGemBindings(ctx, args, linkedProject) {
27022
27776
  const [verb, ...rest] = args;
27023
27777
  if (verb === "list") {
@@ -27029,18 +27783,20 @@ async function dispatchGemBindings(ctx, args, linkedProject) {
27029
27783
  }
27030
27784
  if (verb === "upsert") {
27031
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
+ }
27032
27791
  const usage = "Usage: uru gems bindings upsert [library/name.gem] --source-ref-type <type> --source-ref <ref> --target-resource-type <type>";
27033
27792
  const params = {
27034
- path: gemPathFromArgs(flags, linkedProject),
27793
+ path,
27035
27794
  source_ref_type: requireCommandValue(flags.values["--source-ref-type"], usage),
27036
27795
  source_ref: requireCommandValue(flags.values["--source-ref"], usage),
27037
27796
  target_resource_type: requireCommandValue(flags.values["--target-resource-type"], usage)
27038
27797
  };
27039
27798
  copyStringFlag(flags, params, "--target-resource-id", "target_resource_id");
27040
27799
  copyStringFlag(flags, params, "--target-resource-ref", "target_resource_ref");
27041
- copyStringFlag(flags, params, "--tool-connection-id", "tool_connection_id");
27042
- copyStringFlag(flags, params, "--tool-capability-id", "tool_capability_id");
27043
- copyStringFlag(flags, params, "--environment-key", "environment_key");
27044
27800
  copyStringFlag(flags, params, "--binding-status", "binding_status");
27045
27801
  copyStringFlag(flags, params, "--policy-level", "policy_level");
27046
27802
  await emitGemTool(ctx, "gem.upsert_binding", params);
@@ -27175,6 +27931,10 @@ function extractVersionRestoreSummary(value) {
27175
27931
  const version2 = versionLabel(value, "version");
27176
27932
  return `Restored Version${version2 === null ? "" : ` ${version2}`} to Draft. No Links changed.`;
27177
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
+ }
27178
27938
  function extractReleaseSummary(value) {
27179
27939
  const release = directResultObject(value, "release");
27180
27940
  const version2 = versionLabelFromObject(release?.["version"] ?? release);
@@ -27347,6 +28107,10 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
27347
28107
  await gemLogs(ctx, args, linkedProject, ["gems", "logs"]);
27348
28108
  return;
27349
28109
  }
28110
+ if (sub === "debug-token") {
28111
+ await gemDebugToken(ctx, args, linkedProject);
28112
+ return;
28113
+ }
27350
28114
  if (sub === "status") {
27351
28115
  const flags = parseLocalFlags(args, ["gems", "status"]);
27352
28116
  await emitGemTool(ctx, "gem.status", {
@@ -27366,7 +28130,7 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
27366
28130
  await gemWrite(ctx, args);
27367
28131
  return;
27368
28132
  }
27369
- 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");
27370
28134
  }
27371
28135
  async function dispatchGemOperationalResourceCommand(ctx, sub, args, linkedProject) {
27372
28136
  if (sub === "domains") {
@@ -27551,9 +28315,13 @@ async function gemValidate(ctx, args, linkedProject) {
27551
28315
  async function gemBuild(ctx, args, linkedProject, commandPath = ["build"]) {
27552
28316
  const flags = parseLocalFlags(args, commandPath);
27553
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
+ }
27554
28322
  await enqueueGemHostedJob(ctx, flags, linkedProject, {
27555
- operationId: "gem.build",
27556
- force: true,
28323
+ operationId: dryRun ? "gem.validate" : "gem.build",
28324
+ force: !dryRun,
27557
28325
  ...outdir === undefined ? {} : { outdir }
27558
28326
  });
27559
28327
  }
@@ -27572,9 +28340,6 @@ async function enqueueGemHostedJob(ctx, flags, linkedProject, options) {
27572
28340
  if (options.force && flags.booleans.has("--force")) {
27573
28341
  params["force"] = true;
27574
28342
  }
27575
- if (flags.booleans.has("--dry-run")) {
27576
- params["dry_run"] = true;
27577
- }
27578
28343
  copyStringFlag(flags, params, "--source-revision-id", "source_revision_id");
27579
28344
  if (ctx.outputFormat === "stream-json") {
27580
28345
  writeStreamJson(ctx.io, "started", {
@@ -27680,6 +28445,15 @@ function emitGemHostedJobSync(ctx, job) {
27680
28445
  }
27681
28446
  writeText(ctx.io, status === "" ? `hosted_job_id ${hostedJobId}` : `hosted_job_id ${hostedJobId} status ${status}`);
27682
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
+ }
27683
28457
  async function gemLogs(ctx, args, linkedProject, commandPath = ["logs"]) {
27684
28458
  const flags = parseLocalFlags(args, commandPath);
27685
28459
  const params = {
@@ -27689,28 +28463,71 @@ async function gemLogs(ctx, args, linkedProject, commandPath = ["logs"]) {
27689
28463
  copyStringFlag(flags, params, "--level", "level");
27690
28464
  copyStringFlag(flags, params, "--release", "release_id");
27691
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"];
27692
28471
  if (flags.booleans.has("--follow")) {
27693
28472
  await followGemLogs(ctx, params, {
27694
28473
  durationMs: boundedIntegerFlag(flags, "--follow-duration-ms", DEFAULT_LOG_FOLLOW_DURATION_MS, MAX_LOG_FOLLOW_DURATION_MS),
27695
- pollIntervalMs: boundedIntegerFlag(flags, "--poll-interval-ms", DEFAULT_LOG_FOLLOW_POLL_INTERVAL_MS, MAX_LOG_FOLLOW_POLL_INTERVAL_MS)
28474
+ ...exportPath === undefined ? {} : { exportPath }
27696
28475
  });
27697
28476
  return;
27698
28477
  }
27699
- 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
+ `);
27700
28521
  }
27701
28522
  var DEFAULT_LOG_FOLLOW_DURATION_MS = 30 * 60 * 1000;
27702
28523
  var MAX_LOG_FOLLOW_DURATION_MS = 30 * 60 * 1000;
27703
- var DEFAULT_LOG_FOLLOW_POLL_INTERVAL_MS = 1000;
27704
- var MAX_LOG_FOLLOW_POLL_INTERVAL_MS = 30000;
27705
- var MIN_LOG_FOLLOW_POLLS = 2;
27706
28524
  async function followGemLogs(ctx, params, options) {
27707
28525
  const path = typeof params["path"] === "string" ? params["path"] : undefined;
27708
28526
  if (ctx.outputFormat === "stream-json") {
27709
28527
  writeStreamJson(ctx.io, "started", {
27710
28528
  operation: "gem.logs.follow",
27711
28529
  ...path === undefined ? {} : { path },
27712
- duration_ms: options.durationMs,
27713
- poll_interval_ms: options.pollIntervalMs
28530
+ duration_ms: options.durationMs
27714
28531
  });
27715
28532
  } else {
27716
28533
  ctx.io.stderr.write(`Following Gem logs for up to ${Math.ceil(options.durationMs / 1000)}s. Press Ctrl-C to stop.
@@ -27718,66 +28535,46 @@ async function followGemLogs(ctx, params, options) {
27718
28535
  }
27719
28536
  const seen = new Set;
27720
28537
  const deadline = Date.now() + options.durationMs;
27721
- let pollCount = 0;
27722
28538
  let resumeCursor = null;
27723
- let attemptedStream = false;
27724
- while (true) {
27725
- pollCount += 1;
27726
- emitLogFollowPhase(ctx, "polling", pollCount);
27727
- const result = await executeOperation(ctx, "gem.logs", params);
27728
- const unwrapped = unwrapToolResult(result);
27729
- for (const entry of normalizeLogEntries(unwrapped)) {
27730
- if (seen.has(entry.key)) {
27731
- continue;
27732
- }
27733
- seen.add(entry.key);
27734
- emitFollowLogEntry(ctx, entry.value);
27735
- resumeCursor = newerLogCursor(resumeCursor, entry.value);
27736
- }
27737
- if (!attemptedStream) {
27738
- attemptedStream = true;
27739
- const remainingMs2 = deadline - Date.now();
27740
- const slug = resolveLogStreamArtifactSlug(params, unwrapped);
27741
- if (slug !== null && remainingMs2 > 0) {
27742
- const outcome = await followRuntimeLogSse(ctx, {
27743
- slug,
27744
- params,
27745
- resumeCursor,
27746
- seen,
27747
- remainingMs: remainingMs2
27748
- });
27749
- if (outcome.kind === "ended") {
27750
- emitFollowStreamEnded(ctx, seen.size);
27751
- return;
27752
- }
27753
- if (outcome.kind === "timeout") {
27754
- emitFollowTimeout(ctx, options.durationMs, pollCount, seen.size);
27755
- return;
27756
- }
27757
- resumeCursor = outcome.resumeCursor;
27758
- }
27759
- }
27760
- const remainingMs = deadline - Date.now();
27761
- if (remainingMs <= 0) {
27762
- if (pollCount >= MIN_LOG_FOLLOW_POLLS) {
27763
- break;
27764
- }
27765
- if (ctx.abortSignal.aborted) {
27766
- throw new CliError("Cancelled.", {
27767
- code: ExitCode.Cancelled,
27768
- cause: ctx.abortSignal.reason
27769
- });
27770
- }
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)) {
27771
28544
  continue;
27772
28545
  }
27773
- await sleep2(Math.min(options.pollIntervalMs, remainingMs), undefined, {
27774
- signal: ctx.abortSignal
27775
- });
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;
27776
28573
  }
27777
- emitFollowTimeout(ctx, options.durationMs, pollCount, seen.size);
28574
+ emitFollowStreamEnded(ctx, seen.size);
27778
28575
  }
27779
28576
  async function followRuntimeLogSse(ctx, args) {
27780
- emitLogFollowPhase(ctx, "streaming", 0);
28577
+ emitLogFollowPhase(ctx, "streaming");
27781
28578
  const timeout = AbortSignal.timeout(args.remainingMs);
27782
28579
  let resumeCursor = args.resumeCursor;
27783
28580
  try {
@@ -27787,14 +28584,17 @@ async function followRuntimeLogSse(ctx, args) {
27787
28584
  ...typeof args.params["limit"] === "number" ? { limit: args.params["limit"] } : {},
27788
28585
  ...typeof args.params["level"] === "string" ? { level: args.params["level"] } : {},
27789
28586
  ...typeof args.params["release_id"] === "string" ? { releaseId: args.params["release_id"] } : {},
27790
- ...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"] } : {}
27791
28591
  },
27792
28592
  ...resumeCursor === null ? {} : { lastEventId: resumeCursor },
27793
28593
  signal: timeout,
27794
28594
  cliOperation: "gem.logs.follow"
27795
28595
  });
27796
28596
  if (streamed.notFound === true || streamed.stream === undefined) {
27797
- return { kind: "not_found", resumeCursor };
28597
+ return { kind: "not_found" };
27798
28598
  }
27799
28599
  for await (const event of parseSseEventStream(streamed.stream)) {
27800
28600
  const payload = sseLogPayload(event.data);
@@ -27807,6 +28607,9 @@ async function followRuntimeLogSse(ctx, args) {
27807
28607
  }
27808
28608
  args.seen.add(key);
27809
28609
  emitFollowLogEntry(ctx, payload);
28610
+ if (args.exported !== undefined) {
28611
+ args.exported.push(payload);
28612
+ }
27810
28613
  resumeCursor = newerLogCursor(resumeCursor, payload);
27811
28614
  }
27812
28615
  return { kind: "ended" };
@@ -27823,6 +28626,21 @@ async function followRuntimeLogSse(ctx, args) {
27823
28626
  throw error2;
27824
28627
  }
27825
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
+ }
27826
28644
  function sseLogPayload(data) {
27827
28645
  let parsed;
27828
28646
  try {
@@ -27881,13 +28699,12 @@ function isGemUuid(value) {
27881
28699
  function isAbortError2(error2) {
27882
28700
  return error2 instanceof Error && error2.name === "AbortError" || error2 instanceof Error && error2.name === "TimeoutError";
27883
28701
  }
27884
- function emitFollowTimeout(ctx, durationMs, pollCount, emitted) {
28702
+ function emitFollowTimeout(ctx, durationMs, emitted) {
27885
28703
  if (ctx.outputFormat === "stream-json") {
27886
28704
  writeStreamJson(ctx.io, "timeout", {
27887
28705
  operation: "gem.logs.follow",
27888
28706
  reason: "bounded_follow_cap_reached",
27889
28707
  duration_ms: durationMs,
27890
- polls: pollCount,
27891
28708
  emitted
27892
28709
  });
27893
28710
  writeStreamJson(ctx.io, "done", { operation: "gem.logs.follow" });
@@ -27908,20 +28725,17 @@ function emitFollowStreamEnded(ctx, emitted) {
27908
28725
  ctx.io.stderr.write(`Stopped following Gem logs (${emitted} line${emitted === 1 ? "" : "s"} emitted).
27909
28726
  `);
27910
28727
  }
27911
- function emitLogFollowPhase(ctx, phase, pollCount) {
28728
+ function emitLogFollowPhase(ctx, phase) {
27912
28729
  if (ctx.outputFormat === "stream-json") {
27913
28730
  writeStreamJson(ctx.io, "phase", {
27914
28731
  operation: "gem.logs.follow",
27915
- phase,
27916
- poll: pollCount
28732
+ phase
27917
28733
  });
27918
- } else if (phase === "streaming") {
27919
- ctx.io.stderr.write(`Streaming Gem logs...
27920
- `);
27921
- } else {
27922
- ctx.io.stderr.write(`Polling Gem logs (${pollCount})...
27923
- `);
28734
+ return;
27924
28735
  }
28736
+ ctx.io.stderr.write(phase === "streaming" ? `Streaming Gem logs...
28737
+ ` : `Reading recent Gem logs...
28738
+ `);
27925
28739
  }
27926
28740
  function emitFollowLogEntry(ctx, entry) {
27927
28741
  if (ctx.outputFormat === "stream-json") {
@@ -27932,7 +28746,7 @@ function emitFollowLogEntry(ctx, entry) {
27932
28746
  }
27933
28747
  function normalizeLogEntries(value) {
27934
28748
  const root = jsonObjectOrNull2(value);
27935
- const candidate = root === null ? value : root["logs"];
28749
+ const candidate = root === null ? [] : root["logs"];
27936
28750
  if (!Array.isArray(candidate)) {
27937
28751
  return [];
27938
28752
  }
@@ -28498,10 +29312,20 @@ Run \`uru status\` to inspect them, save or push your changes, or re-run \`uru p
28498
29312
  ${preview}${moreLine}`;
28499
29313
  }
28500
29314
  async function remoteSourceOperation(ctx, operationId, params) {
28501
- return {
28502
- available: true,
28503
- result: await executeOperation(ctx, operationId, params)
28504
- };
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
+ }
28505
29329
  }
28506
29330
  function formatRemoteSummary(remote) {
28507
29331
  if (!remote.available) {
@@ -30413,7 +31237,7 @@ async function dispatchRegistryFamilyCommand({
30413
31237
  // src/config.ts
30414
31238
  import { chmod as chmod3, mkdir as mkdir7, open as open2, readFile as readFile10, rename as rename3, rm as rm4 } from "node:fs/promises";
30415
31239
  import { constants as constants2 } from "node:fs";
30416
- import { randomUUID as randomUUID3 } from "node:crypto";
31240
+ import { randomUUID as randomUUID4 } from "node:crypto";
30417
31241
  import { homedir as homedir2 } from "node:os";
30418
31242
  import { dirname as dirname7, join as join5 } from "node:path";
30419
31243
  function resolveConfigHome(env = process.env) {
@@ -30449,7 +31273,7 @@ function createConfigStore(path = configPath()) {
30449
31273
  await mkdir7(dirname7(path), { recursive: true });
30450
31274
  const body = `${JSON.stringify(sanitizeConfig(config2), null, 2)}
30451
31275
  `;
30452
- const temporaryPath = `${path}.${process.pid}.${randomUUID3()}.tmp`;
31276
+ const temporaryPath = `${path}.${process.pid}.${randomUUID4()}.tmp`;
30453
31277
  let handle = null;
30454
31278
  try {
30455
31279
  handle = await open2(temporaryPath, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY, constants2.S_IRUSR | constants2.S_IWUSR);