@neuralis/brain-core 0.2.1 → 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.
- package/README.md +8 -3
- package/app/filesystem/api/README.md +1 -1
- package/app/filesystem/api/index.ts +24 -24
- package/app/filesystem/store/README.md +1 -1
- package/app/filesystem/store/filesystemStore.ts +11 -3
- package/app/filesystem/store/listSlice.ts +1 -0
- package/app/filesystem/ui/FileEditor.tsx +42 -4
- package/app/filesystem/ui/GitControlPanel.tsx +0 -1
- package/app/filesystem/ui/GitDiffView.tsx +12 -5
- package/app/filesystem/ui/GitFileDiff.tsx +15 -9
- package/app/filesystem/ui/PendingChangesPanel.tsx +95 -34
- package/app/filesystem/ui/README.md +9 -9
- package/app/filesystem/ui/SourcesPanel.tsx +1 -3
- package/app/filesystem/ui/Toolbar.tsx +5 -4
- package/app/filesystem/ui/VectorHealthPanel.tsx +43 -14
- package/dist/app/host.js +40 -40
- package/dist/src/config/env.d.ts +4 -0
- package/dist/src/config/env.d.ts.map +1 -1
- package/dist/src/config/env.js +13 -0
- package/dist/src/config/env.js.map +1 -1
- package/dist/src/connectors/LocalDiskConnector.d.ts +9 -1
- package/dist/src/connectors/LocalDiskConnector.d.ts.map +1 -1
- package/dist/src/connectors/LocalDiskConnector.js +51 -2
- package/dist/src/connectors/LocalDiskConnector.js.map +1 -1
- package/dist/src/domain/healthTypes.d.ts +1 -7
- package/dist/src/domain/healthTypes.d.ts.map +1 -1
- package/dist/src/domain/pendingChange.d.ts +31 -0
- package/dist/src/domain/pendingChange.d.ts.map +1 -1
- package/dist/src/domain/pendingChange.js.map +1 -1
- package/dist/src/routes/health.js +2 -3
- package/dist/src/routes/health.js.map +1 -1
- package/dist/src/routes/pending.d.ts +7 -7
- package/dist/src/routes/pending.d.ts.map +1 -1
- package/dist/src/routes/pending.js +21 -21
- package/dist/src/routes/pending.js.map +1 -1
- package/dist/src/services/FilesystemService.d.ts +13 -61
- package/dist/src/services/FilesystemService.d.ts.map +1 -1
- package/dist/src/services/FilesystemService.js +47 -189
- package/dist/src/services/FilesystemService.js.map +1 -1
- package/dist/src/services/FilesystemUiService.d.ts +33 -1
- package/dist/src/services/FilesystemUiService.d.ts.map +1 -1
- package/dist/src/services/FilesystemUiService.js +50 -1
- package/dist/src/services/FilesystemUiService.js.map +1 -1
- package/dist/src/store/PendingChangeStore.d.ts +3 -0
- package/dist/src/store/PendingChangeStore.d.ts.map +1 -1
- package/dist/src/store/PendingChangeStore.js +84 -25
- package/dist/src/store/PendingChangeStore.js.map +1 -1
- package/dist/src/usecases/orphanedPending.d.ts +2 -2
- package/dist/src/usecases/orphanedPending.d.ts.map +1 -1
- package/dist/src/usecases/orphanedPending.js +5 -3
- package/dist/src/usecases/orphanedPending.js.map +1 -1
- package/dist/src/usecases/pendingListing.d.ts +34 -0
- package/dist/src/usecases/pendingListing.d.ts.map +1 -0
- package/dist/src/usecases/pendingListing.js +244 -0
- package/dist/src/usecases/pendingListing.js.map +1 -0
- package/dist/src/usecases/vectorMaintenance.d.ts +6 -9
- package/dist/src/usecases/vectorMaintenance.d.ts.map +1 -1
- package/dist/src/usecases/vectorMaintenance.js +4 -13
- package/dist/src/usecases/vectorMaintenance.js.map +1 -1
- package/dist/src/vector/InMemoryVectorIndex.d.ts.map +1 -1
- package/dist/src/vector/InMemoryVectorIndex.js +30 -9
- package/dist/src/vector/InMemoryVectorIndex.js.map +1 -1
- package/package.json +26 -4
- package/rules/brain-rules.md +1 -1
- package/skills/create-package/SKILL.md +3 -3
- package/skills/create-package/references/config-and-credentials.md +1 -1
- package/skills/create-package/references/runtime-and-build.md +1 -1
- package/skills/create-package/references/skills-and-context.md +25 -12
- package/skills/create-package/references/test-and-ship.md +9 -16
- package/skills/create-package/scripts/verify-loaded.sh +18 -27
- package/skills/git/SKILL.md +27 -29
- package/skills/manage-files/SKILL.md +37 -32
- package/skills/manage-files/scripts/upload.sh +7 -9
- package/skills/manage-files/scripts/write.sh +2 -6
- package/skills/manage-sources/SKILL.md +93 -95
- package/skills/manage-sources/scripts/reembed.sh +2 -6
- package/skills/manage-uri-policy/SKILL.md +30 -58
- package/skills/git/scripts/git.sh +0 -48
- package/skills/manage-files/scripts/approve.sh +0 -9
- package/skills/manage-files/scripts/list.sh +0 -9
- package/skills/manage-files/scripts/pending.sh +0 -23
- package/skills/manage-files/scripts/raw.sh +0 -11
- package/skills/manage-files/scripts/read.sh +0 -9
- package/skills/manage-files/scripts/search.sh +0 -15
- package/skills/manage-sources/scripts/browse.sh +0 -12
- package/skills/manage-sources/scripts/cancel.sh +0 -14
- package/skills/manage-sources/scripts/create.sh +0 -13
- package/skills/manage-sources/scripts/delete.sh +0 -17
- package/skills/manage-sources/scripts/discoverable.sh +0 -6
- package/skills/manage-sources/scripts/get.sh +0 -7
- package/skills/manage-sources/scripts/kind-schema.sh +0 -7
- package/skills/manage-sources/scripts/kinds.sh +0 -6
- package/skills/manage-sources/scripts/list.sh +0 -6
- package/skills/manage-sources/scripts/purge-index.sh +0 -18
- package/skills/manage-sources/scripts/reindex.sh +0 -13
- package/skills/manage-sources/scripts/reset.sh +0 -11
- package/skills/manage-sources/scripts/set-enabled.sh +0 -17
- package/skills/manage-sources/scripts/sync-status.sh +0 -14
- package/skills/manage-sources/scripts/sync.sh +0 -13
- package/skills/manage-sources/scripts/update.sh +0 -18
- package/skills/manage-uri-policy/scripts/manifests.sh +0 -20
- package/skills/manage-uri-policy/scripts/set-uri.sh +0 -66
- package/skills/manage-uri-policy/scripts/show-uri.sh +0 -23
|
@@ -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}"
|