@neuralis/brain-core 0.2.0 → 0.3.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.
Files changed (123) hide show
  1. package/README.md +8 -3
  2. package/app/README.md +1 -1
  3. package/app/filesystem/README.md +3 -3
  4. package/app/filesystem/api/README.md +4 -4
  5. package/app/filesystem/api/index.ts +144 -139
  6. package/app/filesystem/domain/types.ts +12 -0
  7. package/app/filesystem/hooks/README.md +5 -5
  8. package/app/filesystem/hooks/useDiscoverableSources.ts +4 -2
  9. package/app/filesystem/hooks/useFilesystemSSE.ts +31 -23
  10. package/app/filesystem/hooks/useGitChangesInventory.ts +4 -2
  11. package/app/filesystem/host/README.md +3 -2
  12. package/app/filesystem/host/installFilesystemHostComponents.tsx +22 -9
  13. package/app/filesystem/store/README.md +12 -8
  14. package/app/filesystem/store/filesystemStore.ts +444 -163
  15. package/app/filesystem/store/gitSlice.ts +6 -6
  16. package/app/filesystem/store/listSlice.ts +9 -6
  17. package/app/filesystem/store/searchSlice.ts +3 -3
  18. package/app/filesystem/ui/FileEditor.tsx +90 -39
  19. package/app/filesystem/ui/FileTree.tsx +10 -9
  20. package/app/filesystem/ui/GitCommitChangesView.tsx +5 -3
  21. package/app/filesystem/ui/GitCommitGraph.tsx +6 -5
  22. package/app/filesystem/ui/GitControlPanel.tsx +14 -14
  23. package/app/filesystem/ui/GitDiffView.tsx +14 -6
  24. package/app/filesystem/ui/GitFileDiff.tsx +22 -15
  25. package/app/filesystem/ui/PendingChangesPanel.tsx +108 -44
  26. package/app/filesystem/ui/PendingReviewDialog.tsx +8 -5
  27. package/app/filesystem/ui/README.md +9 -9
  28. package/app/filesystem/ui/ReembedDialog.tsx +4 -2
  29. package/app/filesystem/ui/SourcesPanel.tsx +26 -28
  30. package/app/filesystem/ui/Toolbar.tsx +5 -4
  31. package/app/filesystem/ui/VectorHealthPanel.tsx +48 -17
  32. package/dist/app/host.js +46 -46
  33. package/dist/src/config/env.d.ts +4 -0
  34. package/dist/src/config/env.d.ts.map +1 -1
  35. package/dist/src/config/env.js +13 -0
  36. package/dist/src/config/env.js.map +1 -1
  37. package/dist/src/connectors/LocalDiskConnector.d.ts +9 -1
  38. package/dist/src/connectors/LocalDiskConnector.d.ts.map +1 -1
  39. package/dist/src/connectors/LocalDiskConnector.js +51 -2
  40. package/dist/src/connectors/LocalDiskConnector.js.map +1 -1
  41. package/dist/src/domain/healthTypes.d.ts +1 -7
  42. package/dist/src/domain/healthTypes.d.ts.map +1 -1
  43. package/dist/src/domain/pendingChange.d.ts +31 -0
  44. package/dist/src/domain/pendingChange.d.ts.map +1 -1
  45. package/dist/src/domain/pendingChange.js.map +1 -1
  46. package/dist/src/routes/health.js +2 -3
  47. package/dist/src/routes/health.js.map +1 -1
  48. package/dist/src/routes/pending.d.ts +7 -7
  49. package/dist/src/routes/pending.d.ts.map +1 -1
  50. package/dist/src/routes/pending.js +21 -21
  51. package/dist/src/routes/pending.js.map +1 -1
  52. package/dist/src/services/FilesystemService.d.ts +13 -61
  53. package/dist/src/services/FilesystemService.d.ts.map +1 -1
  54. package/dist/src/services/FilesystemService.js +47 -189
  55. package/dist/src/services/FilesystemService.js.map +1 -1
  56. package/dist/src/services/FilesystemUiService.d.ts +33 -1
  57. package/dist/src/services/FilesystemUiService.d.ts.map +1 -1
  58. package/dist/src/services/FilesystemUiService.js +50 -1
  59. package/dist/src/services/FilesystemUiService.js.map +1 -1
  60. package/dist/src/store/PendingChangeStore.d.ts +3 -0
  61. package/dist/src/store/PendingChangeStore.d.ts.map +1 -1
  62. package/dist/src/store/PendingChangeStore.js +84 -25
  63. package/dist/src/store/PendingChangeStore.js.map +1 -1
  64. package/dist/src/usecases/orphanedPending.d.ts +2 -2
  65. package/dist/src/usecases/orphanedPending.d.ts.map +1 -1
  66. package/dist/src/usecases/orphanedPending.js +5 -3
  67. package/dist/src/usecases/orphanedPending.js.map +1 -1
  68. package/dist/src/usecases/pendingListing.d.ts +34 -0
  69. package/dist/src/usecases/pendingListing.d.ts.map +1 -0
  70. package/dist/src/usecases/pendingListing.js +244 -0
  71. package/dist/src/usecases/pendingListing.js.map +1 -0
  72. package/dist/src/usecases/vectorMaintenance.d.ts +6 -9
  73. package/dist/src/usecases/vectorMaintenance.d.ts.map +1 -1
  74. package/dist/src/usecases/vectorMaintenance.js +4 -13
  75. package/dist/src/usecases/vectorMaintenance.js.map +1 -1
  76. package/dist/src/vector/InMemoryVectorIndex.d.ts.map +1 -1
  77. package/dist/src/vector/InMemoryVectorIndex.js +30 -9
  78. package/dist/src/vector/InMemoryVectorIndex.js.map +1 -1
  79. package/package.json +27 -5
  80. package/rules/brain-rules.md +1 -1
  81. package/skills/create-package/SKILL.md +3 -3
  82. package/skills/create-package/references/config-and-credentials.md +1 -1
  83. package/skills/create-package/references/manifest-and-discovery.md +1 -1
  84. package/skills/create-package/references/runtime-and-build.md +1 -1
  85. package/skills/create-package/references/skills-and-context.md +25 -12
  86. package/skills/create-package/references/surfaces-and-design.md +7 -5
  87. package/skills/create-package/references/test-and-ship.md +9 -16
  88. package/skills/create-package/scripts/check-package.sh +47 -1
  89. package/skills/create-package/scripts/verify-loaded.sh +18 -27
  90. package/skills/git/SKILL.md +27 -29
  91. package/skills/manage-files/SKILL.md +37 -32
  92. package/skills/manage-files/scripts/upload.sh +7 -9
  93. package/skills/manage-files/scripts/write.sh +2 -6
  94. package/skills/manage-sources/SKILL.md +93 -95
  95. package/skills/manage-sources/scripts/reembed.sh +2 -6
  96. package/skills/manage-uri-policy/SKILL.md +30 -58
  97. package/app/filesystem/hooks/useContainerWidth.ts +0 -39
  98. package/skills/git/scripts/git.sh +0 -48
  99. package/skills/manage-files/scripts/approve.sh +0 -9
  100. package/skills/manage-files/scripts/list.sh +0 -9
  101. package/skills/manage-files/scripts/pending.sh +0 -23
  102. package/skills/manage-files/scripts/raw.sh +0 -11
  103. package/skills/manage-files/scripts/read.sh +0 -9
  104. package/skills/manage-files/scripts/search.sh +0 -15
  105. package/skills/manage-sources/scripts/browse.sh +0 -12
  106. package/skills/manage-sources/scripts/cancel.sh +0 -14
  107. package/skills/manage-sources/scripts/create.sh +0 -13
  108. package/skills/manage-sources/scripts/delete.sh +0 -17
  109. package/skills/manage-sources/scripts/discoverable.sh +0 -6
  110. package/skills/manage-sources/scripts/get.sh +0 -7
  111. package/skills/manage-sources/scripts/kind-schema.sh +0 -7
  112. package/skills/manage-sources/scripts/kinds.sh +0 -6
  113. package/skills/manage-sources/scripts/list.sh +0 -6
  114. package/skills/manage-sources/scripts/purge-index.sh +0 -18
  115. package/skills/manage-sources/scripts/reindex.sh +0 -13
  116. package/skills/manage-sources/scripts/reset.sh +0 -11
  117. package/skills/manage-sources/scripts/set-enabled.sh +0 -17
  118. package/skills/manage-sources/scripts/sync-status.sh +0 -14
  119. package/skills/manage-sources/scripts/sync.sh +0 -13
  120. package/skills/manage-sources/scripts/update.sh +0 -18
  121. package/skills/manage-uri-policy/scripts/manifests.sh +0 -20
  122. package/skills/manage-uri-policy/scripts/set-uri.sh +0 -66
  123. package/skills/manage-uri-policy/scripts/show-uri.sh +0 -23
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Generic caller for the brain-core git routes — ONE helper for all 19 endpoints
3
- # (9 GET + 10 POST, spread over 17 route names: `commit` and `branch` carry both verbs).
4
- # NOTE the shape: the HTTP VERB is a positional ARGUMENT, not a property of this file.
5
- # Anything auditing "which examples mutate" must read the verb off the INVOCATION line
6
- # (`git.sh POST commit …`), never off this script — 10 of the 19 endpoints are POST writes,
7
- # and `commit`/`branch` READ on GET while WRITING on POST.
8
- # GET: git.sh GET <route> [key=value ...] # each pair is URL-encoded
9
- # POST: git.sh POST <route> '<json-body>' # body carries "source" + params
10
- # Auth is the per-stream session ticket (NEURALIS_SESSION_TOKEN), injected by the
11
- # skill activation — never a platform/admin token, never a git credential (the
12
- # route resolves the remote token server-side for fetch/pull/push).
13
- # `--fail-with-body` (NOT `-f`): the routes' error bodies still reach you on
14
- # 400/403/404/409 — `-f` would leave a bare `curl: (22)` — and a refused call
15
- # now exits NON-ZERO as well, so a rejected commit/push can no longer read as a
16
- # success. Failure shapes, measured 2026-09-01 against `src/routes/git.ts` —
17
- # EVERY refusal carries `error`, and:
18
- # · a write-op failure (400/409/500) and the three remote 409s
19
- # (`no_https_remote` / `not_connected` / `no_credential`) also carry
20
- # `ok:false` AND `code`;
21
- # · a 403 carries `code` (`feature_denied` / `uri_policy_denied`), no `ok`;
22
- # · a plain argument or lookup 400/404 carries `error` only.
23
- # Separately, a **200** may still carry `ok:false`: `unavailable` from
24
- # `commit`/`outgoing`/`show`, `too_large` from `diff`. So use THIS script's exit
25
- # code as the discriminator — non-zero = an HTTP refusal (read `.error`, then
26
- # `.code` when present); zero + `ok:false` = a soft 200.
27
- set -euo pipefail
28
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
29
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
30
- METHOD="${1:?usage: git.sh <GET|POST> <route> [key=value ... | json-body]}"
31
- ROUTE="${2:?usage: git.sh <GET|POST> <route> [key=value ... | json-body]}"
32
- shift 2
33
- URL="${API_BASE}/api/packages/@neuralis/brain-core/git/${ROUTE}"
34
- AUTH=(-H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: git")
35
- if [ "${METHOD}" = "GET" ]; then
36
- ENC=()
37
- for kv in "$@"; do ENC+=(--data-urlencode "${kv}"); done
38
- curl --fail-with-body -sS -G "${AUTH[@]}" "${ENC[@]}" "${URL}"
39
- else
40
- # `${1:-{}}` does NOT work here: bash closes the expansion at the FIRST `}`, so
41
- # the default becomes `{` and the trailing `}` is appended as a LITERAL — every
42
- # POST body went on the wire as `{…}}`, invalid JSON, for all 10 POST routes.
43
- # `--data-raw` (not `-d`): `-d` treats a leading `@` as a FILE reference.
44
- BODY="${1:-}"
45
- [ -z "${BODY}" ] && BODY='{}'
46
- curl --fail-with-body -sS -X "${METHOD}" "${AUTH[@]}" \
47
- -H "Content-Type: application/json" --data-raw "${BODY}" "${URL}"
48
- fi
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (see /approve route schema)}"
6
- curl --fail-with-body -sS -X POST \
7
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
8
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
9
- "${API_BASE}/api/packages/@neuralis/brain-core/approve"
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (see /list route schema)}"
6
- curl --fail-with-body -sS -X POST \
7
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
8
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
9
- "${API_BASE}/api/packages/@neuralis/brain-core/list"
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # GET /pending — the project-wide list of revertible pending changes behind the
6
- # Files widget "Changes" tab (gate: drive.read; per-record owner + uri-policy
7
- # floor is enforced server-side). Optional filters via env: STATUS
8
- # (pending_review|approved|reverted), SOURCE, OP (create|modify|delete|move), LIMIT.
9
- if [[ -n "${BODY_JSON:-}" ]]; then
10
- curl --fail-with-body -sS -X POST \
11
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
12
- -H 'Content-Type: application/json' -d "${BODY_JSON}" \
13
- "${API_BASE}/api/packages/@neuralis/brain-core/pending"
14
- exit
15
- fi
16
- args=(-G)
17
- [ -n "${STATUS:-}" ] && args+=(--data-urlencode "status=${STATUS}")
18
- [ -n "${SOURCE:-}" ] && args+=(--data-urlencode "source=${SOURCE}")
19
- [ -n "${OP:-}" ] && args+=(--data-urlencode "op=${OP}")
20
- [ -n "${LIMIT:-}" ] && args+=(--data-urlencode "limit=${LIMIT}")
21
- curl --fail-with-body -sS "${args[@]}" \
22
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
23
- "${API_BASE}/api/packages/@neuralis/brain-core/pending"
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # GET /raw returns the un-summarized bytes for a single URI. agentId is taken
6
- # from the session ticket; pass the file URI via URI=…
7
- URI="${URI:?URI is required (e.g. brain://docs/screen.png)}"
8
- curl --fail-with-body -sS -G \
9
- --data-urlencode "uri=${URI}" \
10
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
11
- "${API_BASE}/api/packages/@neuralis/brain-core/raw"
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (see /read route schema)}"
6
- curl --fail-with-body -sS -X POST \
7
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
8
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
9
- "${API_BASE}/api/packages/@neuralis/brain-core/read"
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # The /search route body uses: search_mode (semantic|filter|grep), query, folder_uri,
6
- # glob, category, tags, status, created_after/before, limit — the SAME vocabulary as
7
- # the fs_search tool (the legacy `mode` key is rejected with 400).
8
- # grep mode greps the LIVE connector (ripgrep/git-grep) and is uri-policy
9
- # read-gated (a non-brain folder_uri the caller cannot read → 403). Requires the
10
- # `drive.search` feature (distinct from drive.write) — a 403 is returned otherwise.
11
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (see /search route schema)}"
12
- curl --fail-with-body -sS -X POST \
13
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-files" \
14
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
15
- "${API_BASE}/api/packages/@neuralis/brain-core/search"
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- PATH_ARG="${PATH_ARG:?PATH_ARG is required (filesystem path to browse)}"
6
- ENCODED=$(printf '%s' "${PATH_ARG}" | jq -sRr @uri)
7
- # `--fail-with-body`, not `-f`: this route answers 403 with the NAME of the
8
- # feature you are missing (`drive.mount`, or `drive.mount.privileged` for the
9
- # filesystem root and the protected host zones). Plain `-f` discards the body,
10
- # so the agent would see an empty output and exit 22 with no idea why.
11
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
12
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/browse?path=${ENCODED}"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.sync (403 otherwise).
6
- # Optional SOURCE: cancels that source's active job; omitted = cancel every
7
- # job on sources visible to the caller.
8
- SOURCE="${SOURCE:-}"
9
- BODY=$(jq -n --arg source "${SOURCE}" \
10
- 'if $source == "" then {} else { source: $source } end')
11
- curl --fail-with-body -sS -X POST \
12
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
13
- -H "Content-Type: application/json" -d "${BODY}" \
14
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/cancel"
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.mount (403 otherwise). BODY_JSON MUST carry `source`,
6
- # `connection.kind`, and `permissions.default.{read,write,exec}` (all booleans);
7
- # optional `scope` / `sync` / `description` / `agentId`. Create also enforces
8
- # the kind's scope rules and canAccessScope(..,'write').
9
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (source + connection.kind + permissions)}"
10
- curl --fail-with-body -sS -X POST \
11
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
12
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
13
- "${API_BASE}/api/packages/@neuralis/brain-core/sources"
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.mount (403 otherwise). SLUG is a REAL path segment here
6
- # (matched against each config's sanitized source name). Optional PURGE=1
7
- # enqueues an async vector purge: response is 200 normally, 202 + {purgeJob,…}
8
- # when a purge job was queued.
9
- SLUG="${SLUG:?SLUG is required}"
10
- PURGE="${PURGE:-false}"
11
- QS=""
12
- if [[ "${PURGE}" == "true" || "${PURGE}" == "1" ]]; then
13
- QS="?purge=1"
14
- fi
15
- curl --fail-with-body -sS -X DELETE \
16
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
17
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/${SLUG}${QS}"
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
6
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/discoverable"
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- SLUG="${SLUG:?SLUG is required}"
6
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
7
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/${SLUG}"
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- KIND="${KIND:?KIND is required}"
6
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
7
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/kinds/${KIND}/schema"
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
6
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/kinds"
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- curl --fail-with-body -sS -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
6
- "${API_BASE}/api/packages/@neuralis/brain-core/sources"
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- SOURCE="${SOURCE:?SOURCE is required}"
6
- FOLDER="${FOLDER:-}"
7
- URI="${URI:-}"
8
- OBSOLETE_ONLY="${OBSOLETE_ONLY:-true}"
9
- CONFIRM="${CONFIRM:-}"
10
- case "${OBSOLETE_ONLY}" in true|false) ;; *) echo 'OBSOLETE_ONLY must be true or false' >&2; exit 2 ;; esac
11
- if [[ -n "${FOLDER}" && -n "${URI}" ]]; then echo 'Give FOLDER or URI, not both' >&2; exit 2; fi
12
- BODY=$(jq -n --arg source "${SOURCE}" --arg folder "${FOLDER}" --arg uri "${URI}" --arg confirm "${CONFIRM}" --argjson obsoleteOnly "${OBSOLETE_ONLY}" \
13
- '{source:$source, obsoleteOnly:$obsoleteOnly, mode:(if $confirm=="1" then "apply" else "estimate" end),
14
- selector:(if $uri!="" then {kind:"file",uri:$uri} elif $folder!="" then {kind:"folder",uri:$folder} else {kind:"source"} end)}')
15
- curl --fail-with-body -sS -X POST \
16
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
17
- -H 'Content-Type: application/json' -d "${BODY}" \
18
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/purge"
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.sync (403 otherwise).
6
- SOURCE="${SOURCE:?SOURCE is required}"
7
- AGENT_ID="${AGENT_ID:-}"
8
- BODY=$(jq -n --arg source "${SOURCE}" --arg agentId "${AGENT_ID}" \
9
- '{ source: $source } + (if $agentId == "" then {} else { agentId: $agentId } end)')
10
- curl --fail-with-body -sS -X POST \
11
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
12
- -H "Content-Type: application/json" -d "${BODY}" \
13
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/reindex"
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.sync (403 otherwise) — reset also cancels the source's active job.
6
- SOURCE="${SOURCE:?SOURCE is required}"
7
- BODY=$(jq -n --arg source "${SOURCE}" '{ source: $source }')
8
- curl --fail-with-body -sS -X POST \
9
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
10
- -H "Content-Type: application/json" -d "${BODY}" \
11
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/reset"
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.mount (403 otherwise).
6
- SOURCE="${SOURCE:?SOURCE is required}"
7
- ENABLED="${ENABLED:?ENABLED is required (true | false | auto)}"
8
- if [[ "${ENABLED}" == "auto" ]]; then
9
- BODY=$(jq -n --arg source "${SOURCE}" '{ source: $source, enabled: "auto" }')
10
- else
11
- BODY=$(jq -n --arg source "${SOURCE}" --argjson enabled "${ENABLED}" \
12
- '{ source: $source, enabled: $enabled }')
13
- fi
14
- curl --fail-with-body -sS -X POST \
15
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
16
- -H "Content-Type: application/json" -d "${BODY}" \
17
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/enabled"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.sync (403 otherwise).
6
- # Optional SOURCE: one source's job snapshot; omitted = every visible job.
7
- SOURCE="${SOURCE:-}"
8
- QS=""
9
- if [ -n "${SOURCE}" ]; then
10
- QS="?source=$(jq -rn --arg s "${SOURCE}" '$s|@uri')"
11
- fi
12
- curl --fail-with-body -sS \
13
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
14
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/sync-status${QS}"
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # Requires drive.sync (403 otherwise).
6
- SOURCE="${SOURCE:?SOURCE is required}"
7
- AGENT_ID="${AGENT_ID:-}"
8
- BODY=$(jq -n --arg source "${SOURCE}" --arg agentId "${AGENT_ID}" \
9
- '{ source: $source } + (if $agentId == "" then {} else { agentId: $agentId } end)')
10
- curl --fail-with-body -sS -X POST \
11
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
12
- -H "Content-Type: application/json" -d "${BODY}" \
13
- "${API_BASE}/api/packages/@neuralis/brain-core/sources/sync"
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
4
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
5
- # PATCH /sources (NO :slug segment): the handler reads the target from the body
6
- # `source` field, not the path. BODY_JSON MUST carry `source` +
7
- # `permissions.default.{read,write,exec}` (both required); optional
8
- # `description` / `sync` / `clearSync` / `enabled`. Requires drive.mount (403 otherwise).
9
- # DESTRUCTIVE SHAPE: the handler REPLACES `permissions` wholesale — it never merges.
10
- # A body carrying only `permissions.default` returns 200 and drops every `paths[]`
11
- # rule on the source (immutable `floor:true` rules are the sole protected class and
12
- # 409 instead). Build BODY_JSON from the source's current config (see SKILL.md),
13
- # never by hand.
14
- BODY_JSON="${BODY_JSON:?BODY_JSON is required (must include source + permissions)}"
15
- curl --fail-with-body -sS -X PATCH \
16
- -H "Authorization: Bearer ${TOKEN}" -H "X-Neuralis-Skill: manage-sources" \
17
- -H "Content-Type: application/json" -d "${BODY_JSON}" \
18
- "${API_BASE}/api/packages/@neuralis/brain-core/sources"
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env bash
2
- # manage-uri-policy/manifests.sh — return every loaded package's resolved uriPolicies baseline.
3
- #
4
- # Env (projected by `execute action="shell"`):
5
- # NEURALIS_API required
6
- # NEURALIS_SESSION_TOKEN auto-injected per skill activation (real caller identity)
7
- #
8
- # Output: JSON `{ packages: { "<pkg-id>": { ...uriPolicies... } } }`.
9
-
10
- set -euo pipefail
11
-
12
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
13
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
14
-
15
- ROUTE="${API_BASE}/api/packages/@neuralis/brain-core/policies/uri/manifests"
16
-
17
- curl --fail-with-body -sS \
18
- -H "Authorization: Bearer ${TOKEN}" \
19
- -H "X-Neuralis-Skill: manage-uri-policy" \
20
- "${ROUTE}"
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env bash
2
- # manage-uri-policy/set-uri.sh — add or remove a path-rule on a source's URI policy.
3
- #
4
- # Env (projected by `execute action="shell"`):
5
- # NEURALIS_API required
6
- # NEURALIS_SESSION_TOKEN auto-injected per skill activation (real caller identity)
7
- # SOURCE required — source slug
8
- # OPERATION optional — "addRule" (default) | "removeRule"
9
- # PATTERN required — URI pattern with ** wildcards
10
- # DENY optional — comma-list of capabilities to deny (read,write,exec)
11
- # ALLOW optional — comma-list of capabilities to allow
12
- # ROLES optional — comma-list of roles the rule applies to
13
-
14
- set -euo pipefail
15
-
16
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
17
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
18
- SOURCE="${SOURCE:?SOURCE is required (source slug, e.g. data)}"
19
- PATTERN="${PATTERN:?PATTERN is required (URI pattern with ** wildcards)}"
20
- OPERATION="${OPERATION:-addRule}"
21
-
22
- ROUTE="${API_BASE}/api/packages/@neuralis/brain-core/policies/uri"
23
-
24
- case "${OPERATION}" in
25
- addRule)
26
- PERMS_JSON='{}'
27
- if [[ -n "${DENY:-}" ]]; then
28
- for cap in ${DENY//,/ }; do
29
- PERMS_JSON=$(echo "${PERMS_JSON}" | jq --arg cap "${cap}" '. + { ($cap): false }')
30
- done
31
- fi
32
- if [[ -n "${ALLOW:-}" ]]; then
33
- for cap in ${ALLOW//,/ }; do
34
- PERMS_JSON=$(echo "${PERMS_JSON}" | jq --arg cap "${cap}" '. + { ($cap): true }')
35
- done
36
- fi
37
- ROLES_JSON='null'
38
- if [[ -n "${ROLES:-}" ]]; then
39
- ROLES_JSON=$(echo "${ROLES}" | jq -R 'split(",")')
40
- fi
41
- BODY=$(jq -n \
42
- --arg source "${SOURCE}" \
43
- --arg pattern "${PATTERN}" \
44
- --argjson perms "${PERMS_JSON}" \
45
- --argjson roles "${ROLES_JSON}" \
46
- '{ source: $source, addPaths: [ { pattern: $pattern, permissions: $perms } + (if $roles == null then {} else { roles: $roles } end) ] }')
47
- ;;
48
- removeRule)
49
- BODY=$(jq -n \
50
- --arg source "${SOURCE}" \
51
- --arg pattern "${PATTERN}" \
52
- '{ source: $source, removePatterns: [$pattern] }')
53
- ;;
54
- *)
55
- echo "manage-uri-policy: unknown OPERATION '${OPERATION}' (expected: addRule | removeRule)" >&2
56
- exit 64
57
- ;;
58
- esac
59
-
60
- curl --fail-with-body -sS \
61
- -X POST \
62
- -H "Authorization: Bearer ${TOKEN}" \
63
- -H "X-Neuralis-Skill: manage-uri-policy" \
64
- -H "Content-Type: application/json" \
65
- -d "${BODY}" \
66
- "${ROUTE}"
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env bash
2
- # manage-uri-policy/show-uri.sh — return effective merged URI policy for a source.
3
- #
4
- # Env (projected by `execute action="shell"`):
5
- # NEURALIS_API required — host's internal API base URL
6
- # NEURALIS_SESSION_TOKEN auto-injected per skill activation (real caller identity)
7
- # SOURCE required — source slug (e.g. "data", "packages")
8
- #
9
- # Exits non-zero on any HTTP failure AND prints the route's own error body
10
- # (`--fail-with-body`, not `-f`: `-f` would discard the `{code,error}` you branch on).
11
-
12
- set -euo pipefail
13
-
14
- API_BASE="${NEURALIS_API:?NEURALIS_API not set; activate skill first}"
15
- TOKEN="${NEURALIS_SESSION_TOKEN:?missing session ticket; activate the skill via execute action=\"skill\"}"
16
- SOURCE="${SOURCE:?SOURCE is required (source slug, e.g. data)}"
17
-
18
- ROUTE="${API_BASE}/api/packages/@neuralis/brain-core/policies/uri/${SOURCE}"
19
-
20
- curl --fail-with-body -sS \
21
- -H "Authorization: Bearer ${TOKEN}" \
22
- -H "X-Neuralis-Skill: manage-uri-policy" \
23
- "${ROUTE}"