@uru-intelligence/cli 0.5.0 → 0.5.2
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/CHANGELOG.md +4 -0
- package/README.md +17 -46
- package/dist/library.mjs +46 -15
- package/dist/uru.mjs +335 -123
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -80,10 +80,14 @@
|
|
|
80
80
|
- Action: No action is required. `uru doctor` gains a `data access` check and fails when a credential validates but cannot execute tools; a token supplied through `--token` or `URU_TOKEN` is no longer told to run `uru login`.
|
|
81
81
|
- Send scope on uru automations create, honor --output/--json on uru tools run, and keep errorId plus httpStatus on JSON errors. — surfaces: cli; reference: apps/cli/src/local-commands.ts
|
|
82
82
|
- Action: uru automations create now sends scope=workspace by default. Pass --scope personal when creating a personal automation. JSON errors include errorId and httpStatus when the API provides them.
|
|
83
|
+
- Stop repeated browser or device consent after a new session is rejected. Cancel browser sign-in cleanly, reject unrelated callbacks, and bound OAuth network waits. Explain the supported Codex, Claude, Cursor, and Manus connection paths. — surfaces: cli, docs; reference: docs/research/2026-09-10-cli-mcp-auth-compatibility.md
|
|
84
|
+
- Action: Install CLI 0.5.2 with the matching Uru server release. Run uru login once. Cursor uses the documented public client ID.
|
|
83
85
|
- The CLI tells the server which Gem result envelope it reads, and a server that cannot answer in it refuses before it acts instead of after the write. — surfaces: cli; reference: https://linear.app/uru-intelligence/issue/URU-1000
|
|
84
86
|
- Action: Nothing to do. If an older server answers with an envelope this CLI does not read, the error now says the operation may have completed and to check with uru library ls before retrying.
|
|
85
87
|
- Tip library_fs read refusals toward library_query, and ship labels/list aliases that need a live catalog with list_labels/create_label. — surfaces: cli, docs; reference: PR #5379 CF001; PR #5381 staging labels catalog
|
|
86
88
|
- Action: Prefer published CLI >= 0.4.15. Use uru sharing labels_list / label_create (or operations sharing.labels_list / sharing.label_create). library_fs read ops should point callers at library_query instead of an opaque safety refusal.
|
|
89
|
+
- uru operations inspect <id> and uru <family> <verb> --get-schema print the operation's real input schema, narrowed to its op, with the op's examples, instead of Input schema: {}. — surfaces: cli; reference: URU-1425
|
|
90
|
+
- Action: Nothing to change. A not-logged-in inspect prints a pointer to uru login and exits 0; operations ls stays local and schema-free.
|
|
87
91
|
- Use the shared SemVer contract when deciding whether to show a CLI update notice. — surfaces: cli, release; reference: docs/plans/cli-sdk-native-release-modernization/PLAN.md
|
|
88
92
|
- Action: No action is required; prerelease and malformed registry versions now follow the same validation and ordering rules as release publication.
|
|
89
93
|
|
package/README.md
CHANGED
|
@@ -247,52 +247,23 @@ URU_CLI_MCP_STAGING_SMOKE_TARGET=staging \
|
|
|
247
247
|
bun --filter=@uru-intelligence/cli run smoke:staging -- --json
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
Publish the scoped CLI
|
|
251
|
-
`
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
value-free publication-state artifact records the observed npm SRI even when a
|
|
268
|
-
publish response or a later gate fails. Re-dispatching the same immutable
|
|
269
|
-
candidate selector resumes only when npm already serves that exact certified
|
|
270
|
-
SRI; it then repeats the registry and published-matrix proof before evidence,
|
|
271
|
-
tag, or GitHub release creation. A different SRI fails closed. A changed source
|
|
272
|
-
or failed certification needs a higher-version forward fix; no npm version is
|
|
273
|
-
ever rewritten.
|
|
274
|
-
|
|
275
|
-
The workflow requires the immutable, no-bypass CLI tag policy before npm
|
|
276
|
-
publication and revalidates it before tag creation. GitHub hides a ruleset's
|
|
277
|
-
bypass actors from an ordinary workflow token, so the two policy-check steps
|
|
278
|
-
mint a short-lived, repository-scoped GitHub App token solely to inspect that
|
|
279
|
-
property. The App's client ID is the `production` environment variable
|
|
280
|
-
`CLI_RULESET_AUDIT_APP_CLIENT_ID`; its private key is the matching
|
|
281
|
-
`CLI_RULESET_AUDIT_APP_PRIVATE_KEY` environment secret. Its administration
|
|
282
|
-
write grant is required for visibility only and is never available to the npm
|
|
283
|
-
publication step or the tag/release creation step. Only after published evidence
|
|
284
|
-
is retained does the workflow create the annotated
|
|
285
|
-
`uru-cli-vX.Y.Z` tag at the exact dispatched `main` commit and a GitHub release
|
|
286
|
-
with generated notes. The final job verifies an existing tag is annotated and
|
|
287
|
-
points to that same commit before it can resume an interrupted GitHub-release
|
|
288
|
-
request; it never changes the npm package, repoints a tag, or treats a draft or
|
|
289
|
-
prerelease as success. Before the first use, repository policy must contain an
|
|
290
|
-
active, no-bypass `refs/tags/uru-cli-v*` rule that blocks both updates and
|
|
291
|
-
deletions; the workflow queries and requires it before creating the tag.
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
bun --filter=@uru-intelligence/cli run smoke:registry
|
|
295
|
-
```
|
|
250
|
+
Publish the scoped CLI through the **Publish Uru CLI to npm** workflow
|
|
251
|
+
(`.github/workflows/publish-uru-cli.yml`) from `staging` or `main`. Pass the exact
|
|
252
|
+
`apps/cli/package.json` version as its `version` input. The workflow rejects
|
|
253
|
+
other branches or a version mismatch.
|
|
254
|
+
|
|
255
|
+
The workflow runs the source gates, builds one tarball, and retains its integrity
|
|
256
|
+
values. Package smoke tests check that tarball before npm trusted publishing
|
|
257
|
+
runs from the protected environment. Publication uses the retained tarball with
|
|
258
|
+
`--ignore-scripts`, rather than rebuilding it. A retry may reuse an already
|
|
259
|
+
published version only when its integrity is identical. A different package
|
|
260
|
+
needs a higher version.
|
|
261
|
+
|
|
262
|
+
The final job rebuilds the checked-out CLI and tests it against staging using
|
|
263
|
+
credentials supplied by Infisical. It does not install the registry package.
|
|
264
|
+
Check that job and its retained smoke report, then install the exact published
|
|
265
|
+
version in a clean directory and verify the intended behavior. A successful npm
|
|
266
|
+
upload or source smoke alone does not complete registry verification.
|
|
296
267
|
|
|
297
268
|
The npm package remains the canonical install path. Release builds can also
|
|
298
269
|
produce standalone Bun-compiled binaries for the planned macOS/Linux/Windows
|
package/dist/library.mjs
CHANGED
|
@@ -6334,6 +6334,15 @@ var zArtifactBuildDiagnostic = object({
|
|
|
6334
6334
|
rawDiagnosticId: string2().nullish(),
|
|
6335
6335
|
relatedLocations: array(zArtifactBuildDiagnosticLocation).optional().default([])
|
|
6336
6336
|
});
|
|
6337
|
+
var zArtifactBuildJob = object({
|
|
6338
|
+
attempts: int().optional().default(0),
|
|
6339
|
+
createdAt: string2().nullish(),
|
|
6340
|
+
id: string2(),
|
|
6341
|
+
lastError: string2().nullish(),
|
|
6342
|
+
leaseExpiresAt: string2().nullish(),
|
|
6343
|
+
status: string2(),
|
|
6344
|
+
updatedAt: string2().nullish()
|
|
6345
|
+
}).nullable();
|
|
6337
6346
|
var zArtifactBuildRequest = object({
|
|
6338
6347
|
content: string2().nullish(),
|
|
6339
6348
|
currentSourceRevisionId: string2().nullish(),
|
|
@@ -6420,7 +6429,7 @@ var zArtifactProjectFileUpdateRequest = object({
|
|
|
6420
6429
|
content: string2().nullish(),
|
|
6421
6430
|
contentBase64: string2().nullish(),
|
|
6422
6431
|
createIfMissing: boolean2().optional().default(false),
|
|
6423
|
-
path: string2().min(1).max(
|
|
6432
|
+
path: string2().min(1).max(240)
|
|
6424
6433
|
});
|
|
6425
6434
|
var zArtifactRenderEventRequest = object({
|
|
6426
6435
|
dependencyNames: array(string2()).nullish(),
|
|
@@ -6544,6 +6553,7 @@ var zArtifactBuildDescriptor = object({
|
|
|
6544
6553
|
assets: record(string2(), zArtifactFileDescriptor).optional(),
|
|
6545
6554
|
buildDiagnostics: array(zArtifactBuildDiagnostic).optional().default([]),
|
|
6546
6555
|
buildErrors: array(string2()).optional().default([]),
|
|
6556
|
+
buildJob: zArtifactBuildJob.optional(),
|
|
6547
6557
|
buildPipelineVersion: string2().nullish(),
|
|
6548
6558
|
buildStatus: string2().nullish(),
|
|
6549
6559
|
bundleStatus: string2().nullish(),
|
|
@@ -7084,6 +7094,9 @@ var zClientIdMetadataDocument = object({
|
|
|
7084
7094
|
scope: string2().min(1),
|
|
7085
7095
|
token_endpoint_auth_method: _enum(["none"])
|
|
7086
7096
|
});
|
|
7097
|
+
var zCloneArtifactRequest = object({
|
|
7098
|
+
sourceRevisionId: uuid2().optional()
|
|
7099
|
+
});
|
|
7087
7100
|
var zCollectionGateAccessResponse = object({
|
|
7088
7101
|
accessToken: string2(),
|
|
7089
7102
|
expiresAt: string2(),
|
|
@@ -7614,6 +7627,13 @@ var zDebugEntityResponse = object({
|
|
|
7614
7627
|
entityId: string2(),
|
|
7615
7628
|
userId: string2()
|
|
7616
7629
|
});
|
|
7630
|
+
var zDeleteGemVersionResponse = strictObject({
|
|
7631
|
+
deleted: literal(true),
|
|
7632
|
+
linksChanged: literal(false),
|
|
7633
|
+
sourceRevisionId: string2(),
|
|
7634
|
+
versionId: string2(),
|
|
7635
|
+
versionNumber: int()
|
|
7636
|
+
});
|
|
7617
7637
|
var zDeleteNotificationsRequest = object({
|
|
7618
7638
|
notificationIds: array(uuid2())
|
|
7619
7639
|
});
|
|
@@ -11244,17 +11264,17 @@ var zThreadFileView = object({
|
|
|
11244
11264
|
"quarantined",
|
|
11245
11265
|
"failed"
|
|
11246
11266
|
]),
|
|
11247
|
-
bytes: int().
|
|
11267
|
+
bytes: int().nullable(),
|
|
11248
11268
|
createdAtMs: int(),
|
|
11249
11269
|
fileId: uuid2(),
|
|
11250
11270
|
filename: string2(),
|
|
11251
11271
|
folder: _enum(["uploads", "outputs"]),
|
|
11252
11272
|
kind: _enum(["file", "image", "audio", "video"]),
|
|
11253
|
-
mime: string2().
|
|
11273
|
+
mime: string2().nullable(),
|
|
11254
11274
|
modelAccess: _enum(["direct", "sandbox_only"]),
|
|
11255
11275
|
previewUrl: string2().nullable(),
|
|
11256
11276
|
threadId: uuid2(),
|
|
11257
|
-
url: string2().
|
|
11277
|
+
url: string2().nullable()
|
|
11258
11278
|
});
|
|
11259
11279
|
var zThreadFileListResponse = object({
|
|
11260
11280
|
files: array(zThreadFileView),
|
|
@@ -11614,10 +11634,7 @@ var zThreadShareLink = object({
|
|
|
11614
11634
|
snapshotLeafMessageId: string2().nullable(),
|
|
11615
11635
|
threadId: string2()
|
|
11616
11636
|
});
|
|
11617
|
-
var
|
|
11618
|
-
links: array(zThreadShareLink)
|
|
11619
|
-
});
|
|
11620
|
-
var zThreadShareMintResponse = object({
|
|
11637
|
+
var zThreadShareEnsureResponse = object({
|
|
11621
11638
|
link: zThreadShareLink,
|
|
11622
11639
|
token: string2(),
|
|
11623
11640
|
url: string2().nullable()
|
|
@@ -11963,6 +11980,8 @@ var zThreadMessagesListResponse = object({
|
|
|
11963
11980
|
siblings: record(string2(), array(string2()))
|
|
11964
11981
|
});
|
|
11965
11982
|
var zThreadShareSnapshot = object({
|
|
11983
|
+
files: array(zThreadFileView),
|
|
11984
|
+
generatedAt: string2(),
|
|
11966
11985
|
messages: array(zThreadExportMessage),
|
|
11967
11986
|
schema: _enum(["uru.thread-share"]),
|
|
11968
11987
|
sharedAt: string2(),
|
|
@@ -13004,7 +13023,9 @@ var zGetUserDetailApiAdminUsageUsersUserIdGetResponse = record(string2(), unknow
|
|
|
13004
13023
|
var zAdminListUsersApiAdminUsersGetQuery = object({
|
|
13005
13024
|
limit: int().gte(1).lte(100).optional().default(50),
|
|
13006
13025
|
offset: int().gte(0).nullish().default(0),
|
|
13007
|
-
search: string2().max(200).optional()
|
|
13026
|
+
search: string2().max(200).optional(),
|
|
13027
|
+
status: _enum(["active", "deactivated"]).optional(),
|
|
13028
|
+
workspaces: _enum(["one", "many"]).optional()
|
|
13008
13029
|
});
|
|
13009
13030
|
var zAdminGetUserApiAdminUsersUserIdGetPath = object({
|
|
13010
13031
|
userId: string2()
|
|
@@ -14218,6 +14239,7 @@ var zAuthorizeRequestApiOauthAuthorizeRequestGetQuery = object({
|
|
|
14218
14239
|
var zAuthorizeRequestApiOauthAuthorizeRequestGetResponse = object({
|
|
14219
14240
|
client_id: string2(),
|
|
14220
14241
|
client_name: string2(),
|
|
14242
|
+
redirectUri: url(),
|
|
14221
14243
|
resource: url(),
|
|
14222
14244
|
scope: string2(),
|
|
14223
14245
|
workspace_id: string2().nullable(),
|
|
@@ -14567,7 +14589,7 @@ var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesCo
|
|
|
14567
14589
|
artifactSlug: string2()
|
|
14568
14590
|
});
|
|
14569
14591
|
var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesContentGetQuery = object({
|
|
14570
|
-
path: string2().min(1).max(
|
|
14592
|
+
path: string2().min(1).max(240)
|
|
14571
14593
|
});
|
|
14572
14594
|
var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesContentGetResponse = object({
|
|
14573
14595
|
artifactId: string2(),
|
|
@@ -16178,6 +16200,10 @@ var zDiffGemVersionsQuery = object({
|
|
|
16178
16200
|
fromVersion: string2().min(1),
|
|
16179
16201
|
toVersion: string2().min(1)
|
|
16180
16202
|
});
|
|
16203
|
+
var zDeleteGemVersionPath = object({
|
|
16204
|
+
gemRef: string2().min(1),
|
|
16205
|
+
resourceId: string2().min(1)
|
|
16206
|
+
});
|
|
16181
16207
|
var zGetGemVersionPath = object({
|
|
16182
16208
|
gemRef: string2().min(1),
|
|
16183
16209
|
resourceId: string2().min(1)
|
|
@@ -16987,6 +17013,14 @@ var zCspViolationReportApiSecurityCspViolationReportPostBody = string2().default
|
|
|
16987
17013
|
var zThreadShareReadPath = object({
|
|
16988
17014
|
shareId: string2().min(1).max(128)
|
|
16989
17015
|
});
|
|
17016
|
+
var zThreadShareFileContentHeaders = object({
|
|
17017
|
+
Range: string2().optional()
|
|
17018
|
+
});
|
|
17019
|
+
var zThreadShareFileContentPath = object({
|
|
17020
|
+
shareId: string2().min(1).max(128),
|
|
17021
|
+
fileId: string2().min(1).max(200)
|
|
17022
|
+
});
|
|
17023
|
+
var zThreadShareFileContentResponse = string2();
|
|
16990
17024
|
var zBackfillSharedContentMetadataApiSharingBackfillMetadataPostResponse = record(string2(), string2());
|
|
16991
17025
|
var zDeleteNotificationsApiSharingNotificationsDeleteResponse = record(string2(), unknown());
|
|
16992
17026
|
var zGetNotificationsApiSharingNotificationsGetQuery = object({
|
|
@@ -17257,10 +17291,7 @@ var zThreadSandboxListPath = object({
|
|
|
17257
17291
|
var zThreadSandboxListQuery = object({
|
|
17258
17292
|
path: string2().max(512).optional()
|
|
17259
17293
|
});
|
|
17260
|
-
var
|
|
17261
|
-
threadId: uuid2()
|
|
17262
|
-
});
|
|
17263
|
-
var zThreadShareMintPath = object({
|
|
17294
|
+
var zThreadShareEnsurePath = object({
|
|
17264
17295
|
threadId: uuid2()
|
|
17265
17296
|
});
|
|
17266
17297
|
var zThreadShareRevokePath = object({
|
|
@@ -17530,7 +17561,7 @@ function pickString(record2, keys) {
|
|
|
17530
17561
|
// package.json
|
|
17531
17562
|
var package_default = {
|
|
17532
17563
|
name: "@uru-intelligence/cli",
|
|
17533
|
-
version: "0.5.
|
|
17564
|
+
version: "0.5.2",
|
|
17534
17565
|
private: false,
|
|
17535
17566
|
description: "Uru full-platform command line interface",
|
|
17536
17567
|
repository: {
|
package/dist/uru.mjs
CHANGED
|
@@ -880,6 +880,84 @@ var cliNativeOperationContracts = [
|
|
|
880
880
|
function getCliNativeOperationContract(operationId) {
|
|
881
881
|
return cliNativeOperationContracts.find((contract) => contract.operationId === operationId);
|
|
882
882
|
}
|
|
883
|
+
// ../../packages/platform-operations/src/narrow_tool_input_schema.ts
|
|
884
|
+
function narrowToolInputSchemaToOperation(inputSchema, backendOp) {
|
|
885
|
+
if (backendOp === undefined) {
|
|
886
|
+
return inputSchema;
|
|
887
|
+
}
|
|
888
|
+
const union = unionBranchesOf(inputSchema);
|
|
889
|
+
if (union === undefined) {
|
|
890
|
+
return withoutOpKey(inputSchema);
|
|
891
|
+
}
|
|
892
|
+
const keptBranches = union.branches.filter((branch) => branchDeclaresOp(branch, backendOp)).map(withoutOpKey);
|
|
893
|
+
if (keptBranches.length === 0) {
|
|
894
|
+
return withoutOpKey(inputSchema);
|
|
895
|
+
}
|
|
896
|
+
if (keptBranches.length === 1) {
|
|
897
|
+
return withCarriedOverShape(keptBranches[0], inputSchema);
|
|
898
|
+
}
|
|
899
|
+
return { type: "object", oneOf: keptBranches };
|
|
900
|
+
}
|
|
901
|
+
function isSchemaObject(value) {
|
|
902
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
903
|
+
}
|
|
904
|
+
function unionBranchesOf(schema) {
|
|
905
|
+
for (const key of ["oneOf", "anyOf"]) {
|
|
906
|
+
const candidate = schema[key];
|
|
907
|
+
if (Array.isArray(candidate)) {
|
|
908
|
+
return { branches: candidate.filter(isSchemaObject) };
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
function branchDeclaresOp(branch, backendOp) {
|
|
914
|
+
const properties = branch["properties"];
|
|
915
|
+
if (!isSchemaObject(properties)) {
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
const opSchema = properties["op"];
|
|
919
|
+
if (!isSchemaObject(opSchema)) {
|
|
920
|
+
return false;
|
|
921
|
+
}
|
|
922
|
+
if (opSchema["const"] === backendOp) {
|
|
923
|
+
return true;
|
|
924
|
+
}
|
|
925
|
+
const enumValues = opSchema["enum"];
|
|
926
|
+
return Array.isArray(enumValues) && enumValues.includes(backendOp);
|
|
927
|
+
}
|
|
928
|
+
function withoutOpKey(schema) {
|
|
929
|
+
const properties = schema["properties"];
|
|
930
|
+
const required = schema["required"];
|
|
931
|
+
const hasOpProperty = isSchemaObject(properties) && "op" in properties;
|
|
932
|
+
const hasOpRequired = Array.isArray(required) && required.includes("op");
|
|
933
|
+
if (!hasOpProperty && !hasOpRequired) {
|
|
934
|
+
return schema;
|
|
935
|
+
}
|
|
936
|
+
const next = { ...schema };
|
|
937
|
+
if (hasOpProperty) {
|
|
938
|
+
const { op: _op, ...restProperties } = properties;
|
|
939
|
+
next["properties"] = restProperties;
|
|
940
|
+
}
|
|
941
|
+
if (hasOpRequired) {
|
|
942
|
+
next["required"] = required.filter((value) => value !== "op");
|
|
943
|
+
}
|
|
944
|
+
return next;
|
|
945
|
+
}
|
|
946
|
+
function withCarriedOverShape(branch, unionSchema) {
|
|
947
|
+
const missingType = branch["type"] === undefined;
|
|
948
|
+
const missingDescription = branch["description"] === undefined && unionSchema["description"] !== undefined;
|
|
949
|
+
if (!missingType && !missingDescription) {
|
|
950
|
+
return branch;
|
|
951
|
+
}
|
|
952
|
+
const next = { ...branch };
|
|
953
|
+
if (missingType) {
|
|
954
|
+
next["type"] = unionSchema["type"] ?? "object";
|
|
955
|
+
}
|
|
956
|
+
if (missingDescription) {
|
|
957
|
+
next["description"] = unionSchema["description"];
|
|
958
|
+
}
|
|
959
|
+
return next;
|
|
960
|
+
}
|
|
883
961
|
// ../../packages/platform-operations/src/internal_tool_ids.ts
|
|
884
962
|
var internalOnlyPlatformToolIds = new Set([
|
|
885
963
|
"CFO_NEWSLETTER_SQL",
|
|
@@ -915,16 +993,11 @@ var RETIRED_FROZEN_GEM_DATASET_TOOL_NAMES = Object.freeze([
|
|
|
915
993
|
"UPDATE_DATASET",
|
|
916
994
|
"DATASET_UPDATE",
|
|
917
995
|
"LIST_DATASET_ROWS",
|
|
918
|
-
"DATASET_QUERY",
|
|
919
996
|
"GET_DATASET",
|
|
920
|
-
"DATASET_GET",
|
|
921
997
|
"UPSERT_DATASET_ROWS",
|
|
922
998
|
"DELETE_DATASET_ROWS",
|
|
923
999
|
"RESTORE_DATASET_ROWS",
|
|
924
|
-
"
|
|
925
|
-
"DATASET_SQL",
|
|
926
|
-
"DATASET_SQL_READ",
|
|
927
|
-
"DATASET_SQL_WRITE"
|
|
1000
|
+
"DATASET_SQL_READ"
|
|
928
1001
|
]);
|
|
929
1002
|
var DATASET_TOOL_NAMES = new Map([
|
|
930
1003
|
["CREATE_DATASET", "dataset_manage"],
|
|
@@ -932,15 +1005,11 @@ var DATASET_TOOL_NAMES = new Map([
|
|
|
932
1005
|
["UPDATE_DATASET", "dataset_manage"],
|
|
933
1006
|
["DATASET_UPDATE", "dataset_manage"],
|
|
934
1007
|
["LIST_DATASET_ROWS", "dataset_query"],
|
|
935
|
-
["DATASET_QUERY", "dataset_query"],
|
|
936
1008
|
["GET_DATASET", "dataset_get"],
|
|
937
|
-
["DATASET_GET", "dataset_get"],
|
|
938
1009
|
["UPSERT_DATASET_ROWS", "dataset_rows"],
|
|
939
1010
|
["DELETE_DATASET_ROWS", "dataset_rows"],
|
|
940
1011
|
["RESTORE_DATASET_ROWS", "dataset_rows"],
|
|
941
|
-
["
|
|
942
|
-
["DATASET_SQL_READ", "dataset_sql"],
|
|
943
|
-
["DATASET_SQL_WRITE", "dataset_sql_write"]
|
|
1012
|
+
["DATASET_SQL_READ", "dataset_sql"]
|
|
944
1013
|
]);
|
|
945
1014
|
var DATASET_ROW_OPERATIONS = new Map([
|
|
946
1015
|
["UPSERT_DATASET_ROWS", "upsert"],
|
|
@@ -1762,7 +1831,7 @@ function datasetPathSpecs() {
|
|
|
1762
1831
|
const datasetId = [required("dataset-id")];
|
|
1763
1832
|
const pageFlags = [valueFlag("--limit"), valueFlag("--cursor")];
|
|
1764
1833
|
return [
|
|
1765
|
-
pathSpec(["datasets"], "datasets", [optional("operation")], [paramsJsonFlag()], { dynamicFamily: "datasets" }),
|
|
1834
|
+
pathSpec(["datasets"], "datasets", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "datasets" }),
|
|
1766
1835
|
pathSpec(["datasets", "create"], "datasets", [], [paramsJsonFlag()]),
|
|
1767
1836
|
pathSpec(["datasets", "update"], "datasets", [], [paramsJsonFlag()]),
|
|
1768
1837
|
pathSpec(["datasets", "rows"], "datasets", [], [paramsJsonFlag()]),
|
|
@@ -1830,7 +1899,7 @@ function distributionPathSpecs() {
|
|
|
1830
1899
|
paramsJsonFlag()
|
|
1831
1900
|
];
|
|
1832
1901
|
return [
|
|
1833
|
-
pathSpec(["distribution"], "distribution", [optional("operation")], [paramsJsonFlag()], { dynamicFamily: "distribution" }),
|
|
1902
|
+
pathSpec(["distribution"], "distribution", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "distribution" }),
|
|
1834
1903
|
pathSpec(["distribution", "list"], "distribution", [], pageFlags, {
|
|
1835
1904
|
aliases: [["distribution", "ls"]]
|
|
1836
1905
|
}),
|
|
@@ -2499,21 +2568,12 @@ function tokenEnvSecretPathSpecs() {
|
|
|
2499
2568
|
}
|
|
2500
2569
|
function registryFamilyPathSpecs() {
|
|
2501
2570
|
return [
|
|
2502
|
-
pathSpec(["workspace"], "workspace", [optional("operation")], [paramsJsonFlag()], { dynamicFamily: "workspace" }),
|
|
2503
|
-
pathSpec(["sharing"], "sharing", [optional("operation")], [paramsJsonFlag()], {
|
|
2504
|
-
|
|
2505
|
-
}),
|
|
2506
|
-
pathSpec(["
|
|
2507
|
-
|
|
2508
|
-
}),
|
|
2509
|
-
pathSpec(["files"], "files", [optional("operation")], [paramsJsonFlag()], {
|
|
2510
|
-
aliases: [["file"]],
|
|
2511
|
-
dynamicFamily: "files"
|
|
2512
|
-
}),
|
|
2513
|
-
pathSpec(["home"], "home", [optional("operation")], [paramsJsonFlag()], {
|
|
2514
|
-
dynamicFamily: "home"
|
|
2515
|
-
}),
|
|
2516
|
-
pathSpec(["business-sql"], "business_sql", [optional("operation")], [paramsJsonFlag()], { aliases: [["business_sql"]], dynamicFamily: "business_sql" })
|
|
2571
|
+
pathSpec(["workspace"], "workspace", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "workspace" }),
|
|
2572
|
+
pathSpec(["sharing"], "sharing", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "sharing" }),
|
|
2573
|
+
pathSpec(["web"], "web", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "web" }),
|
|
2574
|
+
pathSpec(["files"], "files", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { aliases: [["file"]], dynamicFamily: "files" }),
|
|
2575
|
+
pathSpec(["home"], "home", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { dynamicFamily: "home" }),
|
|
2576
|
+
pathSpec(["business-sql"], "business_sql", [optional("operation")], [paramsJsonFlag(), booleanFlag("--get-schema")], { aliases: [["business_sql"]], dynamicFamily: "business_sql" })
|
|
2517
2577
|
];
|
|
2518
2578
|
}
|
|
2519
2579
|
var commandPathSpecsByPath = new Map;
|
|
@@ -2992,7 +3052,7 @@ function spec(id, summary, auth, workspace, safety, outputModes, cancellation =
|
|
|
2992
3052
|
// package.json
|
|
2993
3053
|
var package_default = {
|
|
2994
3054
|
name: "@uru-intelligence/cli",
|
|
2995
|
-
version: "0.5.
|
|
3055
|
+
version: "0.5.2",
|
|
2996
3056
|
private: false,
|
|
2997
3057
|
description: "Uru full-platform command line interface",
|
|
2998
3058
|
repository: {
|
|
@@ -3241,7 +3301,83 @@ function applyValueFlag(flags, flag, value) {
|
|
|
3241
3301
|
|
|
3242
3302
|
// src/auth-commands.ts
|
|
3243
3303
|
import { readFile } from "node:fs/promises";
|
|
3304
|
+
|
|
3305
|
+
// src/oauth-callback.ts
|
|
3244
3306
|
import { createServer } from "node:http";
|
|
3307
|
+
var OAUTH_CALLBACK_PATH = "/oauth/callback";
|
|
3308
|
+
async function listenForOAuthCallback(args) {
|
|
3309
|
+
args.signal.throwIfAborted();
|
|
3310
|
+
const server = createServer();
|
|
3311
|
+
const completion = Promise.withResolvers();
|
|
3312
|
+
completion.promise.catch(() => {
|
|
3313
|
+
return;
|
|
3314
|
+
});
|
|
3315
|
+
let settled = false;
|
|
3316
|
+
const close = () => {
|
|
3317
|
+
clearTimeout(timeout);
|
|
3318
|
+
args.signal.removeEventListener("abort", cancel);
|
|
3319
|
+
server.close();
|
|
3320
|
+
server.closeAllConnections();
|
|
3321
|
+
};
|
|
3322
|
+
const fail = (error) => {
|
|
3323
|
+
if (settled)
|
|
3324
|
+
return;
|
|
3325
|
+
settled = true;
|
|
3326
|
+
close();
|
|
3327
|
+
completion.reject(error);
|
|
3328
|
+
};
|
|
3329
|
+
const cancel = () => fail(new CliError("Cancelled.", { code: ExitCode.Cancelled }));
|
|
3330
|
+
const timeout = setTimeout(() => fail(new CliError("OAuth login timed out waiting for browser callback.", { code: ExitCode.AuthRequired, errorCode: "oauth_callback_timeout" })), 5 * 60 * 1000);
|
|
3331
|
+
args.signal.addEventListener("abort", cancel, { once: true });
|
|
3332
|
+
server.on("request", (request, response) => {
|
|
3333
|
+
const url = new URL(request.url ?? "/", `http://${args.host}`);
|
|
3334
|
+
response.setHeader("Cache-Control", "no-store");
|
|
3335
|
+
if (request.method !== "GET" || url.pathname !== OAUTH_CALLBACK_PATH) {
|
|
3336
|
+
response.writeHead(404).end("Not found");
|
|
3337
|
+
return;
|
|
3338
|
+
}
|
|
3339
|
+
if (url.searchParams.get("state") !== args.state || !url.searchParams.has("code") && !url.searchParams.has("error")) {
|
|
3340
|
+
response.writeHead(400).end("Invalid sign-in response. Return to the sign-in window.");
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
response.setHeader("content-type", "text/html; charset=utf-8");
|
|
3344
|
+
response.end('<!doctype html><meta charset="utf-8"><title>Uru CLI sign-in</title><h1>Sign-in response received</h1><p>Return to your terminal to check whether sign-in completed. You can close this window.</p>');
|
|
3345
|
+
if (!settled) {
|
|
3346
|
+
settled = true;
|
|
3347
|
+
clearTimeout(timeout);
|
|
3348
|
+
args.signal.removeEventListener("abort", cancel);
|
|
3349
|
+
server.close();
|
|
3350
|
+
completion.resolve(url.toString());
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
server.on("error", (cause) => fail(new CliError("Could not start OAuth callback server.", {
|
|
3354
|
+
code: ExitCode.AuthRequired,
|
|
3355
|
+
errorCode: "oauth_callback_server_failed",
|
|
3356
|
+
cause
|
|
3357
|
+
})));
|
|
3358
|
+
try {
|
|
3359
|
+
await new Promise((resolve, reject) => {
|
|
3360
|
+
server.once("error", reject);
|
|
3361
|
+
server.listen(args.port, args.host, resolve);
|
|
3362
|
+
});
|
|
3363
|
+
args.signal.throwIfAborted();
|
|
3364
|
+
const address = server.address();
|
|
3365
|
+
if (address === null || typeof address === "string") {
|
|
3366
|
+
throw new CliError("Could not determine OAuth callback port.");
|
|
3367
|
+
}
|
|
3368
|
+
return { port: address.port, result: completion.promise, close };
|
|
3369
|
+
} catch (cause) {
|
|
3370
|
+
close();
|
|
3371
|
+
if (args.signal.aborted) {
|
|
3372
|
+
throw new CliError("Cancelled.", { code: ExitCode.Cancelled });
|
|
3373
|
+
}
|
|
3374
|
+
throw new CliError("Could not start OAuth callback server.", {
|
|
3375
|
+
code: ExitCode.AuthRequired,
|
|
3376
|
+
errorCode: "oauth_callback_server_failed",
|
|
3377
|
+
cause
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3245
3381
|
|
|
3246
3382
|
// ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
3247
3383
|
var _a;
|
|
@@ -9564,6 +9700,15 @@ var zArtifactBuildDiagnostic = object({
|
|
|
9564
9700
|
rawDiagnosticId: string2().nullish(),
|
|
9565
9701
|
relatedLocations: array(zArtifactBuildDiagnosticLocation).optional().default([])
|
|
9566
9702
|
});
|
|
9703
|
+
var zArtifactBuildJob = object({
|
|
9704
|
+
attempts: int().optional().default(0),
|
|
9705
|
+
createdAt: string2().nullish(),
|
|
9706
|
+
id: string2(),
|
|
9707
|
+
lastError: string2().nullish(),
|
|
9708
|
+
leaseExpiresAt: string2().nullish(),
|
|
9709
|
+
status: string2(),
|
|
9710
|
+
updatedAt: string2().nullish()
|
|
9711
|
+
}).nullable();
|
|
9567
9712
|
var zArtifactBuildRequest = object({
|
|
9568
9713
|
content: string2().nullish(),
|
|
9569
9714
|
currentSourceRevisionId: string2().nullish(),
|
|
@@ -9650,7 +9795,7 @@ var zArtifactProjectFileUpdateRequest = object({
|
|
|
9650
9795
|
content: string2().nullish(),
|
|
9651
9796
|
contentBase64: string2().nullish(),
|
|
9652
9797
|
createIfMissing: boolean2().optional().default(false),
|
|
9653
|
-
path: string2().min(1).max(
|
|
9798
|
+
path: string2().min(1).max(240)
|
|
9654
9799
|
});
|
|
9655
9800
|
var zArtifactRenderEventRequest = object({
|
|
9656
9801
|
dependencyNames: array(string2()).nullish(),
|
|
@@ -9774,6 +9919,7 @@ var zArtifactBuildDescriptor = object({
|
|
|
9774
9919
|
assets: record(string2(), zArtifactFileDescriptor).optional(),
|
|
9775
9920
|
buildDiagnostics: array(zArtifactBuildDiagnostic).optional().default([]),
|
|
9776
9921
|
buildErrors: array(string2()).optional().default([]),
|
|
9922
|
+
buildJob: zArtifactBuildJob.optional(),
|
|
9777
9923
|
buildPipelineVersion: string2().nullish(),
|
|
9778
9924
|
buildStatus: string2().nullish(),
|
|
9779
9925
|
bundleStatus: string2().nullish(),
|
|
@@ -10314,6 +10460,9 @@ var zClientIdMetadataDocument = object({
|
|
|
10314
10460
|
scope: string2().min(1),
|
|
10315
10461
|
token_endpoint_auth_method: _enum(["none"])
|
|
10316
10462
|
});
|
|
10463
|
+
var zCloneArtifactRequest = object({
|
|
10464
|
+
sourceRevisionId: uuid2().optional()
|
|
10465
|
+
});
|
|
10317
10466
|
var zCollectionGateAccessResponse = object({
|
|
10318
10467
|
accessToken: string2(),
|
|
10319
10468
|
expiresAt: string2(),
|
|
@@ -10844,6 +10993,13 @@ var zDebugEntityResponse = object({
|
|
|
10844
10993
|
entityId: string2(),
|
|
10845
10994
|
userId: string2()
|
|
10846
10995
|
});
|
|
10996
|
+
var zDeleteGemVersionResponse = strictObject({
|
|
10997
|
+
deleted: literal(true),
|
|
10998
|
+
linksChanged: literal(false),
|
|
10999
|
+
sourceRevisionId: string2(),
|
|
11000
|
+
versionId: string2(),
|
|
11001
|
+
versionNumber: int()
|
|
11002
|
+
});
|
|
10847
11003
|
var zDeleteNotificationsRequest = object({
|
|
10848
11004
|
notificationIds: array(uuid2())
|
|
10849
11005
|
});
|
|
@@ -14474,17 +14630,17 @@ var zThreadFileView = object({
|
|
|
14474
14630
|
"quarantined",
|
|
14475
14631
|
"failed"
|
|
14476
14632
|
]),
|
|
14477
|
-
bytes: int().
|
|
14633
|
+
bytes: int().nullable(),
|
|
14478
14634
|
createdAtMs: int(),
|
|
14479
14635
|
fileId: uuid2(),
|
|
14480
14636
|
filename: string2(),
|
|
14481
14637
|
folder: _enum(["uploads", "outputs"]),
|
|
14482
14638
|
kind: _enum(["file", "image", "audio", "video"]),
|
|
14483
|
-
mime: string2().
|
|
14639
|
+
mime: string2().nullable(),
|
|
14484
14640
|
modelAccess: _enum(["direct", "sandbox_only"]),
|
|
14485
14641
|
previewUrl: string2().nullable(),
|
|
14486
14642
|
threadId: uuid2(),
|
|
14487
|
-
url: string2().
|
|
14643
|
+
url: string2().nullable()
|
|
14488
14644
|
});
|
|
14489
14645
|
var zThreadFileListResponse = object({
|
|
14490
14646
|
files: array(zThreadFileView),
|
|
@@ -14844,10 +15000,7 @@ var zThreadShareLink = object({
|
|
|
14844
15000
|
snapshotLeafMessageId: string2().nullable(),
|
|
14845
15001
|
threadId: string2()
|
|
14846
15002
|
});
|
|
14847
|
-
var
|
|
14848
|
-
links: array(zThreadShareLink)
|
|
14849
|
-
});
|
|
14850
|
-
var zThreadShareMintResponse = object({
|
|
15003
|
+
var zThreadShareEnsureResponse = object({
|
|
14851
15004
|
link: zThreadShareLink,
|
|
14852
15005
|
token: string2(),
|
|
14853
15006
|
url: string2().nullable()
|
|
@@ -15193,6 +15346,8 @@ var zThreadMessagesListResponse = object({
|
|
|
15193
15346
|
siblings: record(string2(), array(string2()))
|
|
15194
15347
|
});
|
|
15195
15348
|
var zThreadShareSnapshot = object({
|
|
15349
|
+
files: array(zThreadFileView),
|
|
15350
|
+
generatedAt: string2(),
|
|
15196
15351
|
messages: array(zThreadExportMessage),
|
|
15197
15352
|
schema: _enum(["uru.thread-share"]),
|
|
15198
15353
|
sharedAt: string2(),
|
|
@@ -16234,7 +16389,9 @@ var zGetUserDetailApiAdminUsageUsersUserIdGetResponse = record(string2(), unknow
|
|
|
16234
16389
|
var zAdminListUsersApiAdminUsersGetQuery = object({
|
|
16235
16390
|
limit: int().gte(1).lte(100).optional().default(50),
|
|
16236
16391
|
offset: int().gte(0).nullish().default(0),
|
|
16237
|
-
search: string2().max(200).optional()
|
|
16392
|
+
search: string2().max(200).optional(),
|
|
16393
|
+
status: _enum(["active", "deactivated"]).optional(),
|
|
16394
|
+
workspaces: _enum(["one", "many"]).optional()
|
|
16238
16395
|
});
|
|
16239
16396
|
var zAdminGetUserApiAdminUsersUserIdGetPath = object({
|
|
16240
16397
|
userId: string2()
|
|
@@ -17448,6 +17605,7 @@ var zAuthorizeRequestApiOauthAuthorizeRequestGetQuery = object({
|
|
|
17448
17605
|
var zAuthorizeRequestApiOauthAuthorizeRequestGetResponse = object({
|
|
17449
17606
|
client_id: string2(),
|
|
17450
17607
|
client_name: string2(),
|
|
17608
|
+
redirectUri: url(),
|
|
17451
17609
|
resource: url(),
|
|
17452
17610
|
scope: string2(),
|
|
17453
17611
|
workspace_id: string2().nullable(),
|
|
@@ -17797,7 +17955,7 @@ var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesCo
|
|
|
17797
17955
|
artifactSlug: string2()
|
|
17798
17956
|
});
|
|
17799
17957
|
var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesContentGetQuery = object({
|
|
17800
|
-
path: string2().min(1).max(
|
|
17958
|
+
path: string2().min(1).max(240)
|
|
17801
17959
|
});
|
|
17802
17960
|
var zGetArtifactProjectFileContentApiPlatformArtifactsArtifactSlugProjectFilesContentGetResponse = object({
|
|
17803
17961
|
artifactId: string2(),
|
|
@@ -19408,6 +19566,10 @@ var zDiffGemVersionsQuery = object({
|
|
|
19408
19566
|
fromVersion: string2().min(1),
|
|
19409
19567
|
toVersion: string2().min(1)
|
|
19410
19568
|
});
|
|
19569
|
+
var zDeleteGemVersionPath = object({
|
|
19570
|
+
gemRef: string2().min(1),
|
|
19571
|
+
resourceId: string2().min(1)
|
|
19572
|
+
});
|
|
19411
19573
|
var zGetGemVersionPath = object({
|
|
19412
19574
|
gemRef: string2().min(1),
|
|
19413
19575
|
resourceId: string2().min(1)
|
|
@@ -20217,6 +20379,14 @@ var zCspViolationReportApiSecurityCspViolationReportPostBody = string2().default
|
|
|
20217
20379
|
var zThreadShareReadPath = object({
|
|
20218
20380
|
shareId: string2().min(1).max(128)
|
|
20219
20381
|
});
|
|
20382
|
+
var zThreadShareFileContentHeaders = object({
|
|
20383
|
+
Range: string2().optional()
|
|
20384
|
+
});
|
|
20385
|
+
var zThreadShareFileContentPath = object({
|
|
20386
|
+
shareId: string2().min(1).max(128),
|
|
20387
|
+
fileId: string2().min(1).max(200)
|
|
20388
|
+
});
|
|
20389
|
+
var zThreadShareFileContentResponse = string2();
|
|
20220
20390
|
var zBackfillSharedContentMetadataApiSharingBackfillMetadataPostResponse = record(string2(), string2());
|
|
20221
20391
|
var zDeleteNotificationsApiSharingNotificationsDeleteResponse = record(string2(), unknown());
|
|
20222
20392
|
var zGetNotificationsApiSharingNotificationsGetQuery = object({
|
|
@@ -20487,10 +20657,7 @@ var zThreadSandboxListPath = object({
|
|
|
20487
20657
|
var zThreadSandboxListQuery = object({
|
|
20488
20658
|
path: string2().max(512).optional()
|
|
20489
20659
|
});
|
|
20490
|
-
var
|
|
20491
|
-
threadId: uuid2()
|
|
20492
|
-
});
|
|
20493
|
-
var zThreadShareMintPath = object({
|
|
20660
|
+
var zThreadShareEnsurePath = object({
|
|
20494
20661
|
threadId: uuid2()
|
|
20495
20662
|
});
|
|
20496
20663
|
var zThreadShareRevokePath = object({
|
|
@@ -21477,6 +21644,7 @@ function normalizeTool(value) {
|
|
|
21477
21644
|
|
|
21478
21645
|
// src/oauth.ts
|
|
21479
21646
|
import { createHash, randomBytes } from "node:crypto";
|
|
21647
|
+
import { setTimeout as sleepTimer } from "node:timers/promises";
|
|
21480
21648
|
var DEFAULT_PKCE_VERIFIER_BYTES = 32;
|
|
21481
21649
|
var DEFAULT_STATE_BYTES = 24;
|
|
21482
21650
|
var OAUTH_DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -21524,7 +21692,7 @@ function buildAuthorizationUrl(args) {
|
|
|
21524
21692
|
}
|
|
21525
21693
|
return url2.toString();
|
|
21526
21694
|
}
|
|
21527
|
-
function parseOAuthCallbackUrl(callbackUrl, expectedState) {
|
|
21695
|
+
function parseOAuthCallbackUrl(callbackUrl, expectedState, expectedIssuer, issuerRequired = false) {
|
|
21528
21696
|
const url2 = new URL(callbackUrl);
|
|
21529
21697
|
const state = url2.searchParams.get("state") ?? "";
|
|
21530
21698
|
if (state === "" || state !== expectedState) {
|
|
@@ -21533,6 +21701,13 @@ function parseOAuthCallbackUrl(callbackUrl, expectedState) {
|
|
|
21533
21701
|
errorCode: "oauth_state_mismatch"
|
|
21534
21702
|
});
|
|
21535
21703
|
}
|
|
21704
|
+
const issuers = url2.searchParams.getAll("iss");
|
|
21705
|
+
if (issuerRequired && issuers.length === 0 || issuers.length > 1 || issuers.length === 1 && issuers[0] !== expectedIssuer) {
|
|
21706
|
+
throw new CliError("OAuth callback issuer did not match the sign-in server.", {
|
|
21707
|
+
code: ExitCode.AuthRequired,
|
|
21708
|
+
errorCode: "oauth_issuer_mismatch"
|
|
21709
|
+
});
|
|
21710
|
+
}
|
|
21536
21711
|
const error2 = url2.searchParams.get("error");
|
|
21537
21712
|
if (error2 !== null && error2 !== "") {
|
|
21538
21713
|
throw new CliError("OAuth authorization failed. Start sign-in again and approve access.", { code: ExitCode.AuthRequired, errorCode: "oauth_authorization_failed" });
|
|
@@ -21569,6 +21744,24 @@ async function resolveOAuthClientMetadata(args) {
|
|
|
21569
21744
|
scope: optionalStringField(response, "scope") ?? "mcp offline_access"
|
|
21570
21745
|
};
|
|
21571
21746
|
}
|
|
21747
|
+
async function discoverOAuthIssuer(args) {
|
|
21748
|
+
const expectedIssuer = normalizeApiUrl(args.apiUrl);
|
|
21749
|
+
const metadata = await fetchOAuthGet({
|
|
21750
|
+
apiUrl: args.apiUrl,
|
|
21751
|
+
path: "/.well-known/oauth-authorization-server",
|
|
21752
|
+
...args.fetch === undefined ? {} : { fetch: args.fetch }
|
|
21753
|
+
});
|
|
21754
|
+
if (!isRecord(metadata) || metadata["issuer"] !== expectedIssuer) {
|
|
21755
|
+
throw new CliError("OAuth discovery issuer did not match the sign-in server.", {
|
|
21756
|
+
code: ExitCode.AuthRequired,
|
|
21757
|
+
errorCode: "oauth_issuer_mismatch"
|
|
21758
|
+
});
|
|
21759
|
+
}
|
|
21760
|
+
return {
|
|
21761
|
+
issuer: expectedIssuer,
|
|
21762
|
+
issuerRequired: metadata["authorization_response_iss_parameter_supported"] === true
|
|
21763
|
+
};
|
|
21764
|
+
}
|
|
21572
21765
|
async function discoverOAuthResource(args) {
|
|
21573
21766
|
const response = await fetchOAuthGet({
|
|
21574
21767
|
apiUrl: args.apiUrl,
|
|
@@ -21658,8 +21851,9 @@ async function startDeviceAuthorization(args) {
|
|
|
21658
21851
|
}
|
|
21659
21852
|
async function pollDeviceToken(args) {
|
|
21660
21853
|
let intervalSeconds = Math.max(1, args.intervalSeconds);
|
|
21661
|
-
const sleep = args.sleep ??
|
|
21854
|
+
const sleep = args.sleep ?? ((milliseconds) => sleepTimer(milliseconds, undefined, { signal: args.signal }));
|
|
21662
21855
|
for (let attempt = 0;attempt < args.maxPolls; attempt += 1) {
|
|
21856
|
+
args.signal?.throwIfAborted();
|
|
21663
21857
|
if (attempt > 0) {
|
|
21664
21858
|
await sleep(intervalSeconds * 1000);
|
|
21665
21859
|
}
|
|
@@ -21688,6 +21882,7 @@ async function pollDeviceToken(args) {
|
|
|
21688
21882
|
errorCode: "oauth_device_failed"
|
|
21689
21883
|
});
|
|
21690
21884
|
}
|
|
21885
|
+
args.signal?.throwIfAborted();
|
|
21691
21886
|
return toOAuthTokenResponse(zOAuthTokenResponse.parse(response));
|
|
21692
21887
|
}
|
|
21693
21888
|
throw new CliError("OAuth device login timed out before authorization completed.", {
|
|
@@ -21699,6 +21894,7 @@ async function fetchOAuthJson(args) {
|
|
|
21699
21894
|
const fetchImpl = args.fetch ?? fetch;
|
|
21700
21895
|
const response = await fetchImpl(oauthEndpoint(args.apiUrl, args.path), {
|
|
21701
21896
|
method: "POST",
|
|
21897
|
+
signal: AbortSignal.timeout(30000),
|
|
21702
21898
|
headers: {
|
|
21703
21899
|
Accept: "application/json",
|
|
21704
21900
|
"Content-Type": "application/json",
|
|
@@ -21719,6 +21915,7 @@ async function fetchOAuthGet(args) {
|
|
|
21719
21915
|
const fetchImpl = args.fetch ?? fetch;
|
|
21720
21916
|
const response = await fetchImpl(oauthEndpoint(args.apiUrl, args.path), {
|
|
21721
21917
|
method: "GET",
|
|
21918
|
+
signal: AbortSignal.timeout(30000),
|
|
21722
21919
|
headers: { Accept: "application/json" }
|
|
21723
21920
|
});
|
|
21724
21921
|
const payload = parseJsonResponse(await response.text());
|
|
@@ -21737,6 +21934,7 @@ async function fetchOAuthForm(args) {
|
|
|
21737
21934
|
const fetchImpl = args.fetch ?? fetch;
|
|
21738
21935
|
const response = await fetchImpl(oauthEndpoint(args.apiUrl, args.path), {
|
|
21739
21936
|
method: "POST",
|
|
21937
|
+
signal: AbortSignal.timeout(30000),
|
|
21740
21938
|
headers: {
|
|
21741
21939
|
Accept: "application/json",
|
|
21742
21940
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -21884,9 +22082,6 @@ function errorMessage2(payload) {
|
|
|
21884
22082
|
return;
|
|
21885
22083
|
}
|
|
21886
22084
|
}
|
|
21887
|
-
function defaultSleep(milliseconds) {
|
|
21888
|
-
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
21889
|
-
}
|
|
21890
22085
|
|
|
21891
22086
|
// src/visual.ts
|
|
21892
22087
|
var PLAIN_VISUAL = { rich: false, width: 80 };
|
|
@@ -22118,7 +22313,7 @@ function formatWorkspaces(workspaces, style = PLAIN_VISUAL, currentWorkspaceId)
|
|
|
22118
22313
|
currentId !== undefined && workspace.id === currentId ? "current" : ""
|
|
22119
22314
|
]));
|
|
22120
22315
|
}
|
|
22121
|
-
function formatOperationContract(contract) {
|
|
22316
|
+
function formatOperationContract(contract, options = {}) {
|
|
22122
22317
|
const id = typeof contract["id"] === "string" ? contract["id"] : "unknown";
|
|
22123
22318
|
const family = typeof contract["family"] === "string" ? contract["family"] : "unknown";
|
|
22124
22319
|
const summary = typeof contract["summary"] === "string" ? contract["summary"] : "";
|
|
@@ -22135,8 +22330,19 @@ function formatOperationContract(contract) {
|
|
|
22135
22330
|
if (safety !== "") {
|
|
22136
22331
|
lines.push(`Safety: ${safety}`);
|
|
22137
22332
|
}
|
|
22138
|
-
|
|
22139
|
-
|
|
22333
|
+
const inputSchema = contract["inputSchema"];
|
|
22334
|
+
if (inputSchema !== undefined) {
|
|
22335
|
+
lines.push("Input schema:");
|
|
22336
|
+
lines.push(JSON.stringify(inputSchema, null, 2));
|
|
22337
|
+
} else {
|
|
22338
|
+
const pointer = options.inputSchemaNote ?? (backend === "" ? "not loaded" : `not loaded — run \`uru tools schema ${backend}\``);
|
|
22339
|
+
lines.push(`Input schema: ${pointer}`);
|
|
22340
|
+
}
|
|
22341
|
+
const examples = contract["examples"];
|
|
22342
|
+
if (Array.isArray(examples) && examples.length > 0) {
|
|
22343
|
+
lines.push("Examples:");
|
|
22344
|
+
lines.push(JSON.stringify(examples, null, 2));
|
|
22345
|
+
}
|
|
22140
22346
|
return lines.join(`
|
|
22141
22347
|
`);
|
|
22142
22348
|
}
|
|
@@ -22754,8 +22960,6 @@ function objectPayload(value) {
|
|
|
22754
22960
|
}
|
|
22755
22961
|
|
|
22756
22962
|
// src/auth-commands.ts
|
|
22757
|
-
var OAUTH_CALLBACK_PATH = "/oauth/callback";
|
|
22758
|
-
var OAUTH_CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
22759
22963
|
var DEVICE_MAX_POLLS = 120;
|
|
22760
22964
|
var CIMD_CALLBACK_PORT = 8765;
|
|
22761
22965
|
async function resolveStoredToken(options) {
|
|
@@ -22934,7 +23138,7 @@ async function validateSessionToken(ctx, token) {
|
|
|
22934
23138
|
apiUrl: ctx.apiUrl,
|
|
22935
23139
|
token,
|
|
22936
23140
|
...workspaceId === undefined ? {} : { workspaceId },
|
|
22937
|
-
|
|
23141
|
+
fetch: loginFetch(ctx)
|
|
22938
23142
|
});
|
|
22939
23143
|
return loginClient.validateToken();
|
|
22940
23144
|
}
|
|
@@ -22969,7 +23173,7 @@ function canCompleteBrowserLogin(ctx) {
|
|
|
22969
23173
|
async function loginWithDeviceCode(ctx) {
|
|
22970
23174
|
const resource = await discoverOAuthResource({
|
|
22971
23175
|
apiUrl: ctx.apiUrl,
|
|
22972
|
-
|
|
23176
|
+
fetch: loginFetch(ctx)
|
|
22973
23177
|
});
|
|
22974
23178
|
const clientMetadata = await resolveOAuthClientMetadata({
|
|
22975
23179
|
apiUrl: ctx.apiUrl,
|
|
@@ -22978,14 +23182,14 @@ async function loginWithDeviceCode(ctx) {
|
|
|
22978
23182
|
port: CIMD_CALLBACK_PORT,
|
|
22979
23183
|
path: OAUTH_CALLBACK_PATH
|
|
22980
23184
|
}),
|
|
22981
|
-
|
|
23185
|
+
fetch: loginFetch(ctx)
|
|
22982
23186
|
});
|
|
22983
23187
|
const authorization = await startDeviceAuthorization({
|
|
22984
23188
|
apiUrl: ctx.apiUrl,
|
|
22985
23189
|
clientId: clientMetadata.clientId,
|
|
22986
23190
|
scope: clientMetadata.scope,
|
|
22987
23191
|
resource,
|
|
22988
|
-
|
|
23192
|
+
fetch: loginFetch(ctx)
|
|
22989
23193
|
});
|
|
22990
23194
|
const complete = authorization.verificationUriComplete ?? authorization.verificationUri;
|
|
22991
23195
|
await maybeCopyLoginUrl(ctx, complete);
|
|
@@ -22998,8 +23202,9 @@ async function loginWithDeviceCode(ctx) {
|
|
|
22998
23202
|
clientId: clientMetadata.clientId,
|
|
22999
23203
|
deviceCode: authorization.deviceCode,
|
|
23000
23204
|
intervalSeconds: authorization.interval,
|
|
23205
|
+
signal: ctx.abortSignal,
|
|
23001
23206
|
maxPolls: Math.min(DEVICE_MAX_POLLS, Math.ceil(authorization.expiresIn / Math.max(1, authorization.interval))),
|
|
23002
|
-
|
|
23207
|
+
fetch: loginFetch(ctx)
|
|
23003
23208
|
});
|
|
23004
23209
|
return exchangeOAuthTokenForSession(ctx, token, clientMetadata.clientId, resource);
|
|
23005
23210
|
}
|
|
@@ -23008,14 +23213,17 @@ async function loginWithBrowser(ctx) {
|
|
|
23008
23213
|
if (ctx.callbackPort !== undefined && ctx.callbackPort !== CIMD_CALLBACK_PORT) {
|
|
23009
23214
|
throw new CliError(`Uru CLI requires callback port ${CIMD_CALLBACK_PORT} for OAuth Client ID Metadata.`);
|
|
23010
23215
|
}
|
|
23011
|
-
const
|
|
23216
|
+
const state = generateOAuthState();
|
|
23217
|
+
const callback = await listenForOAuthCallback({
|
|
23012
23218
|
host: callbackHost,
|
|
23013
|
-
port: CIMD_CALLBACK_PORT
|
|
23219
|
+
port: CIMD_CALLBACK_PORT,
|
|
23220
|
+
state,
|
|
23221
|
+
signal: ctx.abortSignal
|
|
23014
23222
|
});
|
|
23015
23223
|
try {
|
|
23016
23224
|
const resource = await discoverOAuthResource({
|
|
23017
23225
|
apiUrl: ctx.apiUrl,
|
|
23018
|
-
|
|
23226
|
+
fetch: loginFetch(ctx)
|
|
23019
23227
|
});
|
|
23020
23228
|
const redirectUri = buildLoopbackRedirectUri({
|
|
23021
23229
|
host: callbackHost,
|
|
@@ -23025,10 +23233,10 @@ async function loginWithBrowser(ctx) {
|
|
|
23025
23233
|
const clientMetadata = await resolveOAuthClientMetadata({
|
|
23026
23234
|
apiUrl: ctx.apiUrl,
|
|
23027
23235
|
redirectUri,
|
|
23028
|
-
|
|
23236
|
+
fetch: loginFetch(ctx)
|
|
23029
23237
|
});
|
|
23238
|
+
const issuer = await discoverOAuthIssuer({ apiUrl: ctx.apiUrl, fetch: loginFetch(ctx) });
|
|
23030
23239
|
const pkce = generatePkcePair();
|
|
23031
|
-
const state = generateOAuthState();
|
|
23032
23240
|
const authorizationUrl = buildAuthorizationUrl({
|
|
23033
23241
|
authorizationEndpoint: `${normalizeApiUrl(ctx.apiUrl)}/oauth/authorize`,
|
|
23034
23242
|
clientId: clientMetadata.clientId,
|
|
@@ -23048,7 +23256,7 @@ async function loginWithBrowser(ctx) {
|
|
|
23048
23256
|
`);
|
|
23049
23257
|
}
|
|
23050
23258
|
const callbackUrl = await callback.result;
|
|
23051
|
-
const authorization = parseOAuthCallbackUrl(callbackUrl, state);
|
|
23259
|
+
const authorization = parseOAuthCallbackUrl(callbackUrl, state, issuer.issuer, issuer.issuerRequired);
|
|
23052
23260
|
const token = await exchangeAuthorizationCode({
|
|
23053
23261
|
apiUrl: ctx.apiUrl,
|
|
23054
23262
|
clientId: clientMetadata.clientId,
|
|
@@ -23056,7 +23264,7 @@ async function loginWithBrowser(ctx) {
|
|
|
23056
23264
|
redirectUri,
|
|
23057
23265
|
codeVerifier: pkce.verifier,
|
|
23058
23266
|
resource,
|
|
23059
|
-
|
|
23267
|
+
fetch: loginFetch(ctx)
|
|
23060
23268
|
});
|
|
23061
23269
|
return exchangeOAuthTokenForSession(ctx, token, clientMetadata.clientId, resource);
|
|
23062
23270
|
} finally {
|
|
@@ -23069,7 +23277,7 @@ async function exchangeOAuthTokenForSession(ctx, token, clientId, resource) {
|
|
|
23069
23277
|
apiUrl: ctx.apiUrl,
|
|
23070
23278
|
oauthAccessToken: token.accessToken,
|
|
23071
23279
|
...ctx.workspace !== undefined ? { workspaceId: ctx.workspace } : {},
|
|
23072
|
-
|
|
23280
|
+
fetch: loginFetch(ctx)
|
|
23073
23281
|
});
|
|
23074
23282
|
if (session.oauthResource !== resource) {
|
|
23075
23283
|
throw new CliError("CLI session OAuth resource did not match discovery.", {
|
|
@@ -23158,61 +23366,14 @@ async function maybeCopyLoginUrl(ctx, url2) {
|
|
|
23158
23366
|
ctx.io.stderr.write(`Copied login URL to clipboard.
|
|
23159
23367
|
`);
|
|
23160
23368
|
}
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
|
|
23167
|
-
|
|
23168
|
-
errorCode: "oauth_callback_timeout"
|
|
23169
|
-
}));
|
|
23170
|
-
}, OAUTH_CALLBACK_TIMEOUT_MS);
|
|
23171
|
-
server.on("request", (request, response) => {
|
|
23172
|
-
handleOAuthCallbackRequest(request, response, {
|
|
23173
|
-
host: args.host,
|
|
23174
|
-
onComplete: (callbackUrl) => {
|
|
23175
|
-
clearTimeout(timeout);
|
|
23176
|
-
server.close();
|
|
23177
|
-
resolve(callbackUrl);
|
|
23178
|
-
}
|
|
23179
|
-
});
|
|
23180
|
-
});
|
|
23181
|
-
server.on("error", (error2) => {
|
|
23182
|
-
clearTimeout(timeout);
|
|
23183
|
-
reject(new CliError("Could not start OAuth callback server.", {
|
|
23184
|
-
code: ExitCode.AuthRequired,
|
|
23185
|
-
errorCode: "oauth_callback_server_failed",
|
|
23186
|
-
cause: error2
|
|
23187
|
-
}));
|
|
23188
|
-
});
|
|
23189
|
-
});
|
|
23190
|
-
await new Promise((resolve, reject) => {
|
|
23191
|
-
server.listen(args.port ?? 0, args.host, resolve);
|
|
23192
|
-
server.once("error", reject);
|
|
23369
|
+
function loginFetch(ctx) {
|
|
23370
|
+
return (input, init) => (ctx.fetch ?? fetch)(input, {
|
|
23371
|
+
...init,
|
|
23372
|
+
signal: AbortSignal.any([
|
|
23373
|
+
ctx.abortSignal,
|
|
23374
|
+
init?.signal ?? AbortSignal.timeout(30000)
|
|
23375
|
+
])
|
|
23193
23376
|
});
|
|
23194
|
-
const address = server.address();
|
|
23195
|
-
if (address === null || typeof address === "string") {
|
|
23196
|
-
server.close();
|
|
23197
|
-
throw new CliError("Could not determine OAuth callback port.", {
|
|
23198
|
-
code: ExitCode.AuthRequired,
|
|
23199
|
-
errorCode: "oauth_callback_server_failed"
|
|
23200
|
-
});
|
|
23201
|
-
}
|
|
23202
|
-
return { port: address.port, result, close: () => server.close() };
|
|
23203
|
-
}
|
|
23204
|
-
function handleOAuthCallbackRequest(request, response, args) {
|
|
23205
|
-
const requestUrl = request.url ?? "/";
|
|
23206
|
-
const parsed = new URL(requestUrl, `http://${args.host}`);
|
|
23207
|
-
if (parsed.pathname !== OAUTH_CALLBACK_PATH) {
|
|
23208
|
-
response.statusCode = 404;
|
|
23209
|
-
response.end("Not found");
|
|
23210
|
-
return;
|
|
23211
|
-
}
|
|
23212
|
-
response.statusCode = 200;
|
|
23213
|
-
response.setHeader("content-type", "text/html; charset=utf-8");
|
|
23214
|
-
response.end('<!doctype html><meta charset="utf-8"><title>Uru CLI login</title><body><h1>Uru CLI login complete</h1><p>You can close this window and return to your terminal.</p></body>');
|
|
23215
|
-
args.onComplete(`http://${args.host}${requestUrl}`);
|
|
23216
23377
|
}
|
|
23217
23378
|
|
|
23218
23379
|
// src/cli-helpers.ts
|
|
@@ -24439,6 +24600,47 @@ function operationForJson(operation) {
|
|
|
24439
24600
|
}
|
|
24440
24601
|
};
|
|
24441
24602
|
}
|
|
24603
|
+
async function operationContractForInspect(ctx, operation) {
|
|
24604
|
+
const baseContract = operationForJson(operation);
|
|
24605
|
+
if (getCliNativeOperationContract(operation.id) !== undefined) {
|
|
24606
|
+
return { contract: baseContract, text: formatOperationContract(baseContract) };
|
|
24607
|
+
}
|
|
24608
|
+
if (ctx.token === undefined || ctx.token.trim() === "") {
|
|
24609
|
+
return {
|
|
24610
|
+
contract: baseContract,
|
|
24611
|
+
text: formatOperationContract(baseContract, {
|
|
24612
|
+
inputSchemaNote: `not loaded (not logged in) — run \`uru login\`, or \`uru tools schema ${operation.backendToolName}\``
|
|
24613
|
+
})
|
|
24614
|
+
};
|
|
24615
|
+
}
|
|
24616
|
+
try {
|
|
24617
|
+
await withWorkspace(ctx);
|
|
24618
|
+
} catch {
|
|
24619
|
+
return { contract: baseContract, text: formatOperationContract(baseContract) };
|
|
24620
|
+
}
|
|
24621
|
+
const enrichedContract = await withLiveInputSchema(ctx, operation, baseContract);
|
|
24622
|
+
return { contract: enrichedContract, text: formatOperationContract(enrichedContract) };
|
|
24623
|
+
}
|
|
24624
|
+
async function withLiveInputSchema(ctx, operation, baseContract) {
|
|
24625
|
+
let rawSchema;
|
|
24626
|
+
try {
|
|
24627
|
+
rawSchema = await client(ctx).getToolSchema(operation.backendToolName);
|
|
24628
|
+
} catch {
|
|
24629
|
+
return baseContract;
|
|
24630
|
+
}
|
|
24631
|
+
if (!isJsonObject2(rawSchema)) {
|
|
24632
|
+
return baseContract;
|
|
24633
|
+
}
|
|
24634
|
+
const rawInputSchema = rawSchema["inputSchema"];
|
|
24635
|
+
const inputSchema = isJsonObject2(rawInputSchema) ? narrowToolInputSchemaToOperation(rawInputSchema, operation.backendOp) : undefined;
|
|
24636
|
+
const rawExamples = rawSchema["examples"];
|
|
24637
|
+
const examples = Array.isArray(rawExamples) ? rawExamples.filter((example) => operation.backendOp === undefined || isJsonObject2(example) && isJsonObject2(example["parameters"]) && example["parameters"]["op"] === operation.backendOp) : undefined;
|
|
24638
|
+
return {
|
|
24639
|
+
...baseContract,
|
|
24640
|
+
...inputSchema === undefined ? {} : { inputSchema },
|
|
24641
|
+
...examples !== undefined && examples.length > 0 ? { examples } : {}
|
|
24642
|
+
};
|
|
24643
|
+
}
|
|
24442
24644
|
async function dispatchOperations(ctx, sub, args) {
|
|
24443
24645
|
if (sub === "ls" || sub === "list") {
|
|
24444
24646
|
const flags = parseLocalFlags(args, ["operations", "ls"]);
|
|
@@ -24459,8 +24661,8 @@ async function dispatchOperations(ctx, sub, args) {
|
|
|
24459
24661
|
if (operation === undefined) {
|
|
24460
24662
|
throw new CliError(`Unknown operation: ${operationId}. Run \`uru operations ls\`.`);
|
|
24461
24663
|
}
|
|
24462
|
-
const contract =
|
|
24463
|
-
emitValue(ctx, contract,
|
|
24664
|
+
const { contract, text } = await operationContractForInspect(ctx, operation);
|
|
24665
|
+
emitValue(ctx, contract, text);
|
|
24464
24666
|
return;
|
|
24465
24667
|
}
|
|
24466
24668
|
if (sub === "run") {
|
|
@@ -24477,7 +24679,13 @@ async function dispatchRegistryFamily(ctx, family, sub, args) {
|
|
|
24477
24679
|
if (operation === undefined) {
|
|
24478
24680
|
throw new CliError(`Unknown ${family} operation: ${verb}. Run \`uru operations ls --family ${family}\`.`);
|
|
24479
24681
|
}
|
|
24480
|
-
|
|
24682
|
+
const commandPath = [family.replace("_", "-")];
|
|
24683
|
+
if (parseLocalFlags(args, commandPath).booleans.has("--get-schema")) {
|
|
24684
|
+
const { contract, text } = await operationContractForInspect(ctx, operation);
|
|
24685
|
+
emitValue(ctx, contract, text);
|
|
24686
|
+
return;
|
|
24687
|
+
}
|
|
24688
|
+
await emitTool(ctx, operation.id, adaptRegistryFamilyParams(await paramsJson(args, commandPath, paramsJsonOptions(ctx))));
|
|
24481
24689
|
}
|
|
24482
24690
|
function adaptRegistryFamilyParams(params) {
|
|
24483
24691
|
const adapted = {};
|
|
@@ -32027,6 +32235,10 @@ function throwIfCancelled(signal) {
|
|
|
32027
32235
|
throw new CliError("Cancelled.", { code: ExitCode.Cancelled, cause: reason });
|
|
32028
32236
|
}
|
|
32029
32237
|
async function dispatchWithImplicitLogin(ctx, command, linkedProject) {
|
|
32238
|
+
if (command[0] === "login") {
|
|
32239
|
+
await dispatchCliCommand(ctx, command, linkedProject);
|
|
32240
|
+
return;
|
|
32241
|
+
}
|
|
32030
32242
|
let activeCtx = ctx;
|
|
32031
32243
|
let recoveredFromSessionRevoked = false;
|
|
32032
32244
|
for (;; ) {
|