@zocomputer/cli 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/catalog-cache.d.ts +7 -0
- package/dist/catalog-cache.js +63 -0
- package/dist/catalog.d.ts +2 -0
- package/dist/catalog.js +57 -4
- package/dist/commands.d.ts +14 -0
- package/dist/commands.js +83 -15
- package/dist/generated/commands.js +25 -13
- package/dist/help.d.ts +7 -0
- package/dist/help.js +43 -0
- package/dist/output.d.ts +7 -9
- package/dist/output.js +28 -2
- package/dist/presentation.d.ts +5 -1
- package/dist/presentation.js +91 -42
- package/dist/render.d.ts +26 -0
- package/dist/render.js +145 -0
- package/dist/runner.d.ts +0 -1
- package/dist/runner.js +105 -52
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/style.d.ts +40 -0
- package/dist/style.js +74 -0
- package/dist/suggest.d.ts +5 -0
- package/dist/suggest.js +42 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by scripts/generate-commands.mjs. Do not edit.
|
|
2
2
|
export const commandManifest = {
|
|
3
|
-
schemaDigest: "sha256:
|
|
3
|
+
schemaDigest: "sha256:5efcff731683bd222f815032f63155a41134ba7ed47b8b63caa7736a2e5950a3",
|
|
4
4
|
commands: [
|
|
5
5
|
{
|
|
6
6
|
action: "zo.activity.list",
|
|
@@ -10,7 +10,7 @@ export const commandManifest = {
|
|
|
10
10
|
version: 1,
|
|
11
11
|
description: "List who did what in the workspace, newest first: task, connection, event, membership and other changes, each with its principal, subject, outcome and a one-line summary. You see a row when you did it, when its subject is visible to the workspace, or when you own its protected subject.",
|
|
12
12
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"maxLength":200,"minLength":1,"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"ActivityListInput","type":"object"}',
|
|
13
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["occurred_at.desc"],"default":"occurred_at.desc"},"filter":{"additionalProperties":false,"properties":{"occurred_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows after this time.","title":"Occurred After"},"occurred_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows before this time.","title":"Occurred Before"},"principal":{"anyOf":[{"$ref":"#/$defs/EntityFilter"},{"type":"null"}],"default":null,"description":"Only what this principal did."},"principal_type":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":8,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows done by any of these principal types, such as user, agent, function, workflow, service_account or workspace.","title":"Principal Type"},"subject":{"anyOf":[{"$ref":"#/$defs/EntityFilter"},{"type":"null"}],"default":null,"description":"Only what was done to this resource."},"action":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":50,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows with any of these actions.","title":"Action"},"outcome":{"anyOf":[{"items":{"enum":["succeeded","failed","cancelled","unknown"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows with any of these outcomes.","title":"Outcome"},"search":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows whose summary or principal\'s current name contains this text, ignoring case. Leading and trailing spaces are ignored.","title":"Search"}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"EntityFilter":{"additionalProperties":false,"properties":{"type":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"EntityFilter","type":"object"}}}',
|
|
13
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["occurred_at.desc"],"default":"occurred_at.desc"},"filter":{"additionalProperties":false,"properties":{"occurred_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows after this time. A run or turn row\'s time is when it ended.","title":"Occurred After"},"occurred_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows before this time. A run or turn row\'s time is when it ended.","title":"Occurred Before"},"details":{"anyOf":[{"$ref":"#/$defs/ActivityDetailsFilter"},{"type":"null"}],"default":null,"description":"Match any listed value for each details key; keys combine with AND. Empty is a no-op."},"principal":{"anyOf":[{"$ref":"#/$defs/EntityFilter"},{"type":"null"}],"default":null,"description":"Only what this principal did."},"principal_type":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":8,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows done by any of these principal types, such as user, agent, function, workflow, service_account or workspace.","title":"Principal Type"},"subject":{"anyOf":[{"$ref":"#/$defs/EntityFilter"},{"type":"null"}],"default":null,"description":"Only what was done to this resource."},"action":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":50,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows with any of these actions.","title":"Action"},"outcome":{"anyOf":[{"items":{"enum":["succeeded","failed","cancelled","unknown"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only rows with any of these outcomes.","title":"Outcome"},"search":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only rows whose summary or principal\'s current name contains this text, ignoring case. Leading and trailing spaces are ignored.","title":"Search"}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"ActivityDetailsFilter":{"additionalProperties":false,"properties":{"turn_outcome":{"anyOf":[{"items":{"enum":["completed","failed","cancelled","interrupted"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"system_agent_turn_ended rows carry the runner\'s turn_outcome.","title":"Turn Outcome"},"reason":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":20,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"system_agent_turn_ended rows carry reason when the turn has an error reason.","title":"Reason"},"error_code":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":20,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"function_run_ended and workflow_run_ended carry error_code on errors. managed_machine_create_failed, managed_machine_resume_failed, machine_image_import_failed and database_create_failed carry error_code, including \\"none\\".","title":"Error Code"},"trigger":{"anyOf":[{"items":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","type":"string"},"maxItems":20,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"system_agent_turn_ended rows carry message or event; scheduled_runs_summarized rows carry schedule or event.","title":"Trigger"}},"title":"ActivityDetailsFilter","type":"object","required":[]},"EntityFilter":{"additionalProperties":false,"properties":{"type":{"maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"EntityFilter","type":"object"}}}',
|
|
14
14
|
resultKind: "inline",
|
|
15
15
|
},
|
|
16
16
|
],
|
|
@@ -131,7 +131,7 @@ export const commandManifest = {
|
|
|
131
131
|
versions: [
|
|
132
132
|
{
|
|
133
133
|
version: 1,
|
|
134
|
-
description: "Read a session's history: its inputs, the Agent's responses and tool results, newest first, as ACP updates.",
|
|
134
|
+
description: "Read a session's history: its inputs, the Agent's responses and tool results, newest first, as ACP updates. The page limit counts context rows, so a page can contain more items than its limit; a turn_ended item follows each finished turn's last item.",
|
|
135
135
|
inputJson: '{"additionalProperties":false,"properties":{"session_id":{"maxLength":200,"minLength":1,"title":"Session Id","type":"string"}},"required":["session_id"],"title":"AgentSessionHistoryInput","type":"object"}',
|
|
136
136
|
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 100; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."}},"required":[]}',
|
|
137
137
|
resultKind: "inline",
|
|
@@ -146,7 +146,7 @@ export const commandManifest = {
|
|
|
146
146
|
version: 1,
|
|
147
147
|
description: "List an Agent's sessions that the caller can read.",
|
|
148
148
|
inputJson: '{"additionalProperties":false,"properties":{"agent_id":{"maxLength":200,"minLength":1,"title":"Agent Id","type":"string"}},"required":["agent_id"],"title":"AgentSessionListInput","type":"object"}',
|
|
149
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc","last_activity_at.desc"],"default":"id.asc"}},"required":[]}',
|
|
149
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc","last_activity_at.desc"],"default":"id.asc"},"filter":{"additionalProperties":false,"properties":{"last_turn_ended_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn ended after this time, exclusively.","title":"Last Turn Ended After"},"last_turn_ended_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn ended before this time, exclusively.","title":"Last Turn Ended Before"},"last_turn_outcome":{"anyOf":[{"items":{"enum":["completed","cancelled","interrupted","failed"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn has any of these outcomes.","title":"Last Turn Outcome"}},"type":"object","required":[],"default":{}}},"required":[]}',
|
|
150
150
|
resultKind: "inline",
|
|
151
151
|
},
|
|
152
152
|
],
|
|
@@ -159,7 +159,7 @@ export const commandManifest = {
|
|
|
159
159
|
version: 1,
|
|
160
160
|
description: "List the sessions in a workspace that the caller can read, across Agents.",
|
|
161
161
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"maxLength":200,"minLength":1,"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"AgentSessionWorkspaceListInput","type":"object"}',
|
|
162
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc","last_activity_at.desc"],"default":"id.asc"},"filter":{"additionalProperties":false,"properties":{"agent_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only this Agent\'s sessions.","title":"Agent Id"}},"type":"object","required":[],"default":{}}},"required":[]}',
|
|
162
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc","last_activity_at.desc"],"default":"id.asc"},"filter":{"additionalProperties":false,"properties":{"last_turn_ended_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn ended after this time, exclusively.","title":"Last Turn Ended After"},"last_turn_ended_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn ended before this time, exclusively.","title":"Last Turn Ended Before"},"last_turn_outcome":{"anyOf":[{"items":{"enum":["completed","cancelled","interrupted","failed"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only sessions whose last turn has any of these outcomes.","title":"Last Turn Outcome"},"agent_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only this Agent\'s sessions.","title":"Agent Id"}},"type":"object","required":[],"default":{}}},"required":[]}',
|
|
163
163
|
resultKind: "inline",
|
|
164
164
|
},
|
|
165
165
|
],
|
|
@@ -671,7 +671,7 @@ export const commandManifest = {
|
|
|
671
671
|
version: 1,
|
|
672
672
|
description: "List functions accessible to the caller in a workspace.",
|
|
673
673
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"FunctionListInput","type":"object"}',
|
|
674
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."}},"required":[]}',
|
|
674
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"filter":{"additionalProperties":false,"properties":{"connection_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Connection Id"}},"type":"object","required":[],"default":{}}},"required":[]}',
|
|
675
675
|
resultKind: "inline",
|
|
676
676
|
},
|
|
677
677
|
],
|
|
@@ -684,7 +684,7 @@ export const commandManifest = {
|
|
|
684
684
|
version: 1,
|
|
685
685
|
description: "List the function's runs, newest first.",
|
|
686
686
|
inputJson: '{"additionalProperties":false,"properties":{"function_id":{"title":"Function Id","type":"string"}},"required":["function_id"],"title":"FunctionListRunsInput","type":"object"}',
|
|
687
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."}},"required":[]}',
|
|
687
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["created_at.desc","created_at.asc"],"default":"created_at.desc"},"filter":{"additionalProperties":false,"properties":{"created_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs created after this time.","title":"Created After"},"created_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs created before this time.","title":"Created Before"},"state":{"anyOf":[{"items":{"$ref":"#/$defs/RunState"},"maxItems":8,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs in any of these states.","title":"State"},"error_code":{"anyOf":[{"items":{"pattern":"^[a-z][a-z0-9_]{0,63}$","type":"string"},"maxItems":20,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs with any of these error codes.","title":"Error Code"},"deployment_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs of this deployment.","title":"Deployment Id"},"entry_kind":{"anyOf":[{"items":{"enum":["direct","connection","http"],"type":"string"},"maxItems":3,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs with any of these entry kinds.","title":"Entry Kind"},"trigger":{"anyOf":[{"items":{"enum":["direct","http","event","workflow_step","run","agent"],"type":"string"},"maxItems":6,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs with any of these trigger kinds.","title":"Trigger"},"subscription_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs delivered by this subscription.","title":"Subscription Id"},"agent_session_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs started by this Agent session.","title":"Agent Session Id"}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"RunState":{"enum":["queued","starting","running","succeeded","failed","cancel_requested","cancelled","unknown"],"type":"string"}}}',
|
|
688
688
|
resultKind: "inline",
|
|
689
689
|
},
|
|
690
690
|
],
|
|
@@ -781,7 +781,7 @@ export const commandManifest = {
|
|
|
781
781
|
version: 1,
|
|
782
782
|
description: "List the managed machines the caller can see in a workspace.",
|
|
783
783
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"MachineListInput","type":"object"}',
|
|
784
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc"],"default":"id.asc"}},"required":[]}',
|
|
784
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["id.asc","created_at.desc","created_at.asc","display_name.asc"],"default":"id.asc"},"filter":{"additionalProperties":false,"properties":{"state":{"anyOf":[{"items":{"$ref":"#/$defs/ObservedState"},"maxItems":8,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only machines in any of these states.","title":"State"}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"ObservedState":{"enum":["creating","running","stopping","stopped","resuming","destroying","destroyed","failed"],"type":"string"}}}',
|
|
785
785
|
resultKind: "inline",
|
|
786
786
|
},
|
|
787
787
|
],
|
|
@@ -968,6 +968,18 @@ export const commandManifest = {
|
|
|
968
968
|
},
|
|
969
969
|
],
|
|
970
970
|
},
|
|
971
|
+
{
|
|
972
|
+
action: "zo.model.generate_text",
|
|
973
|
+
path: ["model", "generate-text"],
|
|
974
|
+
versions: [
|
|
975
|
+
{
|
|
976
|
+
version: 1,
|
|
977
|
+
description: "Generate text with a model from a prompt or a conversation, or structured data when output is set: an object or a list matching a JSON Schema, one choice from a set, or any JSON. A user message can hold images and text files. One call, with no tools and no memory of earlier calls. Each call is charged to the workspace's credit for the tokens the provider reports and needs V2 billing.",
|
|
978
|
+
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"maxLength":200,"minLength":1,"title":"Workspace Id","type":"string"},"model":{"description":"A model ID from zo.model.list, such as anthropic/claude-sonnet-5-5.","maxLength":200,"minLength":1,"title":"Model","type":"string"},"prompt":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"A single user message. Set this or messages.","title":"Prompt"},"messages":{"anyOf":[{"items":{"discriminator":{"mapping":{"assistant":"#/$defs/AssistantMessage","user":"#/$defs/UserMessage"},"propertyName":"role"},"oneOf":[{"$ref":"#/$defs/UserMessage"},{"$ref":"#/$defs/AssistantMessage"}]},"maxItems":500,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"A conversation that ends with a user message. Set this or prompt.","title":"Messages"},"instructions":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"System instructions.","title":"Instructions"},"output":{"anyOf":[{"discriminator":{"mapping":{"array":"#/$defs/ArrayOutput","choice":"#/$defs/ChoiceOutput","json":"#/$defs/JsonOutput","object":"#/$defs/ObjectOutput"},"propertyName":"type"},"oneOf":[{"$ref":"#/$defs/ObjectOutput"},{"$ref":"#/$defs/ArrayOutput"},{"$ref":"#/$defs/ChoiceOutput"},{"$ref":"#/$defs/JsonOutput"}]},{"type":"null"}],"default":null,"description":"The structured output wanted. Omit for plain text.","title":"Output"},"reasoning":{"anyOf":[{"maxLength":32,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Reasoning effort, one of the model\'s reasoning_levels. Omit for its default.","title":"Reasoning"},"include":{"anyOf":[{"$ref":"#/$defs/Include"},{"type":"null"}],"default":null},"provider_options":{"anyOf":[{"$ref":"#/$defs/ProviderOptions"},{"type":"null"}],"default":null,"description":"Settings for the provider the model runs on, keyed by provider, in snake case. Only the routed provider\'s options are used; an option it doesn\'t take is refused before the call."},"max_output_tokens":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"description":"The most tokens to generate.","title":"Max Output Tokens"},"temperature":{"anyOf":[{"maximum":2,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"title":"Temperature"},"top_p":{"anyOf":[{"maximum":1,"minimum":0,"type":"number"},{"type":"null"}],"default":null,"title":"Top P"},"top_k":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"title":"Top K"},"presence_penalty":{"anyOf":[{"maximum":2,"minimum":-2,"type":"number"},{"type":"null"}],"default":null,"title":"Presence Penalty"},"frequency_penalty":{"anyOf":[{"maximum":2,"minimum":-2,"type":"number"},{"type":"null"}],"default":null,"title":"Frequency Penalty"},"stop_sequences":{"anyOf":[{"items":{"maxLength":200,"minLength":1,"type":"string"},"maxItems":16,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"title":"Stop Sequences"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Seed"}},"required":["workspace_id","model"],"title":"GenerateTextInput","type":"object","$defs":{"ArrayOutput":{"additionalProperties":false,"properties":{"type":{"const":"array","title":"Type","type":"string"},"element_schema":{"additionalProperties":{"x-zo-json-value":true},"description":"A JSON Schema every element of the result matches.","title":"Element Schema","type":"object"},"name":{"anyOf":[{"maxLength":64,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","type":"string"},{"type":"null"}],"default":null,"title":"Name"},"description":{"anyOf":[{"maxLength":1024,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["type","element_schema"],"title":"ArrayOutput","type":"object"},"AssistantMessage":{"additionalProperties":false,"properties":{"role":{"const":"assistant","title":"Role","type":"string"},"content":{"items":{"$ref":"#/$defs/TextPart"},"maxItems":100,"minItems":1,"title":"Content","type":"array"}},"required":["role","content"],"title":"AssistantMessage","type":"object"},"ChoiceOutput":{"additionalProperties":false,"properties":{"type":{"const":"choice","title":"Type","type":"string"},"options":{"description":"The result is exactly one of these.","items":{"maxLength":200,"minLength":1,"type":"string"},"maxItems":100,"minItems":2,"title":"Options","type":"array"}},"required":["type","options"],"title":"ChoiceOutput","type":"object"},"FilePart":{"additionalProperties":false,"description":"An image (PNG, JPEG, GIF or WebP, up to 20 MiB) or a text file (up to 1 MiB), as a Knowledge file by ID or\\ninline as base64. A call may name at most 20 distinct Knowledge files. Other types, PDFs and video included, are\\nrefused. Which types a model takes is its `input_media` in `zo.model.list`.","properties":{"type":{"const":"file","title":"Type","type":"string"},"file_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"A Knowledge file the caller can read. Set this or data, not both.","title":"File Id"},"data":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"The file\'s bytes as base64.","title":"Data"},"media_type":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Required with data, such as image/png or text/plain. Ignored for a Knowledge file, which always uses its stored type.","title":"Media Type"},"filename":{"anyOf":[{"maxLength":255,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Filename"}},"required":["type"],"title":"FilePart","type":"object"},"Include":{"additionalProperties":false,"properties":{"reasoning":{"default":false,"description":"Return the model\'s reasoning text when it provides one.","title":"Reasoning","type":"boolean"}},"title":"Include","type":"object","required":[]},"JsonOutput":{"additionalProperties":false,"properties":{"type":{"const":"json","title":"Type","type":"string"}},"required":["type"],"title":"JsonOutput","type":"object"},"ObjectOutput":{"additionalProperties":false,"properties":{"type":{"const":"object","title":"Type","type":"string"},"schema":{"additionalProperties":{"x-zo-json-value":true},"description":"A JSON Schema whose root type is object. The result matches it.","title":"Schema","type":"object"},"name":{"anyOf":[{"maxLength":64,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","type":"string"},{"type":"null"}],"default":null,"title":"Name"},"description":{"anyOf":[{"maxLength":1024,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["type","schema"],"title":"ObjectOutput","type":"object"},"ProviderOptions":{"additionalProperties":false,"description":"Settings for one provider, keyed by provider, passed through to that\\nprovider\'s request as the Vercel AI SDK\'s providerOptions are. Shared by\\nevery model action that takes them.","properties":{"anthropic":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Anthropic models: thinking, send_reasoning.","title":"Anthropic"},"openai":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For OpenAI models: reasoning_summary, text_verbosity, service_tier, user, logit_bias.","title":"Openai"},"google":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Google models: thinking_config, safety_settings.","title":"Google"},"xai":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For xAI models. None are accepted yet.","title":"Xai"},"deepseek":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For DeepSeek models. None are accepted yet.","title":"Deepseek"},"moonshot":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Moonshot models. None are accepted yet.","title":"Moonshot"},"zai":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Z.ai models. None are accepted yet.","title":"Zai"},"voyage":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Voyage models: truncation.","title":"Voyage"},"bytedance":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For ByteDance models. None are accepted yet.","title":"Bytedance"},"recraft":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For Recraft models. None are accepted yet.","title":"Recraft"},"assemblyai":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"For AssemblyAI transcription: punctuate, format_text, disfluencies, filter_profanity, word_boost, boost_param.","title":"Assemblyai"}},"title":"ProviderOptions","type":"object","required":[]},"TextPart":{"additionalProperties":false,"properties":{"type":{"const":"text","title":"Type","type":"string"},"text":{"title":"Text","type":"string"}},"required":["type","text"],"title":"TextPart","type":"object"},"UserMessage":{"additionalProperties":false,"properties":{"role":{"const":"user","title":"Role","type":"string"},"content":{"description":"Text and file parts, in order.","items":{"discriminator":{"mapping":{"file":"#/$defs/FilePart","text":"#/$defs/TextPart"},"propertyName":"type"},"oneOf":[{"$ref":"#/$defs/TextPart"},{"$ref":"#/$defs/FilePart"}]},"maxItems":100,"minItems":1,"title":"Content","type":"array"}},"required":["role","content"],"title":"UserMessage","type":"object"}}}',
|
|
979
|
+
resultKind: "inline",
|
|
980
|
+
},
|
|
981
|
+
],
|
|
982
|
+
},
|
|
971
983
|
{
|
|
972
984
|
action: "zo.model.list",
|
|
973
985
|
path: ["model", "list"],
|
|
@@ -988,7 +1000,7 @@ export const commandManifest = {
|
|
|
988
1000
|
{
|
|
989
1001
|
version: 1,
|
|
990
1002
|
description: "Register an OAuth app a workspace's connections authorize through.",
|
|
991
|
-
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"maxLength":200,"minLength":1,"title":"Workspace Id","type":"string"},"provider":{"maxLength":200,"minLength":1,"title":"Provider","type":"string"},"client_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Client Id"},"manager_ref":{"additionalProperties":{"x-zo-json-value":true},"default":{},"title":"Manager Ref","type":"object"},"visibility":{"enum":["private","public"],"title":"Visibility","type":"string"},"requested_scopes":{"items":{"maxLength":200,"minLength":1,"type":"string"},"maxItems":100,"title":"Requested Scopes","type":"array"},"connection_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Connection Id"},"client_secret":{"anyOf":[{"maxLength":4096,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"The app\'s client secret. Zo seals it in the workspace vault and
|
|
1003
|
+
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"maxLength":200,"minLength":1,"title":"Workspace Id","type":"string"},"provider":{"maxLength":200,"minLength":1,"title":"Provider","type":"string"},"client_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Client Id"},"manager_ref":{"additionalProperties":{"x-zo-json-value":true},"default":{},"title":"Manager Ref","type":"object"},"visibility":{"enum":["private","public"],"title":"Visibility","type":"string"},"requested_scopes":{"items":{"maxLength":200,"minLength":1,"type":"string"},"maxItems":100,"title":"Requested Scopes","type":"array"},"connection_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Connection Id"},"client_secret":{"anyOf":[{"maxLength":4096,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"The app\'s client secret. Zo seals it in the workspace vault and never returns it. A private app needs one. After an update, every connection on the app uses the new secret from its next refresh.","title":"Client Secret"}},"required":["workspace_id","provider","visibility","requested_scopes"],"title":"OAuthAppCreateWithSecretInput","type":"object"}',
|
|
992
1004
|
resultKind: "inline",
|
|
993
1005
|
},
|
|
994
1006
|
],
|
|
@@ -1037,7 +1049,7 @@ export const commandManifest = {
|
|
|
1037
1049
|
{
|
|
1038
1050
|
version: 1,
|
|
1039
1051
|
description: "Replace an OAuth app's client, secret and visibility.",
|
|
1040
|
-
inputJson: '{"additionalProperties":false,"properties":{"owner":{"$ref":"#/$defs/OAuthAppOwner"},"oauth_app_id":{"maxLength":200,"minLength":1,"title":"Oauth App Id","type":"string"},"expected_state":{"pattern":"^[0-9a-f]{64}$","title":"Expected State","type":"string"},"client_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Client Id"},"manager_ref":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"Omitted: keep the app\'s current `manager_ref
|
|
1052
|
+
inputJson: '{"additionalProperties":false,"properties":{"owner":{"$ref":"#/$defs/OAuthAppOwner"},"oauth_app_id":{"maxLength":200,"minLength":1,"title":"Oauth App Id","type":"string"},"expected_state":{"pattern":"^[0-9a-f]{64}$","title":"Expected State","type":"string"},"client_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"title":"Client Id"},"manager_ref":{"anyOf":[{"additionalProperties":{"x-zo-json-value":true},"type":"object"},{"type":"null"}],"default":null,"description":"Omitted: keep the app\'s current `manager_ref`. It can\'t contain `client_secret`, `client_secret_id` or `client_secret_env`.","title":"Manager Ref"},"visibility":{"enum":["private","public"],"title":"Visibility","type":"string"},"client_secret":{"anyOf":[{"maxLength":4096,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"The app\'s client secret. Zo seals it in the workspace vault and never returns it. A private app needs one. After an update, every connection on the app uses the new secret from its next refresh.","title":"Client Secret"}},"required":["owner","oauth_app_id","expected_state","visibility"],"title":"OAuthAppUpdateWithSecretInput","type":"object","$defs":{"OAuthAppOwner":{"additionalProperties":false,"properties":{"type":{"description":"The workspace, or the connection the app is bound to.","enum":["workspace","connection"],"title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"OAuthAppOwner","type":"object"}}}',
|
|
1041
1053
|
resultKind: "inline",
|
|
1042
1054
|
},
|
|
1043
1055
|
],
|
|
@@ -1220,14 +1232,14 @@ export const commandManifest = {
|
|
|
1220
1232
|
version: 1,
|
|
1221
1233
|
description: "List subscriptions accessible to the caller in a workspace, optionally for one event definition.",
|
|
1222
1234
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"SubscriptionListInput","type":"object"}',
|
|
1223
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":100,"description":"Rows per page, at most 100; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"filter":{"additionalProperties":false,"properties":{"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions to this event definition.","title":"Event Id"},"handler":{"anyOf":[{"$ref":"#/$defs/SubscriptionHandlerRef"},{"type":"null"}],"default":null,"description":"Only subscriptions whose handler is this resource: its handler_resource_type and handler_resource_id, such as an Agent."}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"SubscriptionHandlerRef":{"additionalProperties":false,"properties":{"type":{"enum":["function","workflow","agent"],"title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"SubscriptionHandlerRef","type":"object"}}}',
|
|
1235
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":100,"description":"Rows per page, at most 100; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"filter":{"additionalProperties":false,"properties":{"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions to this event definition.","title":"Event Id"},"schedule_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions that run for this schedule.","title":"Schedule Id"},"handler":{"anyOf":[{"$ref":"#/$defs/SubscriptionHandlerRef"},{"type":"null"}],"default":null,"description":"Only subscriptions whose handler is this resource: its handler_resource_type and handler_resource_id, such as an Agent."}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"SubscriptionHandlerRef":{"additionalProperties":false,"properties":{"type":{"enum":["function","workflow","agent"],"title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"SubscriptionHandlerRef","type":"object"}}}',
|
|
1224
1236
|
resultKind: "inline",
|
|
1225
1237
|
},
|
|
1226
1238
|
{
|
|
1227
1239
|
version: 2,
|
|
1228
1240
|
description: "List subscriptions accessible to the caller in a workspace, optionally for one event definition.",
|
|
1229
1241
|
inputJson: '{"additionalProperties":false,"properties":{"workspace_id":{"title":"Workspace Id","type":"string"}},"required":["workspace_id"],"title":"SubscriptionListInput","type":"object"}',
|
|
1230
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":100,"description":"Rows per page, at most 100; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"filter":{"additionalProperties":false,"properties":{"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions to this event definition.","title":"Event Id"},"handler":{"anyOf":[{"$ref":"#/$defs/SubscriptionHandlerRef"},{"type":"null"}],"default":null,"description":"Only subscriptions whose handler is this resource: its handler_resource_type and handler_resource_id, such as an Agent."}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"SubscriptionHandlerRef":{"additionalProperties":false,"properties":{"type":{"enum":["function","workflow","agent"],"title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"SubscriptionHandlerRef","type":"object"}}}',
|
|
1242
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":100,"description":"Rows per page, at most 100; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"filter":{"additionalProperties":false,"properties":{"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions to this event definition.","title":"Event Id"},"schedule_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only subscriptions that run for this schedule.","title":"Schedule Id"},"handler":{"anyOf":[{"$ref":"#/$defs/SubscriptionHandlerRef"},{"type":"null"}],"default":null,"description":"Only subscriptions whose handler is this resource: its handler_resource_type and handler_resource_id, such as an Agent."}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"SubscriptionHandlerRef":{"additionalProperties":false,"properties":{"type":{"enum":["function","workflow","agent"],"title":"Type","type":"string"},"id":{"maxLength":200,"minLength":1,"title":"Id","type":"string"}},"required":["type","id"],"title":"SubscriptionHandlerRef","type":"object"}}}',
|
|
1231
1243
|
resultKind: "inline",
|
|
1232
1244
|
},
|
|
1233
1245
|
],
|
|
@@ -1745,7 +1757,7 @@ export const commandManifest = {
|
|
|
1745
1757
|
version: 1,
|
|
1746
1758
|
description: "List the workflow's runs, newest first.",
|
|
1747
1759
|
inputJson: '{"additionalProperties":false,"properties":{"workflow_id":{"title":"Workflow Id","type":"string"}},"required":["workflow_id"],"title":"WorkflowListRunsInput","type":"object"}',
|
|
1748
|
-
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."}},"required":[]}',
|
|
1760
|
+
queryJson: '{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"integer","minimum":1,"default":50,"description":"Rows per page, at most 200; a larger value is reduced to it."},"cursor":{"type":"string","minLength":1,"maxLength":5504,"description":"The previous page\'s next_cursor, sent with the same sort, filter and search."},"sort":{"type":"string","enum":["created_at.desc","created_at.asc"],"default":"created_at.desc"},"filter":{"additionalProperties":false,"properties":{"created_after":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs created after this time.","title":"Created After"},"created_before":{"anyOf":[{"description":"An ISO 8601 timestamp with a time zone.","maxLength":40,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs created before this time.","title":"Created Before"},"state":{"anyOf":[{"items":{"$ref":"#/$defs/WorkflowRunState"},"maxItems":7,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs in any of these states.","title":"State"},"error_code":{"anyOf":[{"items":{"$ref":"#/$defs/WorkflowRunError"},"maxItems":5,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs with any of these error codes.","title":"Error Code"},"revision_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs of this revision.","title":"Revision Id"},"trigger":{"anyOf":[{"items":{"enum":["direct","event","run","agent"],"type":"string"},"maxItems":4,"minItems":1,"type":"array"},{"type":"null"}],"default":null,"description":"Only runs with any of these trigger kinds.","title":"Trigger"},"subscription_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs delivered by this subscription.","title":"Subscription Id"},"agent_session_id":{"anyOf":[{"maxLength":200,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Only runs started by this Agent session.","title":"Agent Session Id"}},"type":"object","required":[],"default":{}}},"required":[],"$defs":{"WorkflowRunError":{"enum":["step_failed","deadline_exceeded","engine_error","engine_rejected","engine_unavailable"],"type":"string"},"WorkflowRunState":{"enum":["queued","running","cancel_requested","succeeded","failed","cancelled","unknown"],"type":"string"}}}',
|
|
1749
1761
|
resultKind: "inline",
|
|
1750
1762
|
},
|
|
1751
1763
|
],
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Style } from "./style.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Root help: grouped, aligned, and short enough for one 80-column screen.
|
|
4
|
+
* People and agents read the same text; `style` only adds bold and dim on a
|
|
5
|
+
* terminal. `resources` are the first words of the built-in commands.
|
|
6
|
+
*/
|
|
7
|
+
export declare function rootHelp(style: Style, resources: readonly string[]): string;
|
package/dist/help.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const WIDTH = 80;
|
|
2
|
+
function wrapped(words, indent) {
|
|
3
|
+
const lines = [];
|
|
4
|
+
let line = indent;
|
|
5
|
+
words.forEach((word, index) => {
|
|
6
|
+
const piece = index === words.length - 1 ? word : `${word},`;
|
|
7
|
+
if (line !== indent && line.length + 1 + piece.length > WIDTH) {
|
|
8
|
+
lines.push(line);
|
|
9
|
+
line = indent;
|
|
10
|
+
}
|
|
11
|
+
line += line === indent ? piece : ` ${piece}`;
|
|
12
|
+
});
|
|
13
|
+
return line === indent ? lines : [...lines, line];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Root help: grouped, aligned, and short enough for one 80-column screen.
|
|
17
|
+
* People and agents read the same text; `style` only adds bold and dim on a
|
|
18
|
+
* terminal. `resources` are the first words of the built-in commands.
|
|
19
|
+
*/
|
|
20
|
+
export function rootHelp(style, resources) {
|
|
21
|
+
const row = (command, description) => ` ${command.padEnd(23)}${description}`;
|
|
22
|
+
return `${[
|
|
23
|
+
style.bold("Zo public command line client"),
|
|
24
|
+
`${style.bold("Usage:")} zo <command> [--profile <name>] [--workspace <id>] [--json]`,
|
|
25
|
+
"",
|
|
26
|
+
style.bold("Set up"),
|
|
27
|
+
row("login, logout", "Sign in through your browser, or sign out"),
|
|
28
|
+
row("auth status|token", "Show your identity, or print an access token"),
|
|
29
|
+
row("context list|use|show", "List, choose or show the selected workspace"),
|
|
30
|
+
row("update, --version", "Upgrade the CLI, or print its version"),
|
|
31
|
+
row("completion <shell>", "Print bash, zsh or fish completion"),
|
|
32
|
+
"",
|
|
33
|
+
style.bold("Call the System API"),
|
|
34
|
+
row("<resource> <action>", "Run a built-in command for one of these:"),
|
|
35
|
+
...wrapped(resources, " "),
|
|
36
|
+
row("actions list|describe", "Discover callable actions and their schemas"),
|
|
37
|
+
row("rpc <action>", "Call any action with JSON input"),
|
|
38
|
+
"",
|
|
39
|
+
style.bold("Examples"),
|
|
40
|
+
" zo machine list --limit 20",
|
|
41
|
+
` zo task create --help ${style.dim("Show any command's options")}`,
|
|
42
|
+
].join("\n")}\n`;
|
|
43
|
+
}
|
package/dist/output.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { type JsonObject } from "@zocomputer/system-api/json";
|
|
1
|
+
import { type JsonObject, type JsonValue } from "@zocomputer/system-api/json";
|
|
2
2
|
import type { RpcResult } from "./rpc.ts";
|
|
3
|
+
import { type Terminal } from "./style.ts";
|
|
3
4
|
export interface OutputOptions {
|
|
4
5
|
json?: boolean;
|
|
5
6
|
envelope?: boolean;
|
|
6
|
-
stdout?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
stderr?: {
|
|
11
|
-
write(text: string): unknown;
|
|
12
|
-
isTTY?: boolean;
|
|
13
|
-
};
|
|
7
|
+
stdout?: Terminal;
|
|
8
|
+
stderr?: Terminal;
|
|
9
|
+
/** Read for NO_COLOR. */
|
|
10
|
+
env?: NodeJS.ProcessEnv;
|
|
14
11
|
}
|
|
12
|
+
export declare function toJson(value: unknown): JsonValue;
|
|
15
13
|
export declare function writeJsonText(text: string, options?: OutputOptions): void;
|
|
16
14
|
export declare function writeJson(value: unknown, options?: OutputOptions): void;
|
|
17
15
|
export declare function writeRpcResult(result: RpcResult, options?: OutputOptions): void;
|
package/dist/output.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SystemAPIError } from "@zocomputer/system-api";
|
|
2
2
|
import { canonicalNumberFromToken, dumpsJson, JsonNumber, loadsJson, } from "@zocomputer/system-api/json";
|
|
3
3
|
import { CliError, record, safeText } from "./errors.js";
|
|
4
|
-
|
|
4
|
+
import { blankLine, styleFor } from "./style.js";
|
|
5
|
+
export function toJson(value) {
|
|
5
6
|
if (value === null ||
|
|
6
7
|
typeof value === "string" ||
|
|
7
8
|
typeof value === "boolean" ||
|
|
@@ -206,8 +207,33 @@ export function writeError(error, options = {}) {
|
|
|
206
207
|
}
|
|
207
208
|
if (options.json)
|
|
208
209
|
stderr.write(`${dumpsJson({ error: failure })}\n`);
|
|
210
|
+
else if (stderr.isTTY && status === 130) {
|
|
211
|
+
// The terminal echoed ^C onto this line, after a spinner or prompt if one
|
|
212
|
+
// was showing.
|
|
213
|
+
stderr.write(`${blankLine(stderr)}Cancelled.\n`);
|
|
214
|
+
if (failure.outcome === "unknown") {
|
|
215
|
+
if (failure.request_id !== undefined)
|
|
216
|
+
stderr.write(`Request: ${safeText(String(failure.request_id))}\n`);
|
|
217
|
+
stderr.write("The action may have run; the CLI did not replay it.\n");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
209
220
|
else {
|
|
210
|
-
stderr.
|
|
221
|
+
if (stderr.isTTY) {
|
|
222
|
+
const style = styleFor(stderr, options.env);
|
|
223
|
+
// The CLI's own messages put the problem first, then what to do about
|
|
224
|
+
// it. Server messages stay on one line: their wording isn't ours.
|
|
225
|
+
const [problem = "", ...steps] = error instanceof CliError
|
|
226
|
+
? String(failure.message)
|
|
227
|
+
.trimEnd()
|
|
228
|
+
.replace(/^(.*?[.?!])[ \t]+(?=\S)/, "$1\n")
|
|
229
|
+
.split("\n")
|
|
230
|
+
: [String(failure.message)];
|
|
231
|
+
stderr.write(`${style.bold(style.red("Error:"))} ${safeText(problem)} ${style.dim(`(${safeText(String(failure.code))})`)}\n`);
|
|
232
|
+
for (const step of steps)
|
|
233
|
+
stderr.write(`${safeText(step)}\n`);
|
|
234
|
+
}
|
|
235
|
+
else
|
|
236
|
+
stderr.write(`${safeText(String(failure.code))}: ${safeText(String(failure.message))}\n`);
|
|
211
237
|
if (failure.request_id !== undefined)
|
|
212
238
|
stderr.write(`Request: ${safeText(String(failure.request_id))}\n`);
|
|
213
239
|
if (failure.details !== undefined)
|
package/dist/presentation.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type OutputOptions } from "./output.ts";
|
|
2
2
|
import type { RpcResult } from "./rpc.ts";
|
|
3
|
+
import { type Style } from "./style.ts";
|
|
3
4
|
export interface PresentationOptions extends OutputOptions {
|
|
4
5
|
workspaceId?: string;
|
|
5
6
|
identity?: string;
|
|
6
7
|
columns?: number;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
/** A table for a list action's result, or undefined when it should stay JSON. */
|
|
10
|
+
export declare function tableResult(action: string, text: string, columns?: number, style?: Style): string | undefined;
|
|
11
|
+
/** A complete key/value view of an object result, or undefined when it should stay JSON. */
|
|
12
|
+
export declare function detailResult(text: string, style?: Style): string | undefined;
|
|
9
13
|
export declare function writeBuiltinResult(action: string, result: RpcResult, options?: PresentationOptions): void;
|
package/dist/presentation.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadsJson } from "@zocomputer/system-api/json";
|
|
2
|
+
import { listSortFields } from "./commands.js";
|
|
2
3
|
import { safeText } from "./errors.js";
|
|
3
4
|
import { schemaObject } from "./flags.js";
|
|
4
5
|
import { writeRpcResult } from "./output.js";
|
|
6
|
+
import { cell, completeResultHint, detailLines, fitsCell, isScalar, jsonHint, tableLines, } from "./render.js";
|
|
7
|
+
import { styleFor, terminalWidth } from "./style.js";
|
|
8
|
+
/** Columns picked by hand for the lists people read most. */
|
|
5
9
|
const tables = {
|
|
6
10
|
"zo.machine.list": {
|
|
7
11
|
field: "machines",
|
|
@@ -24,58 +28,98 @@ const tables = {
|
|
|
24
28
|
columns: ["occurred_at", "action", "outcome", "summary"],
|
|
25
29
|
},
|
|
26
30
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const labelFields = [
|
|
32
|
+
"display_name",
|
|
33
|
+
"name",
|
|
34
|
+
"title",
|
|
35
|
+
"slug",
|
|
36
|
+
"path",
|
|
37
|
+
"display",
|
|
38
|
+
];
|
|
39
|
+
const stateFields = ["state", "status", "lifecycle", "outcome"];
|
|
40
|
+
// The same for every row of a page, or bookkeeping.
|
|
41
|
+
const skippedFields = new Set(["workspace_id", "type_version", "revision"]);
|
|
42
|
+
const DERIVED_COLUMNS = 5;
|
|
43
|
+
/**
|
|
44
|
+
* Columns for a list action with no hand-picked ones: the fields every row
|
|
45
|
+
* holds as a value one cell can show, ordered ID, name, state, the fields
|
|
46
|
+
* the action sorts by, then the rest as the rows declare them.
|
|
47
|
+
*/
|
|
48
|
+
function derivedProjection(result, sortFields) {
|
|
49
|
+
const arrays = Object.entries(result).filter(([, value]) => Array.isArray(value));
|
|
50
|
+
const [field, rows] = arrays[0] ?? [];
|
|
51
|
+
// With two lists on a page there is no telling which holds the rows.
|
|
52
|
+
if (arrays.length !== 1 || field === undefined || !Array.isArray(rows))
|
|
53
|
+
return undefined;
|
|
54
|
+
const shown = Object.keys(schemaObject(rows[0]) ?? {}).filter((key) => !skippedFields.has(key) &&
|
|
55
|
+
rows.every((row) => {
|
|
56
|
+
const object = schemaObject(row);
|
|
57
|
+
return object && Object.hasOwn(object, key) && fitsCell(object[key]);
|
|
58
|
+
}));
|
|
59
|
+
const ordered = [
|
|
60
|
+
"id",
|
|
61
|
+
...labelFields,
|
|
62
|
+
...stateFields,
|
|
63
|
+
...sortFields,
|
|
64
|
+
...shown.filter((key) => key !== "description"),
|
|
65
|
+
"description",
|
|
66
|
+
];
|
|
67
|
+
const columns = [...new Set(ordered)]
|
|
68
|
+
.filter((key) => shown.includes(key))
|
|
69
|
+
.slice(0, DERIVED_COLUMNS);
|
|
70
|
+
// Rows with nothing to show in columns are better read as JSON.
|
|
71
|
+
return rows.length && !columns.length ? undefined : { field, columns };
|
|
41
72
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
73
|
+
/** A table for a list action's result, or undefined when it should stay JSON. */
|
|
74
|
+
export function tableResult(action, text, columns = 100, style = styleFor(undefined)) {
|
|
75
|
+
const picked = Object.hasOwn(tables, action) ? tables[action] : undefined;
|
|
76
|
+
const sortFields = picked ? undefined : listSortFields(action);
|
|
77
|
+
if (!picked && !sortFields)
|
|
45
78
|
return undefined;
|
|
46
79
|
const result = schemaObject(loadsJson(text, { maxNodes: null, maxDepth: 256 }));
|
|
47
|
-
|
|
48
|
-
|
|
80
|
+
if (!result)
|
|
81
|
+
return undefined;
|
|
82
|
+
const projection = picked ?? derivedProjection(result, sortFields ?? []);
|
|
83
|
+
const rows = projection ? result[projection.field] : undefined;
|
|
84
|
+
if (!projection || !Array.isArray(rows))
|
|
49
85
|
return undefined;
|
|
86
|
+
// Hand-picked columns hold plain values only: a nested one means the
|
|
87
|
+
// contract changed under them.
|
|
88
|
+
const fits = picked ? isScalar : fitsCell;
|
|
50
89
|
if (rows.some((row) => {
|
|
51
90
|
const object = schemaObject(row);
|
|
52
91
|
return (!object ||
|
|
53
|
-
projection.columns.some((field) => !Object.hasOwn(object, field) ||
|
|
54
|
-
(object[field] !== null &&
|
|
55
|
-
typeof object[field] === "object" &&
|
|
56
|
-
!(object[field] instanceof JsonNumber))));
|
|
92
|
+
projection.columns.some((field) => !Object.hasOwn(object, field) || !fits(object[field])));
|
|
57
93
|
}))
|
|
58
94
|
return undefined;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const budget = Math.floor((width - (visible.length - 1) * 2) / visible.length);
|
|
63
|
-
const widths = visible.map((column, index) => Math.min(budget, Math.max(column.length, ...cells.map((row) => Array.from(row[index] ?? "").length))));
|
|
64
|
-
const format = (row) => visible
|
|
65
|
-
.map((_, index) => clipped(row[index] ?? "", widths[index] ?? budget))
|
|
66
|
-
.join(" ")
|
|
67
|
-
.trimEnd();
|
|
68
|
-
const lines = [
|
|
69
|
-
format(visible.map((column) => column.toUpperCase())),
|
|
70
|
-
...cells.map(format),
|
|
71
|
-
];
|
|
95
|
+
const lines = projection.columns.length
|
|
96
|
+
? tableLines(projection.columns.map((column) => safeText(column).toUpperCase()), rows.map((row) => projection.columns.map((field) => cell(schemaObject(row)?.[field]))), columns, style)
|
|
97
|
+
: [];
|
|
72
98
|
if (!rows.length)
|
|
73
99
|
lines.push("No results.");
|
|
100
|
+
if (!picked) {
|
|
101
|
+
// What the page says beside its rows, such as totals.
|
|
102
|
+
const page = Object.fromEntries(Object.entries(result).filter(([key, value]) => key !== projection.field &&
|
|
103
|
+
key !== "next_cursor" &&
|
|
104
|
+
!skippedFields.has(key) &&
|
|
105
|
+
value !== null));
|
|
106
|
+
const beside = detailLines(page, style) ?? [];
|
|
107
|
+
if (beside.length)
|
|
108
|
+
lines.push("", ...beside);
|
|
109
|
+
}
|
|
74
110
|
if (result.next_cursor !== undefined && result.next_cursor !== null)
|
|
75
111
|
lines.push(`Next cursor: ${cell(result.next_cursor)}`);
|
|
76
|
-
lines.push(
|
|
112
|
+
lines.push(style.dim(completeResultHint));
|
|
77
113
|
return `${lines.join("\n")}\n`;
|
|
78
114
|
}
|
|
115
|
+
/** A complete key/value view of an object result, or undefined when it should stay JSON. */
|
|
116
|
+
export function detailResult(text, style = styleFor(undefined)) {
|
|
117
|
+
const result = schemaObject(loadsJson(text, { maxNodes: null, maxDepth: 256 }));
|
|
118
|
+
const lines = result && detailLines(result, style);
|
|
119
|
+
return lines?.length
|
|
120
|
+
? `${[...lines, style.dim(jsonHint)].join("\n")}\n`
|
|
121
|
+
: undefined;
|
|
122
|
+
}
|
|
79
123
|
export function writeBuiltinResult(action, result, options = {}) {
|
|
80
124
|
const stdout = options.stdout ?? process.stdout;
|
|
81
125
|
const stderr = options.stderr ?? process.stderr;
|
|
@@ -84,10 +128,15 @@ export function writeBuiltinResult(action, result, options = {}) {
|
|
|
84
128
|
!options.envelope &&
|
|
85
129
|
result.kind === "success") {
|
|
86
130
|
if (options.workspaceId)
|
|
87
|
-
stderr.write(`Workspace: ${safeText(options.workspaceId)}${options.identity ? ` Identity: ${safeText(options.identity)}` : ""}\n`);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
131
|
+
stderr.write(`${styleFor(stderr, options.env).dim(`Workspace: ${safeText(options.workspaceId)}${options.identity ? ` Identity: ${safeText(options.identity)}` : ""}`)}\n`);
|
|
132
|
+
const style = styleFor(stdout, options.env);
|
|
133
|
+
// A list whose rows don't fit its columns stays JSON; it does not become
|
|
134
|
+
// a key/value view of the page.
|
|
135
|
+
const view = Object.hasOwn(tables, action) || listSortFields(action)
|
|
136
|
+
? tableResult(action, result.response.resultJson, options.columns ?? terminalWidth(stdout, 100), style)
|
|
137
|
+
: detailResult(result.response.resultJson, style);
|
|
138
|
+
if (view !== undefined) {
|
|
139
|
+
stdout.write(view);
|
|
91
140
|
return;
|
|
92
141
|
}
|
|
93
142
|
}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JsonObject, type JsonValue } from "@zocomputer/system-api/json";
|
|
2
|
+
import type { Style } from "./style.ts";
|
|
3
|
+
/** Ends a table: it shows a few columns of each row. */
|
|
4
|
+
export declare const completeResultHint = "Use --json for the complete result.";
|
|
5
|
+
/** Ends a key/value view, which leaves nothing out. */
|
|
6
|
+
export declare const jsonHint = "Use --json for JSON.";
|
|
7
|
+
export declare function jsonObject(value: JsonValue | undefined): JsonObject | undefined;
|
|
8
|
+
export declare function isScalar(value: JsonValue | undefined): boolean;
|
|
9
|
+
/** Plain, or a small object of plain values such as `{type, id}`. */
|
|
10
|
+
export declare function fitsCell(value: JsonValue | undefined): boolean;
|
|
11
|
+
/** One value as escaped single-line text. */
|
|
12
|
+
export declare function cell(value: JsonValue | undefined): string;
|
|
13
|
+
/**
|
|
14
|
+
* Lines of an aligned table no wider than `width`: a header, then one line a
|
|
15
|
+
* row. Cells must already be escaped. A narrow terminal drops trailing columns
|
|
16
|
+
* and shortens the widest ones.
|
|
17
|
+
*/
|
|
18
|
+
export declare function tableLines(headers: readonly string[], rows: readonly (readonly string[])[], width: number, style: Style): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Lines of an aligned key/value view of one object, with nothing left out or
|
|
21
|
+
* shortened: a person may not be able to run the command again to see the
|
|
22
|
+
* rest. Nested objects, lists of objects and text with line breaks are
|
|
23
|
+
* indented under their key. Returns undefined for a shape this layout can't
|
|
24
|
+
* hold (lists of lists, mixed lists, deep nesting); the caller prints JSON.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detailLines(value: JsonObject, style: Style, depth?: number): string[] | undefined;
|