@nexus-aethra/dsh-box-sandbox 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1036,6 +1036,8 @@ function registerManageTools(ctx) {
1036
1036
  "inject",
1037
1037
  "rm",
1038
1038
  "rm-view",
1039
+ "view-on",
1040
+ "view-off",
1039
1041
  "prune",
1040
1042
  "types",
1041
1043
  "views"
@@ -1066,7 +1068,7 @@ function registerManageTools(ctx) {
1066
1068
  },
1067
1069
  viewId: {
1068
1070
  type: "string",
1069
- description: "Which resource view to remove."
1071
+ description: "Which resource view to act on: the type a Resources tab stands for. Required by rm-view, view-on and view-off."
1070
1072
  },
1071
1073
  name: {
1072
1074
  type: "string",
@@ -1184,8 +1186,20 @@ function registerManageTools(ctx) {
1184
1186
  case "rm-view": return {
1185
1187
  action,
1186
1188
  containerId,
1187
- result: asObject(await rpc.call("delete_resource_view", { id: required(record, "viewId") }))
1189
+ result: asObject(await rpc.call("delete_resource_view", { viewId: required(record, "viewId") }))
1188
1190
  };
1191
+ case "view-on":
1192
+ case "view-off": {
1193
+ const enabled = action === "view-on";
1194
+ return {
1195
+ action,
1196
+ containerId,
1197
+ result: asObject(await rpc.call("set_resource_view_enabled", {
1198
+ viewId: required(record, "viewId"),
1199
+ enabled
1200
+ }))
1201
+ };
1202
+ }
1189
1203
  case "prune": return {
1190
1204
  action,
1191
1205
  containerId,
@@ -1220,6 +1234,8 @@ function registerManageTools(ctx) {
1220
1234
  "inject",
1221
1235
  "rm",
1222
1236
  "rm-view",
1237
+ "view-on",
1238
+ "view-off",
1223
1239
  "prune",
1224
1240
  "types",
1225
1241
  "views"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-aethra/dsh-box-sandbox",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Host-side bridge from a DSH session to the DSH Box daemon: typed box_* tools an agent can call without a shell.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "files": [
39
39
  "dist/",
40
+ "skills/",
40
41
  "cordis.patch.yml",
41
42
  "README.md",
42
43
  "LICENSE"
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: dsh-box-tools
3
+ description: Use when you need to inspect, start, or change DSH Box containers, templates, plugins or resources from inside a container session — cover box_overview, box_lifecycle, box_create, box_resources, box_plugins, box_templates, box_settings, box_task and the browser page tools.
4
+ ---
5
+
6
+ # Driving DSH Box with the `box_*` tools
7
+
8
+ You run inside a DSH Box container, and this profile mounts the sandbox plugin
9
+ (`@nexus-aethra/dsh-box-sandbox`) that bridges to the `dshboxd` daemon on the host.
10
+ It registers a typed `box_*` tool surface, so you never have to shell out to `dshbox`
11
+ or parse its stdout. Every tool is one JSON call; every answer is the daemon's own
12
+ result, not a summary.
13
+
14
+ ## Read this first
15
+
16
+ - **`box_overview` before anything else.** It is the only listing tool: containers,
17
+ templates, and the plugins the box knows. Acting on an id you guessed is the
18
+ failure this tool removes.
19
+ - **Anything that changes state through a task needs `box_task`.** Call it with
20
+ `action: 'status'` and the task id the action returned, or `action: 'list'` to
21
+ find what is already running. A task that has not finished has not happened.
22
+ - **A call that disappears is an outage, not an answer.** When the daemon is down
23
+ every tool fails with a message naming the discovery record it looked for; that
24
+ means "the box is not running", not "the thing does not exist".
25
+
26
+ ## The tool surface
27
+
28
+ | Tool | What it does |
29
+ |---|---|
30
+ | `box_overview` | Containers, templates, plugins. Start here. |
31
+ | `box_lifecycle` | start / stop / stop-now / restart / rebuild / remove a container |
32
+ | `box_create` | from-template, from-version, describe, url, browse-paths |
33
+ | `box_resources` | list, read, write, extract, inject, rm, rm-view, view-on, view-off, prune, types, views |
34
+ | `box_plugins` | list, installed, container, add, add-extension, copy, remove-plugin, import, export, export-installed, import-workspace, install-bundle, bundle, prune, graph |
35
+ | `box_templates` | list, show, pull, import, export, remove, prune, catalog |
36
+ | `box_settings` | toolchains, installed, catalog, refresh-catalog, data, references, template-info, template-list, save-mirrors, set-runtime-directory, uninstall-dsh |
37
+ | `box_task` | list, status, cancel, delete |
38
+ | `box_workspace` | list, add |
39
+ | `box_build` | build a template from a boxfile; apply a resource document |
40
+
41
+ ## Rules that are easy to get wrong
42
+
43
+ 1. **This container cannot be restarted from inside it.** `box_lifecycle` refuses
44
+ when the target is the container you are running in — stopping it kills the host
45
+ that is executing your call, so the result can never come back. Use `box_task`
46
+ to watch, and let a person or the CLI act on that container.
47
+ 2. **`add`, `import` and `pull` are tasks.** They return a task id, not a finished
48
+ object. `box_task` with `action: 'status'` is how you learn whether it worked;
49
+ the task's `logPath` is where the daemon writes the step-by-step log.
50
+ 3. **Closing a resource type is not deleting it.** `box_resources` with
51
+ `view-off` hides the type's tab and keeps its row and every copy taken under it;
52
+ `rm-view` removes the type itself and leaves the copies alone. Choose deliberately.
53
+ 4. **Injection refuses rather than overwrites.** `inject` will not replace an
54
+ existing destination without `overwrite`, and will not touch a running container
55
+ without `restart`. That refusal is the safety property, not an error to work around.
56
+ 5. **Three actions change the whole box and need `confirm: true`.**
57
+ `save-mirrors`, `set-runtime-directory`, `uninstall-dsh` affect every container
58
+ and every future session. The tool refuses without the flag.
59
+
60
+ ## Debugging a page (separate tool family)
61
+
62
+ The same plugin also registers browser tools against a headless Chromium session:
63
+ `box_page_text`, `box_click_element`, `box_click_at`, `box_type_text`, `box_press_key`,
64
+ `box_scroll`, `box_screenshot`, `box_console`, `box_set_viewport`, `box_set_browser`,
65
+ `box_close`.
66
+
67
+ When using them, always start with the observation tool and act only on what it
68
+ returned. The tool descriptions carry the full workflow; follow them.
69
+
70
+ ## Worked example: take a resource copy and check it landed
71
+
72
+ 1. `box_overview` -> find the container id, e.g. `container-<timestamp>`.
73
+ 2. `box_resources` with `action: 'list'` and that `containerId` -> see which kinds
74
+ exist and where.
75
+ 3. `box_resources` with `action: 'extract'`, `kind: 'sessions'` -> returns a task id.
76
+ 4. `box_task` with `action: 'status'`, that id -> `succeeded` means the copy exists.
77
+ 5. `box_resources` with `action: 'stored'` -> confirm the new copy is listed.
78
+
79
+ If a step fails, the daemon's message names what it refused and why. Read it; do not
80
+ retry with a different flag to see if that works.