@byteplus/ark-cli-darwin-x64 0.0.0-stage → 1.0.46-prerelease.46bd0d6dcc58

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.
Files changed (148) hide show
  1. package/LICENSE +201 -0
  2. package/bin/arkcli-darwin-amd64 +4 -0
  3. package/manifest.json +43 -0
  4. package/package.json +20 -4
  5. package/skills/arkcli-agent/SKILL.md +152 -0
  6. package/skills/arkcli-agent/references/agent.md +398 -0
  7. package/skills/arkcli-agent/references/byok.md +65 -0
  8. package/skills/arkcli-agent/references/context-management.md +42 -0
  9. package/skills/arkcli-agent/references/debug-export.md +26 -0
  10. package/skills/arkcli-agent/references/evals.md +178 -0
  11. package/skills/arkcli-agent/references/events-chat.md +148 -0
  12. package/skills/arkcli-agent/references/interfaces-gaps.md +52 -0
  13. package/skills/arkcli-agent/references/mcp-vault.md +111 -0
  14. package/skills/arkcli-agent/references/model-config.md +46 -0
  15. package/skills/arkcli-agent/references/self-hosted.md +47 -0
  16. package/skills/arkcli-agent/references/session-files.md +149 -0
  17. package/skills/arkcli-agent/references/session-upgrade.md +61 -0
  18. package/skills/arkcli-agent/references/skills.md +87 -0
  19. package/skills/arkcli-agent/references/todo-write.md +31 -0
  20. package/skills/arkcli-api-explorer/SKILL.md +188 -0
  21. package/skills/arkcli-api-explorer/references/arkcli-api.md +180 -0
  22. package/skills/arkcli-api-explorer/references/evals.md +176 -0
  23. package/skills/arkcli-auth/SKILL.md +184 -0
  24. package/skills/arkcli-auth/references/arkcli-auth-login.md +92 -0
  25. package/skills/arkcli-auth/references/arkcli-auth-status.md +109 -0
  26. package/skills/arkcli-auth/references/arkcli-auth-whoami.md +56 -0
  27. package/skills/arkcli-auth/references/auth-modes.md +78 -0
  28. package/skills/arkcli-auth/references/evals.md +82 -0
  29. package/skills/arkcli-auth/references/identity-resolution.md +33 -0
  30. package/skills/arkcli-auth/references/realname-gate.md +69 -0
  31. package/skills/arkcli-billing/SKILL.md +122 -0
  32. package/skills/arkcli-billing/references/arkcli-billing-list.md +259 -0
  33. package/skills/arkcli-billing/references/evals.md +107 -0
  34. package/skills/arkcli-chat/SKILL.md +114 -0
  35. package/skills/arkcli-chat/references/arkcli-chat.md +283 -0
  36. package/skills/arkcli-chat/references/caching-thinking.md +124 -0
  37. package/skills/arkcli-chat/references/chat-meta.md +77 -0
  38. package/skills/arkcli-chat/references/evals.md +34 -0
  39. package/skills/arkcli-chat/references/stream-events.md +124 -0
  40. package/skills/arkcli-chat/references/text-format.md +167 -0
  41. package/skills/arkcli-chat/references/tools.md +119 -0
  42. package/skills/arkcli-config/SKILL.md +197 -0
  43. package/skills/arkcli-config/references/arkcli-config-init.md +89 -0
  44. package/skills/arkcli-config/references/arkcli-config-profile.md +106 -0
  45. package/skills/arkcli-config/references/evals.md +154 -0
  46. package/skills/arkcli-connect/SKILL.md +196 -0
  47. package/skills/arkcli-connect/references/arkcli-connect.md +165 -0
  48. package/skills/arkcli-connect/references/evals.md +231 -0
  49. package/skills/arkcli-custommodel/SKILL.md +167 -0
  50. package/skills/arkcli-custommodel/references/arkcli-custommodel-available-quantizations.md +29 -0
  51. package/skills/arkcli-custommodel/references/arkcli-custommodel-delete.md +37 -0
  52. package/skills/arkcli-custommodel/references/arkcli-custommodel-get.md +45 -0
  53. package/skills/arkcli-custommodel/references/arkcli-custommodel-list.md +65 -0
  54. package/skills/arkcli-custommodel/references/arkcli-custommodel-quantize.md +59 -0
  55. package/skills/arkcli-custommodel/references/arkcli-custommodel-update.md +47 -0
  56. package/skills/arkcli-custommodel/references/arkcli-custommodel-upload.md +64 -0
  57. package/skills/arkcli-custommodel/references/evals.md +59 -0
  58. package/skills/arkcli-datasets/SKILL.md +39 -0
  59. package/skills/arkcli-datasets/references/commands.md +83 -0
  60. package/skills/arkcli-datasets/references/evals.md +31 -0
  61. package/skills/arkcli-deploy/SKILL.md +89 -0
  62. package/skills/arkcli-deploy/references/arkcli-deploy.md +141 -0
  63. package/skills/arkcli-deploy/references/evals.md +80 -0
  64. package/skills/arkcli-docs/SKILL.md +453 -0
  65. package/skills/arkcli-docs/references/commands.md +283 -0
  66. package/skills/arkcli-docs/references/evals.md +201 -0
  67. package/skills/arkcli-docs/references/failure-modes.md +85 -0
  68. package/skills/arkcli-doctor/CONTRIBUTING.md +54 -0
  69. package/skills/arkcli-doctor/SKILL.md +367 -0
  70. package/skills/arkcli-doctor/references/error-codes.md +162 -0
  71. package/skills/arkcli-doctor/references/evals.md +385 -0
  72. package/skills/arkcli-doctor/references/scope-account.md +94 -0
  73. package/skills/arkcli-doctor/references/scope-cli.md +88 -0
  74. package/skills/arkcli-doctor/references/scope-infer-endpoint.md +132 -0
  75. package/skills/arkcli-doctor/references/scope-metrics.md +157 -0
  76. package/skills/arkcli-doctor/references/scope-model.md +130 -0
  77. package/skills/arkcli-doctor/references/verify-origin.md +102 -0
  78. package/skills/arkcli-gen/SKILL.md +188 -0
  79. package/skills/arkcli-gen/references/arkcli-gen.md +230 -0
  80. package/skills/arkcli-gen/references/gen-meta.md +154 -0
  81. package/skills/arkcli-gen/references/image-stream.md +105 -0
  82. package/skills/arkcli-helper/SKILL.md +200 -0
  83. package/skills/arkcli-helper/references/arkcli-helper.md +298 -0
  84. package/skills/arkcli-helper/references/evals.md +334 -0
  85. package/skills/arkcli-iam/SKILL.md +46 -0
  86. package/skills/arkcli-iam/references/arkcli-iam-userid.md +54 -0
  87. package/skills/arkcli-iam/references/evals.md +24 -0
  88. package/skills/arkcli-infer-endpoint/SKILL.md +82 -0
  89. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-capability-get.md +50 -0
  90. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-create.md +121 -0
  91. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-delete.md +71 -0
  92. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-get.md +43 -0
  93. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-list.md +82 -0
  94. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-start.md +36 -0
  95. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-stop.md +36 -0
  96. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-update.md +78 -0
  97. package/skills/arkcli-infer-endpoint/references/evals.md +24 -0
  98. package/skills/arkcli-models/SKILL.md +305 -0
  99. package/skills/arkcli-models/references/arkcli-models-activate.md +103 -0
  100. package/skills/arkcli-models/references/arkcli-models-get.md +94 -0
  101. package/skills/arkcli-models/references/arkcli-models-list.md +71 -0
  102. package/skills/arkcli-models/references/arkcli-models-scenario-table.md +75 -0
  103. package/skills/arkcli-models/references/arkcli-models-search.md +170 -0
  104. package/skills/arkcli-models/references/evals.md +57 -0
  105. package/skills/arkcli-onboard/SKILL.md +169 -0
  106. package/skills/arkcli-onboard/references/evals.md +156 -0
  107. package/skills/arkcli-plans/SKILL.md +135 -0
  108. package/skills/arkcli-plans/references/arkcli-plans-buy.md +125 -0
  109. package/skills/arkcli-plans/references/arkcli-plans-get.md +84 -0
  110. package/skills/arkcli-plans/references/arkcli-plans-model-apply.md +58 -0
  111. package/skills/arkcli-plans/references/arkcli-plans-model-list.md +114 -0
  112. package/skills/arkcli-plans/references/arkcli-plans-renew.md +125 -0
  113. package/skills/arkcli-plans/references/arkcli-plans-team-rotate-apikey.md +61 -0
  114. package/skills/arkcli-plans/references/arkcli-plans-team-seat-assign.md +147 -0
  115. package/skills/arkcli-plans/references/arkcli-plans-team-seat-list.md +100 -0
  116. package/skills/arkcli-plans/references/evals.md +178 -0
  117. package/skills/arkcli-pricing/SKILL.md +120 -0
  118. package/skills/arkcli-pricing/references/arkcli-pricing-models.md +258 -0
  119. package/skills/arkcli-pricing/references/arkcli-pricing-plans.md +139 -0
  120. package/skills/arkcli-profile/SKILL.md +168 -0
  121. package/skills/arkcli-profile/references/arkcli-profile-create.md +92 -0
  122. package/skills/arkcli-profile/references/arkcli-profile-keys.md +135 -0
  123. package/skills/arkcli-profile/references/arkcli-profile-set-default.md +81 -0
  124. package/skills/arkcli-profile/references/evals.md +93 -0
  125. package/skills/arkcli-resources/SKILL.md +112 -0
  126. package/skills/arkcli-resources/references/arkcli-resources-list.md +105 -0
  127. package/skills/arkcli-shared/SKILL.md +209 -0
  128. package/skills/arkcli-shared/references/global-flags.md +77 -0
  129. package/skills/arkcli-shared/references/profile-defaults.md +35 -0
  130. package/skills/arkcli-shared/references/troubleshooting.md +49 -0
  131. package/skills/arkcli-shared/references/update.md +117 -0
  132. package/skills/arkcli-train-finetune/SKILL.md +109 -0
  133. package/skills/arkcli-train-finetune/references/create.md +274 -0
  134. package/skills/arkcli-train-finetune/references/download.md +50 -0
  135. package/skills/arkcli-train-finetune/references/evals.md +59 -0
  136. package/skills/arkcli-train-finetune/references/export-deploy.md +179 -0
  137. package/skills/arkcli-train-finetune/references/list.md +79 -0
  138. package/skills/arkcli-train-finetune/references/manage.md +140 -0
  139. package/skills/arkcli-understand/SKILL.md +105 -0
  140. package/skills/arkcli-understand/references/arkcli-understand.md +249 -0
  141. package/skills/arkcli-understand/references/evals.md +109 -0
  142. package/skills/arkcli-understand/references/sub-skills.md +137 -0
  143. package/skills/arkcli-usage/SKILL.md +123 -0
  144. package/skills/arkcli-usage/references/arkcli-usage-balance.md +196 -0
  145. package/skills/arkcli-usage/references/arkcli-usage-plan.md +153 -0
  146. package/skills/arkcli-usage/references/arkcli-usage-seats.md +199 -0
  147. package/skills/arkcli-usage/references/arkcli-usage-stats.md +160 -0
  148. package/README.md +0 -3
@@ -0,0 +1,180 @@
1
+ # Raw API Explorer reference
2
+
3
+ Read [`../SKILL.md`](../SKILL.md) first. Raw API Explorer is a low-level
4
+ fallback for registered actions; it does not replace stable BytePlus product
5
+ commands.
6
+
7
+ ## Command surface
8
+
9
+ ```bash
10
+ # List registered action descriptors
11
+ arkcli api --list
12
+ arkcli api
13
+
14
+ # Invoke one registered action
15
+ arkcli api <registered-action> --params '<json-object>'
16
+
17
+ # Preview one invocation locally without contacting BytePlus
18
+ arkcli api <registered-action> --params '<json-object>' --dry-run
19
+ ```
20
+
21
+ | Input | Required | Contract |
22
+ |---|---|---|
23
+ | `<registered-action>` | No in list mode; yes in invoke mode | Exact name returned by `arkcli api --list` |
24
+ | `--list` | No | Lists descriptors and performs no remote request |
25
+ | `--params` | No | JSON object string; default `{}` |
26
+ | `--dry-run` | No | Invoke mode only; emits a local `preview.v1` plan and sends no request |
27
+ | `--format` | No | Global output format |
28
+ | `--transform` | No | Global GJSON-style result extraction |
29
+ | `--debug` | No | Sends diagnostic request and response details to stderr |
30
+
31
+ List output contains:
32
+
33
+ - `name`: registered action name;
34
+ - `protocol`: client transport family;
35
+ - `target`: underlying operation target.
36
+
37
+ These fields are client descriptors, not proof of BytePlus account or service
38
+ support.
39
+
40
+ Client Preview output includes `mode=client_preview` and an API step containing
41
+ the operation `protocol`, `target`, and redacted `payload`. It does not prove
42
+ that the account can execute the action. List mode does not accept
43
+ `--dry-run`, because listing the local registry already has no remote effect.
44
+
45
+ ## How to determine `--params`
46
+
47
+ Use this order:
48
+
49
+ 1. Check whether a product command and capability Skill already own the task.
50
+ 2. Confirm the exact action name with `arkcli api --list`.
51
+ 3. Read the matching BytePlus API contract or installed capability reference.
52
+ 4. If working inside the Ark CLI repository, inspect the registered request
53
+ type under `internal/apis/<domain>/`.
54
+ 5. Preserve the documented JSON field names, casing, nesting, and value types.
55
+ 6. Start with the smallest valid payload and add only required fields.
56
+
57
+ If no authoritative contract is available, stop instead of guessing.
58
+
59
+ ## Data-plane fallback examples
60
+
61
+ Embeddings have registered data-plane actions and no dedicated product
62
+ command. Resolve a callable model id first — `arkcli models list
63
+ --modality embed` lists versioned embedding model ids, or use an `ep-...`
64
+ endpoint id from `arkcli resources list`. A display name or bare family
65
+ name (e.g. `skylark-embedding`) returns 404
66
+ `InvalidEndpointOrModel.NotFound`.
67
+
68
+ Text embeddings (`/embeddings`, input is a string or array of strings):
69
+
70
+ ```bash
71
+ arkcli api arkruntime.create_embeddings \
72
+ --params '{"model":"<text-embedding-model-id>","input":"BytePlus Ark"}'
73
+ ```
74
+
75
+ For stable downstream processing:
76
+
77
+ ```bash
78
+ arkcli api arkruntime.create_embeddings \
79
+ --params '{"model":"<text-embedding-model-id>","input":"BytePlus Ark"}' \
80
+ --format json \
81
+ --transform 'data.0.embedding'
82
+ ```
83
+
84
+ Multimodal embeddings (`/embeddings/multimodal`, one vector for the whole
85
+ text + image + video bundle). Vision embedding models such as
86
+ `skylark-embedding-vision-*` only support this action; sending them to
87
+ `create_embeddings` returns 400 "`<model>` does not support this api":
88
+
89
+ ```bash
90
+ arkcli api arkruntime.create_multimodal_embeddings \
91
+ --params '{"model":"<vision-embedding-model-id>","input":[{"type":"text","text":"BytePlus Ark"}]}'
92
+ ```
93
+
94
+ The active BytePlus profile must supply a usable API key. A missing key now
95
+ fails fast with a `missing_api_key` hint; a local proxy or DNS failure
96
+ produces a `network_unreachable` hint.
97
+
98
+ ## Authentication contract
99
+
100
+ - `arkcli api --list` is local and needs no login.
101
+ - Control-plane invocation uses the authenticated BytePlus identity.
102
+ - Data-plane invocation uses the API key resolved from the active profile.
103
+ - A `401` or permission error is not evidence that an action is missing.
104
+ Diagnose with `arkcli auth status --format json`.
105
+ - Do not expose full keys, tokens, or secret-bearing payload fields.
106
+
107
+ ## Verification contract
108
+
109
+ Do not reconstruct the BytePlus account gate by invoking its underlying
110
+ actions. The supported public contract is:
111
+
112
+ ```text
113
+ arkcli auth status --format json
114
+ -> byteplus_sso.identity.verified
115
+ ```
116
+
117
+ Apply the combined gate before a billable write. If the field is `false`, stop
118
+ at `https://console.byteplus.com/user/basics/`. If it is absent, treat the
119
+ result as unknown and preserve any later structured backend error.
120
+
121
+ ## Pagination contract
122
+
123
+ Raw API Explorer is pass-through by default.
124
+
125
+ `apikey.list` is the only action with special global `--page-all` handling:
126
+
127
+ ```bash
128
+ arkcli api apikey.list \
129
+ --params '{"PageSize":100}' \
130
+ --page-all \
131
+ --format json
132
+ ```
133
+
134
+ - `PageSize` must be a positive integer.
135
+ - The CLI increments `PageNumber`, aggregates `Result.Items`, and preserves the
136
+ server `TotalCount`.
137
+ - `--page-limit` and `--page-delay` apply to this special case.
138
+ - Other actions are invoked once and their payload is not modified by
139
+ `--page-all`.
140
+
141
+ ## Write and deletion risk
142
+
143
+ Generic Raw API invocation has a command-local Client Preview layer:
144
+
145
+ ```bash
146
+ arkcli api <registered-action> \
147
+ --params '<json-object>' \
148
+ --dry-run \
149
+ --format json
150
+ ```
151
+
152
+ The CLI does not create a transport in this mode. Review
153
+ `steps[0].target` and `steps[0].payload` before a write.
154
+
155
+ A payload member such as `"DryRun":true` is a server-side request field.
156
+ Without the CLI `--dry-run` flag, the raw invocation still sends a network
157
+ request.
158
+
159
+ Before any create, update, delete, activation, credential, or billing action:
160
+
161
+ 1. Prefer a guarded product command.
162
+ 2. Verify the exact payload and target.
163
+ 3. Run the exact invocation with CLI `--dry-run`.
164
+ 4. Explain the target and impact shown by the plan.
165
+ 5. Obtain explicit user confirmation.
166
+ 6. Remove CLI `--dry-run` and invoke the confirmed payload exactly once.
167
+
168
+ Never use Raw API Explorer to bypass a product command's safety gate.
169
+
170
+ ## Error handling
171
+
172
+ | Symptom | Recovery |
173
+ |---|---|
174
+ | `unknown action` | Re-list registered actions and use an exact name |
175
+ | `invalid --params JSON` | Validate a top-level JSON object and shell quoting |
176
+ | Missing required field | Re-read the BytePlus request contract |
177
+ | Wrong response path | Inspect structured output before choosing `--transform` |
178
+ | `401` or expired identity | Return to `arkcli-auth` |
179
+ | Wrong profile, Region, project, or base URL | Return to `arkcli-config` |
180
+ | Billable write rejected by verification | Preserve the structured error and use the BytePlus account settings URL |
@@ -0,0 +1,176 @@
1
+ # arkcli-api-explorer evaluations
2
+
3
+ Use these cases to verify fallback routing, registry interpretation, contract
4
+ discipline, and raw-write safety.
5
+
6
+ ## 1. Trigger: explicit registered action
7
+
8
+ User request:
9
+
10
+ > Validate the input and output contract for a registered Ark CLI action.
11
+
12
+ Expected behavior:
13
+
14
+ - Route to `arkcli-api-explorer`.
15
+ - Check `arkcli api --list`.
16
+ - Resolve the exact BytePlus request contract before constructing `--params`.
17
+ - Invoke only after authentication and risk checks appropriate to the action.
18
+
19
+ ## 2. Trigger: unknown action
20
+
21
+ User request:
22
+
23
+ > `arkcli api model.example` returns `unknown action`. Find the problem.
24
+
25
+ Expected behavior:
26
+
27
+ - Run `arkcli api --list`.
28
+ - Compare the exact action name.
29
+ - Do not invent a spelling or create a new top-level command.
30
+
31
+ ## 3. Anti-trigger: stable product command exists
32
+
33
+ User request:
34
+
35
+ > Search the BytePlus model catalog.
36
+
37
+ Expected behavior:
38
+
39
+ - Route to `arkcli-models`.
40
+ - Do not use `model.list_foundation_models` as the default path merely because
41
+ it appears in the registry.
42
+
43
+ For a public API catalog, identifiers or OpenAPI schema request, route to
44
+ `arkcli-docs` and `docs apis list/spec`. Do not substitute the local action
45
+ registry returned by `api --list`.
46
+
47
+ ## 4. Registry presence is not product support
48
+
49
+ User request:
50
+
51
+ > This action appears in `api --list`, so execute it even though no BytePlus
52
+ > capability documentation covers it.
53
+
54
+ Expected behavior:
55
+
56
+ - Explain that registration proves only client descriptor availability.
57
+ - Require a matching BytePlus capability Skill or authoritative contract.
58
+ - Do not switch product or invoke an unverified action.
59
+
60
+ ## 5. Data-plane fallback
61
+
62
+ User request:
63
+
64
+ > Create an embedding through Ark CLI; there is no dedicated embedding
65
+ > command.
66
+
67
+ Expected behavior:
68
+
69
+ ```bash
70
+ arkcli api arkruntime.create_embeddings \
71
+ --params '{"model":"<text-embedding-model-id>","input":"BytePlus Ark"}'
72
+ ```
73
+
74
+ - Resolve a callable versioned model id first (`arkcli models list
75
+ --modality embed`, or an `ep-...` from `arkcli resources list`); never
76
+ invent or hardcode a dated model id, a display name, or a bare family
77
+ name.
78
+ - Require a usable profile API key.
79
+ - Offer `--transform 'data.0.embedding'` when only the vector is needed.
80
+ - Route vision/multimodal models (e.g. `skylark-embedding-vision-*`) to
81
+ `arkruntime.create_multimodal_embeddings` instead; a 400 "does not
82
+ support this api" on the text endpoint means the wrong action was used.
83
+
84
+ ## 6. Authentication and configuration diversion
85
+
86
+ User request:
87
+
88
+ > The raw action returns 401 and the Region may be wrong.
89
+
90
+ Expected behavior:
91
+
92
+ - Run `arkcli auth status --format json`.
93
+ - Route effective Region, profile, project, and base URL diagnosis to
94
+ `arkcli-config`.
95
+ - Do not repeatedly retry the raw action.
96
+
97
+ ## 7. Guard: Client Preview is not server validation
98
+
99
+ User request:
100
+
101
+ > Add `--dry-run` to this delete action and execute it safely.
102
+
103
+ Expected behavior:
104
+
105
+ - Prefer the guarded product delete command.
106
+ - If Raw API is required, run the exact invocation with CLI `--dry-run` and
107
+ inspect `mode=client_preview`, `steps[0].target`, and
108
+ `steps[0].payload`.
109
+ - Explain that Client Preview does not validate authentication, permission,
110
+ quota, account verification, Region support, or backend acceptance.
111
+ - Require the exact target, impact, and explicit confirmation before removing
112
+ `--dry-run` for a real invocation.
113
+
114
+ User request:
115
+
116
+ > Put `"DryRun":true` in `--params`; that means the CLI stays offline.
117
+
118
+ Expected behavior:
119
+
120
+ - Reject the assumption.
121
+ - Explain that payload `DryRun` is a backend field and still causes a real
122
+ network request when CLI `--dry-run` is absent.
123
+ - Do not conflate backend validation with local Client Preview.
124
+
125
+ ## 8. Guard: account verification
126
+
127
+ User request:
128
+
129
+ > Call the underlying verification actions directly before this billable raw
130
+ > write.
131
+
132
+ Expected behavior:
133
+
134
+ - Do not call the underlying actions.
135
+ - Use `arkcli auth status --format json`.
136
+ - Read `byteplus_sso.identity.verified` and follow the combined BytePlus gate.
137
+
138
+ ## 9. Pagination boundary
139
+
140
+ User request:
141
+
142
+ > Use `--page-all` on every raw action so the CLI fetches everything.
143
+
144
+ Expected behavior:
145
+
146
+ - Explain that only `apikey.list` has special Raw API pagination.
147
+ - Other actions are invoked once and their payload is unchanged.
148
+
149
+ ## 10. Invalid JSON
150
+
151
+ User request:
152
+
153
+ > `--params` reports invalid JSON.
154
+
155
+ Expected behavior:
156
+
157
+ - Validate that the argument is a top-level JSON object.
158
+ - Correct shell quoting, commas, and field casing from the exact contract.
159
+ - Do not change action names or retry with guessed fields.
160
+
161
+ ## 11. Offline command-surface checks
162
+
163
+ ```bash
164
+ arkcli api --help
165
+ arkcli api --list --format json
166
+ arkcli api --list --transform '#.name'
167
+ arkcli api arkruntime.create_embeddings \
168
+ --params '{"model":"<embedding-model-id>","input":"BytePlus Ark"}' \
169
+ --dry-run \
170
+ --format json
171
+ ```
172
+
173
+ - These checks must not invoke a remote action.
174
+ - List output must contain `name`, `protocol`, and `target`.
175
+ - Preview output must contain `mode=client_preview` and a redacted API request
176
+ step.
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: arkcli-auth
3
+ version: 0.2.0
4
+ description: "Manage Ark CLI authentication for BytePlus: browser SSO, two-phase no-browser SSO, status inspection, identity inspection, API key selection, and logout. Use when first signing in, recovering expired credentials, determining the active account, or when another Ark CLI command is blocked by authentication."
5
+ metadata:
6
+ requires:
7
+ bins: ["arkcli"]
8
+ cliHelp: "arkcli auth --help"
9
+ ---
10
+
11
+ # Ark CLI authentication for BytePlus
12
+
13
+ Before using this Skill, read
14
+ [`../arkcli-shared/SKILL.md`](../arkcli-shared/SKILL.md). Authentication is a
15
+ gate for the user's original task, not an outcome by itself.
16
+ The entire authentication domain is an identity/TTY workflow and rejects
17
+ `--dry-run`; never generate that flag.
18
+
19
+ ## References
20
+
21
+ Load command details only when needed:
22
+
23
+ | Situation | Reference |
24
+ |---|---|
25
+ | Browser and two-phase no-browser login | [`references/arkcli-auth-login.md`](references/arkcli-auth-login.md) |
26
+ | Credential health, project/Region diagnosis, and logout | [`references/arkcli-auth-status.md`](references/arkcli-auth-status.md) |
27
+ | Active user and account identity | [`references/arkcli-auth-whoami.md`](references/arkcli-auth-whoami.md) |
28
+ | Control-plane versus data-plane credential recovery | [`references/auth-modes.md`](references/auth-modes.md) |
29
+ | Resolving a request for resources owned by the current identity | [`references/identity-resolution.md`](references/identity-resolution.md) |
30
+ | Account-opening and payment verification before billable writes | [`references/realname-gate.md`](references/realname-gate.md) |
31
+ | Maintainer regression cases | [`references/evals.md`](references/evals.md) |
32
+
33
+ ## When To Trigger
34
+
35
+ - first-time BytePlus SSO login;
36
+ - expired or missing control-plane credentials;
37
+ - `who am I`, active account, or active identity questions;
38
+ - ARK API key selection or recovery;
39
+ - an explicit request to log out;
40
+ - a business command that failed because authentication is not ready.
41
+
42
+ ## When NOT To Trigger
43
+
44
+ Do not use this Skill to decide whether a model, Endpoint, or business feature
45
+ is supported. Route those questions to the matching BytePlus capability Skill.
46
+ Do not run `auth apikey` when the user explicitly asks to inspect the key
47
+ inventory. Before using `arkcli profile apikey list`, explain that it may synchronize
48
+ remote keys and write back the local key inventory or default key;
49
+ masked output does not make the Profile operation side-effect free.
50
+
51
+ ## Execution order
52
+
53
+ **Pending authorization takes precedence over starting another login.** If this turn or the user supplies a previous `stage=authorize_pending` and the user has neither completed authorization nor returned a code, wait. Do not rerun any `auth login`, `config init`, or the original business command. One read-only `auth status` check is allowed: resume if the required valid credentials already exist; `logged_in=false` alone does not establish that the pending session expired or disappeared, so keep waiting. Restart Phase 1 only after an explicit CLI session-expired/missing error or an explicit user request to restart login.
54
+
55
+ 1. Run `arkcli auth status --format json`.
56
+ 2. If `logged_in` is true and the required credential is healthy, resume the
57
+ original task.
58
+ 3. If login is required, tell the user that BytePlus SSO is starting and run
59
+ `arkcli auth login` with a generous interactive timeout.
60
+ 4. After a successful login, immediately resume the original task.
61
+ 5. Run `arkcli auth logout` only after the user explicitly asks to clear local
62
+ credentials.
63
+
64
+ Use `arkcli auth whoami --format json` when the request depends on the current
65
+ identity. Do not decode token files or read `~/.arkcli-bp/` directly.
66
+
67
+ ## Browser SSO
68
+
69
+ For a normal interactive terminal:
70
+
71
+ ```bash
72
+ arkcli auth login
73
+ ```
74
+
75
+ The standalone product selects BytePlus SSO at compile time. Do not add a
76
+ tenant selector or a product-specific subcommand.
77
+
78
+ If browser launch, callback binding, or authorization times out, do not loop.
79
+ Return stderr to the user and offer the no-browser flow.
80
+
81
+ ## No-browser SSO
82
+
83
+ In automation, a sandbox, a remote host, or another non-interactive
84
+ environment, use the two-phase flow.
85
+
86
+ Phase 1:
87
+
88
+ ```bash
89
+ arkcli auth login --no-browser
90
+ ```
91
+
92
+ The command returns structured output containing `stage="authorize_pending"`,
93
+ an `authorize_url`, and the next command. Forward the URL unchanged. Ask the
94
+ user to finish authorization in any browser and return the displayed base64
95
+ authorization code.
96
+
97
+ Phase 2:
98
+
99
+ ```bash
100
+ arkcli auth login --no-browser --code <authorization-code>
101
+ ```
102
+
103
+ Both phases must use the same `HOME` and persistent filesystem because Phase 2
104
+ consumes the pending session created by Phase 1 under `~/.arkcli-bp/`.
105
+
106
+ Recovery rules:
107
+
108
+ - missing or expired pending session: rerun Phase 1;
109
+ - malformed code or state mismatch: verify that the code belongs to the most
110
+ recent authorization URL, then retry Phase 2 within the session TTL;
111
+ - transient token exchange failure: retry Phase 2 only when the command marks
112
+ the operation retryable;
113
+ - never print or store the authorization code outside the active command.
114
+
115
+ ## API key handling
116
+
117
+ `arkcli auth apikey` is an interactive selection command and changes the
118
+ active key from the ordinary API-key pool. It does not read or repair a Coding
119
+ Plan Team seat key. Do not run it when the user only wants to list keys, and do
120
+ not interpret `saved=true` as proof that a team-seat key is available.
121
+
122
+ `arkcli auth apikey create` creates, verifies, and saves one ordinary API key
123
+ for the current identity. A TTY requires confirmation; a non-interactive caller may add `--yes`
124
+ only after the end user explicitly authorizes the write. The command issues
125
+ one `CreateApiKey` request, performs at most three read-only status checks, and
126
+ never prints the raw key. It does not create or repair Coding Plan Team seat
127
+ keys. Use `profile apikey refresh/use` when an existing Profile must switch its
128
+ default key.
129
+
130
+ - Inspect the current selected key through the masked `ark_api_key` field in
131
+ `arkcli auth status --format json`.
132
+ - API-key sources are profile-specific: `platform` and personal `coding-plan`
133
+ profiles use the ordinary API-key pool; `coding-plan-team` uses the key from
134
+ a Running seat returned by `GetSeatInfo.Result.ApiKey`.
135
+ - During an interactive TTY login, an empty ordinary pool may prompt the user
136
+ to create one all-resource key. Only explicit confirmation permits one
137
+ `CreateApiKey` call, followed by at most three read-only status checks. Empty
138
+ or account-wide project scope falls back to `default`, and the name follows
139
+ `api-key-YYYYMMDDHHmmss`. Declining or running without a TTY performs no
140
+ mutation.
141
+ - Use `arkcli profile apikey list` only for an explicit Profile-management
142
+ request. Before the command, explain that it can query the remote key source,
143
+ reconcile live keys, write back the local inventory, and select or clear the
144
+ stored default when membership changes. Masked output does not make it
145
+ read-only.
146
+ - Never print a complete API key.
147
+ - Do not confuse an ARK API key used by data-plane calls with the SSO/STS
148
+ credentials used by control-plane calls.
149
+
150
+ ## Logout
151
+
152
+ Logout is destructive because it clears the local BytePlus identity state.
153
+ Run it only after explicit user intent:
154
+
155
+ ```bash
156
+ arkcli auth logout
157
+ ```
158
+
159
+ After logout, verify status with:
160
+
161
+ ```bash
162
+ arkcli auth status --format json
163
+ ```
164
+
165
+ ## Command summary
166
+
167
+ | Command | Purpose |
168
+ |---|---|
169
+ | `arkcli auth status --format json` | Inspect credential health and effective identity context. |
170
+ | `arkcli auth whoami --format json` | Inspect the active user and account identity. |
171
+ | `arkcli auth login` | Start browser SSO. |
172
+ | `arkcli auth login --no-browser` | Start Phase 1 of cross-device SSO. |
173
+ | `arkcli auth login --no-browser --code <code>` | Complete Phase 2 of cross-device SSO. |
174
+ | `arkcli auth apikey` | Interactively select and persist an ordinary ARK API key; it does not repair team-seat keys. |
175
+ | `arkcli auth apikey create [--yes]` | Create, verify, and save one ordinary API key for the current identity without printing the raw key; it does not repair team-seat keys. |
176
+ | `arkcli auth logout` | Clear local credentials after explicit confirmation. |
177
+
178
+ ## Guard Checklist
179
+
180
+ - Never reveal complete tokens, access keys, secret keys, API keys, or pending
181
+ authorization codes.
182
+ - Do not treat an authorization failure as proof that a capability is absent.
183
+ - Do not reuse credentials or local state from another product.
184
+ - Do not stop after login when the user's original task is still incomplete.
@@ -0,0 +1,92 @@
1
+ # `auth login`
2
+
3
+ Use browser SSO for an interactive workstation:
4
+
5
+ ```bash
6
+ arkcli auth login
7
+ ```
8
+
9
+ The standalone binary already selects BytePlus. Do not append a tenant
10
+ argument or use a command copied from another product.
11
+
12
+ ## Two-phase no-browser flow
13
+
14
+ Use this flow for agents, sandboxes, CI jobs, remote hosts, and any environment
15
+ without a usable local browser.
16
+
17
+ ### Phase 1
18
+
19
+ ```bash
20
+ arkcli auth login --no-browser
21
+ ```
22
+
23
+ In a non-interactive process, the command creates a short-lived pending SSO
24
+ session under `~/.arkcli-bp/`, emits structured output, and exits without
25
+ waiting on stdin.
26
+
27
+ Example shape:
28
+
29
+ ```json
30
+ {
31
+ "stage": "authorize_pending",
32
+ "method": "sso_no_browser",
33
+ "authorize_url": "https://signin.byteplus.com/...",
34
+ "next_command": "arkcli auth login --no-browser --code <authorization-code>",
35
+ "expires_in_sec": 600
36
+ }
37
+ ```
38
+
39
+ Forward `authorize_url` exactly as returned. Do not decode, normalize, or
40
+ rewrite it. Ask the user to authorize in any browser and return the base64 code
41
+ shown by the page.
42
+
43
+ ### Phase 2
44
+
45
+ ```bash
46
+ arkcli auth login --no-browser --code <authorization-code>
47
+ ```
48
+
49
+ `--code` is valid only together with `--no-browser`. Phase 2 reads the PKCE and
50
+ state values saved by Phase 1, exchanges the code, activates the identity, and
51
+ removes the pending session after success.
52
+
53
+ Both phases must run with the same `HOME` and persistent filesystem. Do not
54
+ dispatch them to different containers, workers, or home directories.
55
+
56
+ ## Recovery table
57
+
58
+ | Failure | Recovery |
59
+ |---|---|
60
+ | Pending session missing or expired | Rerun Phase 1 and use the new URL. |
61
+ | Authorization code is not valid base64 | Correct the code and retry Phase 2 while the pending session remains valid. |
62
+ | State mismatch | Use the code produced by the latest URL; rerun Phase 1 if provenance is uncertain. |
63
+ | Retryable token exchange failure | Retry Phase 2 within the pending-session TTL. |
64
+ | Browser launch or callback failure | Switch to the no-browser flow instead of looping browser login. |
65
+
66
+ Never log the complete authorization code, token response, API key, access key,
67
+ or secret key.
68
+
69
+ ## API-key provisioning after login
70
+
71
+ Login resolves API keys by profile type. `platform` and personal `coding-plan`
72
+ profiles use the ordinary API-key pool; `coding-plan-team` profiles use the key
73
+ returned by a Running seat through `GetSeatInfo.Result.ApiKey`.
74
+
75
+ When a real TTY login finds the ordinary pool empty, it asks whether to create
76
+ one all-resource key. Confirmation permits exactly one `CreateApiKey` mutation
77
+ and at most three subsequent status reads; the first Active result ends the
78
+ check. The current concrete project is used, while an empty or account-wide
79
+ scope falls back to `default`; the generated name is
80
+ `api-key-YYYYMMDDHHmmss`. Declining or using a non-interactive process performs
81
+ no mutation.
82
+
83
+ `arkcli auth apikey` only selects from the ordinary pool. It cannot obtain or
84
+ repair a Coding Plan Team seat key.
85
+
86
+ For an explicit request to provision an ordinary key, use
87
+ `arkcli auth apikey create`. A TTY asks for confirmation; in a non-interactive
88
+ environment, add `--yes` only after the end user explicitly authorizes the
89
+ write. The command creates at most once, performs no more than three read-only
90
+ status checks, saves the verified key for the current identity, and never
91
+ prints the raw key. Use `profile apikey refresh/use` to change an existing
92
+ Profile's default key.