Skip to content

Commit a99f61b

Browse files
feat(api): add v2 resource management endpoints (#6900)
* feat(api): add v2 resource management endpoints * fix(cli): gate destructive v2 commands * fix(test): update v2 request-slice count * feat(cli): add shared workspace profiles
1 parent 8529069 commit a99f61b

59 files changed

Lines changed: 8784 additions & 1545 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/content/docs/en/cli/authentication.mdx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ sim workflows list --workspace ws_other
5353
`sim login --workspace <id>` preselects a workspace in the picker, and
5454
re-logging into an existing profile preselects the one already configured.
5555

56+
To save another workspace without minting or copying another personal key, add
57+
a workspace profile:
58+
59+
```bash
60+
sim workspaces list
61+
sim profile add acme --workspace ws_acme
62+
sim --profile acme whoami
63+
```
64+
65+
The new profile stores `auth_profile = default` and its own workspace. Omit
66+
`--workspace` in an interactive terminal to choose from the workspaces the
67+
active key can access; scripts must provide the workspace ID explicitly. The
68+
picker is capped at 1,000 entries and asks for an explicit ID above that.
69+
5670
## Checking who you are
5771

5872
```bash
@@ -76,6 +90,12 @@ sim logout # remove the stored key
7690
sim logout --all # remove the profile entirely, including its settings
7791
```
7892

93+
A workspace profile that shares authentication cannot remove the shared key.
94+
Remove only that local profile with `sim logout --all --profile <name>`, or log
95+
out of the authentication profile named by the error message. Removing an
96+
authentication profile entirely is refused until its workspace profiles are
97+
removed, so it cannot leave dangling references.
98+
7999
<Callout type="warn">
80100
`sim logout` removes the key from disk but does **not** revoke it. Revoke keys in
81101
Sim under **Settings → API keys**.
@@ -116,9 +136,9 @@ jobs:
116136
SIM_WORKSPACE: ${{ vars.SIM_WORKSPACE }}
117137
```
118138
119-
## Several accounts at once
139+
## Several accounts and workspaces
120140
121-
Each profile holds one identity and one set of defaults:
141+
Use separate logins for separate identities or deployments:
122142
123143
```bash
124144
sim login --profile dev --endpoint http://localhost:3000
@@ -128,6 +148,16 @@ sim workflows list --profile dev
128148
sim workflows list --profile prod
129149
```
130150

151+
Use workspace profiles when one personal key should target several workspaces:
152+
153+
```bash
154+
sim profile add marketing --workspace ws_marketing
155+
sim profile add support --workspace ws_support
156+
157+
sim workflows list --profile marketing
158+
sim workflows list --profile support
159+
```
160+
131161
See [Configuration](/cli/configuration) for how profiles are stored and resolved.
132162

133163
## Self-hosted and non-production deployments

apps/docs/content/docs/en/cli/commands.mdx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ These apply to every command, and may be written before or after it.
3030

3131
| Group | Description |
3232
| --- | --- |
33+
| [`sim profiles`](/cli/profiles) | List profiles or add a workspace profile that shares a stored login |
3334
| [`sim audit-logs`](/cli/audit-logs) | Manage audit logs |
3435
| [`sim billing`](/cli/billing) | Manage billing |
3536
| [`sim credentials`](/cli/credentials) | Manage credentials |
@@ -94,14 +95,6 @@ sim whoami [options]
9495

9596
</CommandTable>
9697

97-
## List the profiles defined in the config and credentials files
98-
99-
```bash
100-
sim profiles
101-
```
102-
103-
Also available as `sim profile`.
104-
10598
## Set a profile's endpoint, default workspace, or output format
10699

107100
```bash

apps/docs/content/docs/en/cli/configuration.mdx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ for a single command.
99

1010
## Profiles
1111

12-
A profile is one identity plus one set of defaults, in the style of the AWS CLI.
13-
Select one with `-P`, `--profile`, or `SIM_PROFILE`:
12+
A profile selects one set of defaults, in the style of the AWS CLI. It normally
13+
uses its same-named stored identity, but a workspace profile can share another
14+
profile's identity through `auth_profile`. Select one with `-P`, `--profile`, or
15+
`SIM_PROFILE`:
1416

1517
```bash
1618
sim workflows list --profile dev
@@ -23,6 +25,12 @@ The profile is named `default` when you do not pick one.
2325
sim profiles # list them; * marks the active one
2426
```
2527

28+
Add a profile for another workspace without creating or copying an API key:
29+
30+
```bash
31+
sim profile add acme --workspace ws_acme
32+
```
33+
2634
## Setting defaults
2735

2836
```bash
@@ -51,7 +59,7 @@ Each setting resolves independently, and the first match wins:
5159
| --- | --- |
5260
| 1 | Command-line flag — `--endpoint`, `--workspace`, `--output` |
5361
| 2 | Environment — `SIM_ENDPOINT`, `SIM_API_KEY`, `SIM_WORKSPACE`, `SIM_OUTPUT` |
54-
| 3 | `~/.sim/config` and `~/.sim/credentials`, for the selected profile |
62+
| 3 | `~/.sim/config` for the selected profile and `~/.sim/credentials` for its `auth_profile`, when set |
5563
| 4 | Built-in default — `https://www.sim.ai` and `table` |
5664

5765
`sim whoami` prints the winning source for each setting:
@@ -74,6 +82,10 @@ output = table
7482
[profile dev]
7583
endpoint = http://localhost:3000
7684
workspace = ws_local
85+
86+
[profile acme]
87+
auth_profile = default
88+
workspace = ws_acme
7789
```
7890

7991
Keys live in `~/.sim/credentials`, written `0600`:
@@ -89,6 +101,10 @@ api_key = sim_…
89101
Section naming follows the AWS convention: `[profile dev]` in config, `[dev]` in
90102
credentials. The `default` profile is `[default]` in both.
91103

104+
`auth_profile` references one direct profile and shares only its endpoint and
105+
API key; workspace and output remain local. References cannot be chained, and a
106+
shared profile cannot also set its own endpoint or API key.
107+
92108
## Environment variables
93109

94110
| Variable | Effect |
@@ -121,6 +137,19 @@ sim configure --set-workspace ws_abc123
121137
export SIM_WORKSPACE=ws_abc123
122138
```
123139

140+
For a reusable selection, create a workspace profile backed by the current
141+
stored login:
142+
143+
```bash
144+
sim workspaces list
145+
sim profile add acme --workspace ws_acme
146+
sim --profile acme tables list
147+
```
148+
149+
When `--workspace` is omitted in a terminal, `profile add` presents an
150+
interactive picker, capped at 1,000 entries. It refuses environment-only keys
151+
and endpoint overrides because those values would disappear in another shell.
152+
124153
`sim billing status`, `sim billing logs`, and `sim audit-logs list` accept
125154
`--all-workspaces` to drop the filter instead. It cannot be combined with
126155
`--workspace`.

apps/docs/content/docs/en/cli/knowledge.mdx

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,196 @@ sim knowledge create [options]
213213

214214
</CommandTable>
215215

216+
## Create knowledge connector
217+
218+
```bash
219+
sim knowledge connectors create <id> [options]
220+
```
221+
222+
**Arguments**
223+
224+
<CommandTable>
225+
226+
| Argument | Required | Description |
227+
| --- | --- | --- |
228+
| `id` | Yes | Unique knowledge base identifier. |
229+
230+
</CommandTable>
231+
232+
**Options**
233+
234+
<CommandTable>
235+
236+
| Option | Required | Description |
237+
| --- | --- | --- |
238+
| `--connector-type <value>` | Yes | Registered connector type. |
239+
| `--credential-id <value>` | No | OAuth credential identifier for connectors that require OAuth. |
240+
| `--api-key <value>` | No | Write-only API key for connectors that use API-key authentication. |
241+
| `--source-config <json\|@file>` | Yes | Connector-specific source selection and filtering configuration. (JSON, or @path / @- to read a file or stdin). |
242+
| `--sync-interval-minutes <value>` | No | Scheduled synchronization interval in minutes; zero disables scheduling. |
243+
244+
</CommandTable>
245+
246+
## Delete knowledge connector
247+
248+
```bash
249+
sim knowledge connectors delete <id> <connectorId> [options]
250+
```
251+
252+
**Arguments**
253+
254+
<CommandTable>
255+
256+
| Argument | Required | Description |
257+
| --- | --- | --- |
258+
| `id` | Yes | Knowledge base that owns the connector. |
259+
| `connectorId` | Yes | Connector selected for the operation. |
260+
261+
</CommandTable>
262+
263+
**Options**
264+
265+
<CommandTable>
266+
267+
| Option | Required | Description |
268+
| --- | --- | --- |
269+
| `--delete-documents` | No | Also permanently delete documents produced by this connector. |
270+
| `--no-delete-documents` | No | Send --delete-documents as false. |
271+
| `-y, --yes` | Yes | Confirm this destructive operation. |
272+
273+
</CommandTable>
274+
275+
## Get knowledge connector
276+
277+
```bash
278+
sim knowledge connectors get <id> <connectorId>
279+
```
280+
281+
**Arguments**
282+
283+
<CommandTable>
284+
285+
| Argument | Required | Description |
286+
| --- | --- | --- |
287+
| `id` | Yes | Knowledge base that owns the connector. |
288+
| `connectorId` | Yes | Connector selected for the operation. |
289+
290+
</CommandTable>
291+
292+
## List knowledge connector documents
293+
294+
```bash
295+
sim knowledge connectors documents list <id> <connectorId> [options]
296+
```
297+
298+
**Arguments**
299+
300+
<CommandTable>
301+
302+
| Argument | Required | Description |
303+
| --- | --- | --- |
304+
| `id` | Yes | Knowledge base that owns the connector. |
305+
| `connectorId` | Yes | Connector selected for the operation. |
306+
307+
</CommandTable>
308+
309+
**Options**
310+
311+
<CommandTable>
312+
313+
| Option | Required | Description |
314+
| --- | --- | --- |
315+
| `--include-excluded` | No | Include documents explicitly excluded by a user. |
316+
| `--no-include-excluded` | No | Send --include-excluded as false. |
317+
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
318+
319+
</CommandTable>
320+
321+
## List knowledge connectors
322+
323+
```bash
324+
sim knowledge connectors list <id> [options]
325+
```
326+
327+
**Arguments**
328+
329+
<CommandTable>
330+
331+
| Argument | Required | Description |
332+
| --- | --- | --- |
333+
| `id` | Yes | Unique knowledge base identifier. |
334+
335+
</CommandTable>
336+
337+
**Options**
338+
339+
<CommandTable>
340+
341+
| Option | Required | Description |
342+
| --- | --- | --- |
343+
| `--sort-by <value>` | No | Field used to sort the result. Accepted values: `connectorType`, `createdAt`, `updatedAt`. |
344+
| `--sort-order <value>` | No | Sort direction. Accepted values: `asc`, `desc`. |
345+
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
346+
347+
</CommandTable>
348+
349+
## Update knowledge connector
350+
351+
```bash
352+
sim knowledge connectors update <id> <connectorId> [options]
353+
```
354+
355+
**Arguments**
356+
357+
<CommandTable>
358+
359+
| Argument | Required | Description |
360+
| --- | --- | --- |
361+
| `id` | Yes | Knowledge base that owns the connector. |
362+
| `connectorId` | Yes | Connector selected for the operation. |
363+
364+
</CommandTable>
365+
366+
**Options**
367+
368+
<CommandTable>
369+
370+
| Option | Required | Description |
371+
| --- | --- | --- |
372+
| `--source-config <json\|@file>` | No | Replacement source selection and filtering configuration. (JSON, or @path / @- to read a file or stdin). |
373+
| `--sync-interval-minutes <value>` | No | New scheduled synchronization interval in minutes. |
374+
| `--status <value>` | No | New connector state. Accepted values: `active`, `paused`. |
375+
376+
</CommandTable>
377+
378+
## Update knowledge connector documents
379+
380+
```bash
381+
sim knowledge connectors documents update <id> <connectorId> [options]
382+
```
383+
384+
**Arguments**
385+
386+
<CommandTable>
387+
388+
| Argument | Required | Description |
389+
| --- | --- | --- |
390+
| `id` | Yes | Knowledge base that owns the connector. |
391+
| `connectorId` | Yes | Connector selected for the operation. |
392+
393+
</CommandTable>
394+
395+
**Options**
396+
397+
<CommandTable>
398+
399+
| Option | Required | Description |
400+
| --- | --- | --- |
401+
| `--operation <value>` | Yes | Whether to restore or exclude the selected documents. Accepted values: `restore`, `exclude`. |
402+
| `--document <value...>` | Yes | Connector document identifiers to update. (space-separated, or @path / @- with one value per line). |
403+
404+
</CommandTable>
405+
216406
## Create a knowledge folder at a path
217407

218408
```bash
@@ -398,6 +588,34 @@ sim knowledge search [options]
398588

399589
</CommandTable>
400590

591+
## Sync knowledge connector
592+
593+
```bash
594+
sim knowledge sync create <id> <connectorId> [options]
595+
```
596+
597+
**Arguments**
598+
599+
<CommandTable>
600+
601+
| Argument | Required | Description |
602+
| --- | --- | --- |
603+
| `id` | Yes | Knowledge base that owns the connector. |
604+
| `connectorId` | Yes | Connector selected for the operation. |
605+
606+
</CommandTable>
607+
608+
**Options**
609+
610+
<CommandTable>
611+
612+
| Option | Required | Description |
613+
| --- | --- | --- |
614+
| `--rehydrate` | No | Re-fetch and re-index every existing connector document. |
615+
| `--no-rehydrate` | No | Send --rehydrate as false. |
616+
617+
</CommandTable>
618+
401619
## Update knowledge base
402620

403621
```bash

0 commit comments

Comments
 (0)