@neuralis/brain-core 0.3.1 → 0.3.2
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 +41 -40
- package/app/README.md +3 -3
- package/app/filesystem/FilesystemHost.tsx +7 -0
- package/app/filesystem/README.md +1 -1
- package/app/filesystem/api/index.ts +4 -4
- package/app/filesystem/hooks/README.md +1 -1
- package/app/filesystem/hooks/useFilesystemSSE.ts +41 -1
- package/app/filesystem/host/README.md +2 -2
- package/app/filesystem/host/buildFilesystemHostValue.ts +9 -2
- package/app/filesystem/lib/sourceKindForm.ts +109 -5
- package/app/filesystem/store/filesystemStore.ts +13 -3
- package/app/filesystem/ui/DiscoverDock.tsx +5 -1
- package/app/filesystem/ui/FileTree.tsx +34 -8
- package/app/filesystem/ui/FilesystemWidget.tsx +10 -2
- package/app/filesystem/ui/GitControlPanel.tsx +2 -2
- package/app/filesystem/ui/PendingChangesPanel.tsx +1 -1
- package/app/filesystem/ui/README.md +14 -13
- package/app/filesystem/ui/SourcesPanel.tsx +124 -24
- package/app/filesystem/ui/VectorHealthPanel.tsx +2 -2
- package/dist/app/host.js +41 -37
- package/dist/src/channels/filesystem.d.ts +1 -1
- package/dist/src/channels/filesystem.js +1 -1
- package/dist/src/domain/mime.d.ts +3 -3
- package/dist/src/domain/mime.js +3 -3
- package/dist/src/domain/scopeAccessCtx.d.ts +2 -2
- package/dist/src/domain/scopeAccessCtx.js +2 -2
- package/dist/src/domain/types.d.ts +8 -1
- package/dist/src/domain/types.d.ts.map +1 -1
- package/dist/src/events/pending.d.ts +1 -1
- package/dist/src/events/pending.js +1 -1
- package/dist/src/git/sourceGitControl.d.ts +2 -2
- package/dist/src/git/sourceGitControl.js +3 -3
- package/dist/src/lifecycle.d.ts +1 -1
- package/dist/src/routes/approve.d.ts +1 -1
- package/dist/src/routes/approve.js +1 -1
- package/dist/src/routes/events.d.ts +1 -1
- package/dist/src/routes/events.js +1 -1
- package/dist/src/routes/git.d.ts +7 -7
- package/dist/src/routes/git.js +18 -18
- package/dist/src/routes/health.d.ts +6 -6
- package/dist/src/routes/health.js +12 -12
- package/dist/src/routes/helpers/sourceNotConfigured.d.ts +1 -1
- package/dist/src/routes/helpers/sourceNotConfigured.js +1 -1
- package/dist/src/routes/helpers.d.ts +1 -1
- package/dist/src/routes/helpers.js +1 -1
- package/dist/src/routes/list.d.ts +1 -1
- package/dist/src/routes/list.js +1 -1
- package/dist/src/routes/pending.d.ts +4 -4
- package/dist/src/routes/pending.js +9 -9
- package/dist/src/routes/policies.d.ts +4 -4
- package/dist/src/routes/policies.d.ts.map +1 -1
- package/dist/src/routes/policies.js +11 -11
- package/dist/src/routes/policies.js.map +1 -1
- package/dist/src/routes/raw.d.ts +1 -1
- package/dist/src/routes/raw.js +1 -1
- package/dist/src/routes/read.d.ts +1 -1
- package/dist/src/routes/read.js +1 -1
- package/dist/src/routes/search.d.ts +1 -1
- package/dist/src/routes/search.js +1 -1
- package/dist/src/routes/sources.d.ts +20 -5
- package/dist/src/routes/sources.d.ts.map +1 -1
- package/dist/src/routes/sources.js +118 -118
- package/dist/src/routes/sources.js.map +1 -1
- package/dist/src/routes/upload.d.ts +1 -1
- package/dist/src/routes/upload.js +1 -1
- package/dist/src/routes/write.d.ts +2 -2
- package/dist/src/routes/write.js +2 -2
- package/dist/src/services/BridgeService.d.ts +7 -1
- package/dist/src/services/BridgeService.d.ts.map +1 -1
- package/dist/src/services/BridgeService.js +15 -3
- package/dist/src/services/BridgeService.js.map +1 -1
- package/dist/src/services/FilesystemService.d.ts +1 -1
- package/dist/src/services/FilesystemService.js +2 -2
- package/dist/src/services/declaredSources.d.ts +9 -3
- package/dist/src/services/declaredSources.d.ts.map +1 -1
- package/dist/src/services/declaredSources.js +2 -1
- package/dist/src/services/declaredSources.js.map +1 -1
- package/dist/src/tools/execCtx.d.ts +2 -2
- package/dist/src/tools/execCtx.js +2 -2
- package/dist/src/tools/fs_read.d.ts.map +1 -1
- package/dist/src/tools/fs_read.js +5 -0
- package/dist/src/tools/fs_read.js.map +1 -1
- package/dist/src/usecases/embeddingBacklog.js +1 -1
- package/dist/src/usecases/embeddingBacklog.js.map +1 -1
- package/dist/src/usecases/readFiles.d.ts.map +1 -1
- package/dist/src/usecases/readFiles.js +84 -1
- package/dist/src/usecases/readFiles.js.map +1 -1
- package/dist/src/usecases/syncPointWrites.d.ts +2 -0
- package/dist/src/usecases/syncPointWrites.d.ts.map +1 -1
- package/dist/src/usecases/syncPointWrites.js +5 -1
- package/dist/src/usecases/syncPointWrites.js.map +1 -1
- package/dist/src/usecases/vectorMaintenance.js +1 -1
- package/dist/src/usecases/vectorMaintenance.js.map +1 -1
- package/dist/src/usecases/write/content.js +1 -1
- package/dist/tools/fs_list.json +1 -1
- package/dist/tools/fs_read.json +1 -1
- package/dist/tools/fs_search.json +1 -1
- package/dist/tools/fs_write.json +1 -1
- package/instructions/brain-model.md +1 -1
- package/package.json +70 -63
- package/rules/brain-rules.md +2 -2
- package/skills/brain-start/SKILL.md +1 -1
- package/skills/connect-business-data/SKILL.md +1 -1
- package/skills/create-package/SKILL.md +8 -8
- package/skills/create-package/references/connectors-and-uri-policies.md +7 -2
- package/skills/create-package/references/runtime-and-build.md +1 -1
- package/skills/create-package/references/skills-and-context.md +1 -1
- package/skills/create-package/references/test-and-ship.md +4 -4
- package/skills/create-package/scripts/check-package.sh +1 -1
- package/skills/git/SKILL.md +23 -23
- package/skills/manage-files/SKILL.md +13 -13
- package/skills/manage-files/scripts/upload.sh +1 -1
- package/skills/manage-sources/SKILL.md +55 -54
- package/skills/manage-sources/scripts/reembed.sh +1 -1
- package/skills/manage-uri-policy/SKILL.md +9 -9
- package/skills/organize/SKILL.md +1 -1
- package/skills/sync/SKILL.md +2 -2
- package/tools/fs_list.json +1 -1
- package/tools/fs_read.json +1 -1
- package/tools/fs_search.json +1 -1
- package/tools/fs_write.json +1 -1
- package/workflows/sources-digest.json +1 -1
- package/docs/drive-overview.md +0 -59
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "list";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.read";
|
|
4
4
|
export declare const GET: RouteHandler;
|
|
5
5
|
export declare const POST: RouteHandler;
|
|
6
6
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/src/routes/list.js
CHANGED
|
@@ -5,7 +5,7 @@ import { SourceDisabledError, SourcePermissionDeniedError } from '../domain/sour
|
|
|
5
5
|
import { sourceFromUri } from '../domain/uri.js';
|
|
6
6
|
import { describeWalkError } from '../usecases/list.js';
|
|
7
7
|
export const pattern = 'list';
|
|
8
|
-
export const feature = '
|
|
8
|
+
export const feature = 'files.read';
|
|
9
9
|
function parseListRequest(body, query) {
|
|
10
10
|
const req = {};
|
|
11
11
|
const uri = body?.uri ?? query?.uri;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `pending` route (adaptive-growing-lynx) — the REAL project-wide list of
|
|
3
3
|
* revertible pending changes within the Files widget "Changes" tab.
|
|
4
4
|
*
|
|
5
|
-
* Gate: `
|
|
5
|
+
* Gate: `files.read` (every drive user — members who write/edit files need to
|
|
6
6
|
* see their own pending changes). The per-record visibility floor lives in
|
|
7
7
|
* `FilesystemService.listPendingChanges` (owner isolation + uri-policy `read`)
|
|
8
8
|
* because the raw journal read AND the vector scroll both bypass uri-policy.
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
* vector point) WITHOUT a connector, so it clears ORPHANED records that
|
|
41
41
|
* revert/approve choke on. Dismiss is the connector-free clear for a still-LIVE
|
|
42
42
|
* source (orphaned non-delete rows are redirected to discard). The route file
|
|
43
|
-
* stays `
|
|
44
|
-
* adds a `
|
|
43
|
+
* stays `files.read` so GET/list/scan remain member-visible; every MUTATING verb
|
|
44
|
+
* adds a `files.write` gate BEFORE any ctx/service/record lookup, then retains
|
|
45
45
|
* the per-record WRITE floor (synthesized owner-scope).
|
|
46
46
|
*/
|
|
47
47
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
48
48
|
export declare const pattern = "pending";
|
|
49
|
-
export declare const feature = "
|
|
49
|
+
export declare const feature = "files.read";
|
|
50
50
|
export declare const escalations: string[];
|
|
51
51
|
export declare const GET: RouteHandler;
|
|
52
52
|
export declare const POST: RouteHandler;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `pending` route (adaptive-growing-lynx) — the REAL project-wide list of
|
|
3
3
|
* revertible pending changes within the Files widget "Changes" tab.
|
|
4
4
|
*
|
|
5
|
-
* Gate: `
|
|
5
|
+
* Gate: `files.read` (every drive user — members who write/edit files need to
|
|
6
6
|
* see their own pending changes). The per-record visibility floor lives in
|
|
7
7
|
* `FilesystemService.listPendingChanges` (owner isolation + uri-policy `read`)
|
|
8
8
|
* because the raw journal read AND the vector scroll both bypass uri-policy.
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
* vector point) WITHOUT a connector, so it clears ORPHANED records that
|
|
41
41
|
* revert/approve choke on. Dismiss is the connector-free clear for a still-LIVE
|
|
42
42
|
* source (orphaned non-delete rows are redirected to discard). The route file
|
|
43
|
-
* stays `
|
|
44
|
-
* adds a `
|
|
43
|
+
* stays `files.read` so GET/list/scan remain member-visible; every MUTATING verb
|
|
44
|
+
* adds a `files.write` gate BEFORE any ctx/service/record lookup, then retains
|
|
45
45
|
* the per-record WRITE floor (synthesized owner-scope).
|
|
46
46
|
*/
|
|
47
47
|
import { hasFeature } from '@neuralis/package-system/access';
|
|
@@ -49,10 +49,10 @@ import { SourcePermissionDeniedError } from '../domain/sourceConfig.js';
|
|
|
49
49
|
import { extractCtx, ensureAccess, getServices, httpError } from './helpers.js';
|
|
50
50
|
import { parsePendingReviewIntent } from '../usecases/pendingReview.js';
|
|
51
51
|
export const pattern = 'pending';
|
|
52
|
-
export const feature = '
|
|
52
|
+
export const feature = 'files.read';
|
|
53
53
|
// Every mutating verb (revert / discard / dismiss / discard-orphans) escalates
|
|
54
54
|
// in-handler; the module gate keeps GET/list/scan member-visible.
|
|
55
|
-
export const escalations = ['
|
|
55
|
+
export const escalations = ['files.write'];
|
|
56
56
|
function parseFilter(body, query) {
|
|
57
57
|
const pick = (key) => {
|
|
58
58
|
const fromBody = body?.[key];
|
|
@@ -142,15 +142,15 @@ export const POST = async (req, raw) => {
|
|
|
142
142
|
|| action === 'discard'
|
|
143
143
|
|| action === 'dismiss'
|
|
144
144
|
|| action === 'discard-orphans';
|
|
145
|
-
// The route file stays `
|
|
145
|
+
// The route file stays `files.read` so GET/list/scan remain member-visible;
|
|
146
146
|
// every mutation adds the stronger gate BEFORE ctx/service/record lookup.
|
|
147
|
-
if (mutates && !hasFeature(req.session, '
|
|
147
|
+
if (mutates && !hasFeature(req.session, 'files.write')) {
|
|
148
148
|
return {
|
|
149
149
|
status: 403,
|
|
150
150
|
body: {
|
|
151
|
-
error: "Forbidden: missing feature '
|
|
151
|
+
error: "Forbidden: missing feature 'files.write'",
|
|
152
152
|
code: 'feature_denied',
|
|
153
|
-
feature: '
|
|
153
|
+
feature: 'files.write',
|
|
154
154
|
},
|
|
155
155
|
};
|
|
156
156
|
}
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
* payload.
|
|
26
26
|
*
|
|
27
27
|
* TWO ARMS, TWO GATES — and no role-name check on either. The module feature
|
|
28
|
-
* (`feature` below) is `
|
|
28
|
+
* (`feature` below) is `files.read`, which every built-in role holds down to
|
|
29
29
|
* `viewer`, so READING an effective policy is a member-tier operation. WRITING
|
|
30
|
-
* escalates in-handler to `
|
|
31
|
-
* caller without it with 403 `Missing feature:
|
|
30
|
+
* escalates in-handler to `sources.policy` (`escalations` below) and answers a
|
|
31
|
+
* caller without it with 403 `Missing feature: sources.policy (URI policy
|
|
32
32
|
* editing)`. That id has no grant below the `admin` tier (enumerated for
|
|
33
33
|
* `admin`, `'*'` for `owner`) and is grantable to any custom role, so a custom
|
|
34
34
|
* role holding it patches policies exactly like the built-in `admin` does.
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
*/
|
|
42
42
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
43
43
|
export declare const pattern = "policies/*";
|
|
44
|
-
export declare const feature = "
|
|
44
|
+
export declare const feature = "files.read";
|
|
45
45
|
export declare const escalations: string[];
|
|
46
46
|
export declare const GET: RouteHandler;
|
|
47
47
|
export declare const POST: RouteHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,oCAAoC,CAAC;AAY5C,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,oCAAoC,CAAC;AAY5C,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,eAAO,MAAM,WAAW,UAAqB,CAAC;AAE9C,eAAO,MAAM,GAAG,EAAE,YAsBjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAqFlB,CAAC"}
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
* payload.
|
|
26
26
|
*
|
|
27
27
|
* TWO ARMS, TWO GATES — and no role-name check on either. The module feature
|
|
28
|
-
* (`feature` below) is `
|
|
28
|
+
* (`feature` below) is `files.read`, which every built-in role holds down to
|
|
29
29
|
* `viewer`, so READING an effective policy is a member-tier operation. WRITING
|
|
30
|
-
* escalates in-handler to `
|
|
31
|
-
* caller without it with 403 `Missing feature:
|
|
30
|
+
* escalates in-handler to `sources.policy` (`escalations` below) and answers a
|
|
31
|
+
* caller without it with 403 `Missing feature: sources.policy (URI policy
|
|
32
32
|
* editing)`. That id has no grant below the `admin` tier (enumerated for
|
|
33
33
|
* `admin`, `'*'` for `owner`) and is grantable to any custom role, so a custom
|
|
34
34
|
* role holding it patches policies exactly like the built-in `admin` does.
|
|
@@ -45,9 +45,9 @@ import { canAccessScope } from '@neuralis/package-system/contracts';
|
|
|
45
45
|
import { containsPolicyFloorMarker, ImmutablePolicyFloorError, } from '@neuralis/package-system/policies';
|
|
46
46
|
import { normalizeSource } from '../domain/source.js';
|
|
47
47
|
export const pattern = 'policies/*';
|
|
48
|
-
export const feature = '
|
|
49
|
-
// C9 — POST escalates to `
|
|
50
|
-
export const escalations = ['
|
|
48
|
+
export const feature = 'files.read';
|
|
49
|
+
// C9 — POST escalates to `sources.policy` in-handler (read tier is files.read).
|
|
50
|
+
export const escalations = ['sources.policy'];
|
|
51
51
|
export const GET = async (req, raw) => {
|
|
52
52
|
const state = raw;
|
|
53
53
|
const [sub, sub2] = req.path;
|
|
@@ -75,11 +75,11 @@ export const POST = async (req, raw) => {
|
|
|
75
75
|
if (sub !== 'uri')
|
|
76
76
|
return { status: 404, body: { error: 'Unknown policies sub-resource' } };
|
|
77
77
|
const ctx = extractCtx(req);
|
|
78
|
-
// C8 — uri-policy editing escalates to the `
|
|
78
|
+
// C8 — uri-policy editing escalates to the `sources.policy` feature: no grant
|
|
79
79
|
// below the `admin` tier (enumerated for `admin`, `'*'` for `owner`),
|
|
80
80
|
// grantable to any custom role. Replaces the hardcoded role-name check.
|
|
81
|
-
if (!hasFeature({ grantedFeatures: ctx.grantedFeatures }, '
|
|
82
|
-
return { status: 403, body: { error: 'Missing feature:
|
|
81
|
+
if (!hasFeature({ grantedFeatures: ctx.grantedFeatures }, 'sources.policy')) {
|
|
82
|
+
return { status: 403, body: { error: 'Missing feature: sources.policy (URI policy editing)' } };
|
|
83
83
|
}
|
|
84
84
|
await ensureAccess(ctx, state);
|
|
85
85
|
const body = (req.body ?? {});
|
|
@@ -108,8 +108,8 @@ export const POST = async (req, raw) => {
|
|
|
108
108
|
// Mirror the sibling mutations in `sources.ts` (PATCH/enabled/DELETE): editing
|
|
109
109
|
// a cross-user/cross-agent source's uri-policy paths[] is a WRITE on that
|
|
110
110
|
// scope, not just a read. `getSourceConfig` already requires scope `read`
|
|
111
|
-
// (
|
|
112
|
-
// holder of `
|
|
111
|
+
// (files.readOthers); without this an `files.readOthers`-but-not-`files.writeOthers`
|
|
112
|
+
// holder of `sources.policy` could rewrite a scoped source's paths[].
|
|
113
113
|
if (!canAccessScope(existing.scope, toScopeAccessCtx(ctx), 'write')) {
|
|
114
114
|
return { status: 403, body: { error: 'Forbidden for source scope' } };
|
|
115
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAQH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/routes/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "raw";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.read";
|
|
4
4
|
export declare const GET: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=raw.d.ts.map
|
package/dist/src/routes/raw.js
CHANGED
|
@@ -2,7 +2,7 @@ import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { buildRawResponseHeaders } from '../domain/mime.js';
|
|
4
4
|
export const pattern = 'raw';
|
|
5
|
-
export const feature = '
|
|
5
|
+
export const feature = 'files.read';
|
|
6
6
|
export const GET = async (req, raw) => {
|
|
7
7
|
const state = raw;
|
|
8
8
|
const ctx = extractCtx(req);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "read";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.read";
|
|
4
4
|
export declare const POST: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=read.d.ts.map
|
package/dist/src/routes/read.js
CHANGED
|
@@ -2,7 +2,7 @@ import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { SourceDisabledError } from '../domain/sourceConfig.js';
|
|
4
4
|
export const pattern = 'read';
|
|
5
|
-
export const feature = '
|
|
5
|
+
export const feature = 'files.read';
|
|
6
6
|
/**
|
|
7
7
|
* Normalize ONE `files[]` entry to the internal reference shape, taking an
|
|
8
8
|
* EXPLICIT field allowlist off the object form (this route is not AJV-gated,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
2
2
|
export declare const pattern = "search";
|
|
3
|
-
export declare const feature = "
|
|
3
|
+
export declare const feature = "files.search";
|
|
4
4
|
export declare const POST: RouteHandler;
|
|
5
5
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { extractCtx, ensureAccess, getServices } from './helpers.js';
|
|
|
2
2
|
import { assertUriCapability, uriPolicyDeniedResponse, UriPolicyDeniedError, } from './helpers/uriGuard.js';
|
|
3
3
|
import { SourceDisabledError } from '../domain/sourceConfig.js';
|
|
4
4
|
export const pattern = 'search';
|
|
5
|
-
export const feature = '
|
|
5
|
+
export const feature = 'files.search';
|
|
6
6
|
/**
|
|
7
7
|
* SECONDARY search surface (skill-script `curl` to `/brain-core/search`). The
|
|
8
8
|
* PRIMARY model-facing path is the `fs_search` TOOL (`tools/fs_search.ts`),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* GET /sources/:slug — get single source config
|
|
7
7
|
* GET /sources/kinds — list registered source kinds (+ trust, package attribution)
|
|
8
8
|
* GET /sources/kinds/:kind/schema — JSON Schema for admin source form
|
|
9
|
-
* GET /sources/discoverable — well-known unattached source roots (W3E;
|
|
9
|
+
* GET /sources/discoverable — well-known unattached source roots (W3E; sources.mount)
|
|
10
10
|
* POST /sources — create source
|
|
11
11
|
* POST /sources/preflight — validate/authorize create without writing
|
|
12
12
|
* PATCH /sources — update source
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* POST /sources/reset — reset sync state (cancels active job)
|
|
19
19
|
* GET /sources/sync-status — job status (?source= single, else all visible)
|
|
20
20
|
* POST /sources/enabled — light enable/disable toggle (W3K)
|
|
21
|
-
* GET /sources/browse — browse filesystem directories (
|
|
21
|
+
* GET /sources/browse — browse filesystem directories (sources.mount;
|
|
22
22
|
* protected zones + the fs root need
|
|
23
|
-
*
|
|
23
|
+
* sources.privileged)
|
|
24
24
|
* GET /sources/health — get sources health
|
|
25
25
|
*
|
|
26
26
|
* Sync-shaped POSTs return 202 + a SyncQueueJobSnapshot: the run executes on
|
|
@@ -30,12 +30,27 @@
|
|
|
30
30
|
import type { RouteHandler } from '@neuralis/package-system/contracts';
|
|
31
31
|
import { type RuntimeStackInfo } from '@neuralis/package-system/paths';
|
|
32
32
|
export declare const pattern = "sources/*";
|
|
33
|
-
export declare const feature = "
|
|
33
|
+
export declare const feature = "files.read";
|
|
34
34
|
export declare const escalations: string[];
|
|
35
35
|
export declare const GET: RouteHandler;
|
|
36
36
|
export declare const POST: RouteHandler;
|
|
37
37
|
export declare const PATCH: RouteHandler;
|
|
38
38
|
export declare const DELETE: RouteHandler;
|
|
39
|
+
/**
|
|
40
|
+
* The HOST plane (a `host`/`host-*` kind — a paired device, outside the
|
|
41
|
+
* container) has ONE attach rule: the device's owner, holding `device.own`,
|
|
42
|
+
* attaches or edits a source on it, and nobody else does. agent-core's device
|
|
43
|
+
* gate (`devices.mayAttach`) answers both halves; brain-core keeps no host-plane
|
|
44
|
+
* feature of its own. `sources.mount` is a MANAGER default and never reaches a
|
|
45
|
+
* device: a non-owner is refused whatever the role grants, so a manager cannot
|
|
46
|
+
* attach someone's machine at `/` and get read/write over it through `fs_*`.
|
|
47
|
+
* That device's own allowlist (`neuralis device grant`) still bounds what the
|
|
48
|
+
* owner's source can reach.
|
|
49
|
+
*
|
|
50
|
+
* `isHostPlaneKind` lives in `@neuralis/package-system/contracts` — imported,
|
|
51
|
+
* never re-declared. Two copies of a plane predicate is how the attach gate and
|
|
52
|
+
* the terminal gate drift apart while both look correct in isolation.
|
|
53
|
+
*/
|
|
39
54
|
/**
|
|
40
55
|
* How a requested path is compared against a protected zone.
|
|
41
56
|
*
|
|
@@ -57,7 +72,7 @@ type ProtectedRoot = {
|
|
|
57
72
|
/**
|
|
58
73
|
* Build the filter-free protected-root table from the runtime stack. App Zone,
|
|
59
74
|
* the Neuralis source tree, and the whole host (`/`) all require
|
|
60
|
-
* `
|
|
75
|
+
* `sources.privileged`. `/` is ALWAYS included (both Docker and native) so
|
|
61
76
|
* the ADD gate catches a raw `config.root:'/'` attach that has no discoverable
|
|
62
77
|
* suggestion under Docker.
|
|
63
78
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/routes/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/routes/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAuB,YAAY,EAAgC,MAAM,oCAAoC,CAAC;AAU1H,OAAO,EAAuD,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAkB5H,eAAO,MAAM,OAAO,cAAc,CAAC;AACnC,eAAO,MAAM,OAAO,eAAe,CAAC;AAKpC,eAAO,MAAM,WAAW,UAKvB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,YA8FjB,CAAC;AAyDF,eAAO,MAAM,IAAI,EAAE,YAsClB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAGnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAKpB,CAAC;AAuSF;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,KAAK,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAEnD,KAAK,aAAa,GAAG;IACnB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,EAAE,CAM/F;AA4BD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,aAAa,EAAE,EAC/B,IAAI,EAAE,KAAK,GAAG,KAAK,EACnB,IAAI,GAAE,aAA6B,GAClC,MAAM,EAAE,CASV"}
|