sylo-fieldbrain 0.1.0 → 0.1.1

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 (72) hide show
  1. package/.github/workflows/publish.yml +30 -0
  2. package/extensions/index.ts +12 -12
  3. package/extensions/python-runner.ts +56 -56
  4. package/package.json +27 -10
  5. package/scripts/_db_lib.py +228 -228
  6. package/scripts/_json_out.py +19 -19
  7. package/scripts/alembic/env.py +53 -53
  8. package/scripts/alembic/versions/001_baseline.py +38 -38
  9. package/scripts/alembic/versions/002_core_tables.py +429 -429
  10. package/scripts/alembic/versions/003_durability_content_in_db.py +106 -106
  11. package/scripts/alembic/versions/004_pgvector_embedding.py +42 -42
  12. package/scripts/alembic/versions/005_project_job_number.py +37 -37
  13. package/scripts/alembic/versions/006_project_parent.py +62 -62
  14. package/scripts/alembic/versions/__init__.py +1 -1
  15. package/scripts/alembic.ini +38 -38
  16. package/scripts/db_auto_migrate.py +103 -103
  17. package/scripts/db_bootstrap.py +207 -207
  18. package/scripts/db_check.py +105 -105
  19. package/scripts/db_migrate.py +85 -85
  20. package/scripts/fieldbrain_brain_delete.py +49 -49
  21. package/scripts/fieldbrain_brain_read.py +61 -61
  22. package/scripts/fieldbrain_brain_restore.py +49 -49
  23. package/scripts/fieldbrain_brain_revisions.py +54 -54
  24. package/scripts/fieldbrain_brain_write.py +67 -67
  25. package/scripts/fieldbrain_document_attach.py +81 -81
  26. package/scripts/fieldbrain_document_catalog.py +128 -128
  27. package/scripts/fieldbrain_document_ingest.py +62 -62
  28. package/scripts/fieldbrain_document_list.py +67 -67
  29. package/scripts/fieldbrain_document_promote.py +43 -43
  30. package/scripts/fieldbrain_log_create.py +55 -55
  31. package/scripts/fieldbrain_log_delete.py +39 -39
  32. package/scripts/fieldbrain_log_restore.py +39 -39
  33. package/scripts/fieldbrain_log_revisions.py +39 -39
  34. package/scripts/fieldbrain_log_search.py +58 -58
  35. package/scripts/fieldbrain_log_update.py +52 -52
  36. package/scripts/fieldbrain_project_list.py +53 -53
  37. package/scripts/fieldbrain_search.py +74 -74
  38. package/scripts/fieldbrain_ui_brain_list.py +60 -60
  39. package/scripts/fieldbrain_ui_project_list.py +49 -49
  40. package/scripts/models.py +355 -355
  41. package/scripts/pgvector_enable.py +165 -165
  42. package/scripts/pgvector_guide.py +44 -44
  43. package/scripts/pgvector_install_files.py +66 -66
  44. package/scripts/pgvector_install_from_folder.py +148 -148
  45. package/scripts/postbuild-ui.mjs +13 -13
  46. package/scripts/requirements.txt +7 -7
  47. package/scripts/services/__init__.py +1 -1
  48. package/scripts/services/brain_paths.py +81 -81
  49. package/scripts/services/brain_service.py +280 -280
  50. package/scripts/services/document_catalog.py +186 -186
  51. package/scripts/services/document_formats.py +116 -116
  52. package/scripts/services/document_ingest.py +254 -254
  53. package/scripts/services/document_service.py +316 -316
  54. package/scripts/services/embedding_service.py +72 -72
  55. package/scripts/services/global_brain_support.py +36 -36
  56. package/scripts/services/maintenance_log_service.py +258 -258
  57. package/scripts/services/migrate_lock.py +24 -24
  58. package/scripts/services/pgvector_windows.py +190 -190
  59. package/scripts/services/search_service.py +250 -250
  60. package/shared/README.md +7 -7
  61. package/skills/fieldbrain/SKILL.md.bak +83 -83
  62. package/skills/fieldbrain/routes/fieldbrain/fallback.md +7 -7
  63. package/scripts/__pycache__/_db_lib.cpython-312.pyc +0 -0
  64. package/scripts/__pycache__/_json_out.cpython-312.pyc +0 -0
  65. package/scripts/__pycache__/models.cpython-312.pyc +0 -0
  66. package/scripts/services/__pycache__/__init__.cpython-312.pyc +0 -0
  67. package/scripts/services/__pycache__/brain_paths.cpython-312.pyc +0 -0
  68. package/scripts/services/__pycache__/document_formats.cpython-312.pyc +0 -0
  69. package/scripts/services/__pycache__/document_service.cpython-312.pyc +0 -0
  70. package/scripts/services/__pycache__/pgvector_windows.cpython-312.pyc +0 -0
  71. package/scripts/services/__pycache__/project_naming.cpython-312.pyc +0 -0
  72. package/scripts/services/__pycache__/project_service.cpython-312.pyc +0 -0
@@ -0,0 +1,30 @@
1
+ # Publishes to npm via Trusted Publishing (OIDC — no tokens).
2
+ # npm side: package Settings -> Trusted publishing -> GitHub Actions ->
3
+ # user Yeti-Trix, this repo, workflow filename publish.yml.
4
+ # Release flow: bump package.json version -> commit -> tag vX.Y.Z -> push tag.
5
+ # Provenance attestations are generated automatically (public repo + package).
6
+ name: Publish Package
7
+
8
+ on:
9
+ push:
10
+ tags:
11
+ - 'v*'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ id-token: write
16
+ contents: read
17
+
18
+ jobs:
19
+ publish:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+ - uses: actions/setup-node@v6
24
+ with:
25
+ node-version: '24'
26
+ registry-url: 'https://registry.npmjs.org'
27
+ package-manager-cache: false
28
+ - run: npm install
29
+ - run: npm run build --if-present
30
+ - run: npm publish
@@ -1,12 +1,12 @@
1
- /**
2
- * sylo-fieldbrain — shared shop knowledge (projects, docs, brains, maintenance notes).
3
- *
4
- * @see features_tracker/active/2026-07-04_14-56-00_sylo_fieldbrain_package_migration.md
5
- */
6
- import type { ExtensionAPI } from '@earendil-works/pi-coding-agent'
7
-
8
- import { registerFieldBrainTools } from './fieldbrain-tools.js'
9
-
10
- export default function piSyloFieldBrainExtension(pi: ExtensionAPI): void {
11
- registerFieldBrainTools(pi)
12
- }
1
+ /**
2
+ * sylo-fieldbrain — shared shop knowledge (projects, docs, brains, maintenance notes).
3
+ *
4
+ * @see features_tracker/active/2026-07-04_14-56-00_sylo_fieldbrain_package_migration.md
5
+ */
6
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent'
7
+
8
+ import { registerFieldBrainTools } from './fieldbrain-tools.js'
9
+
10
+ export default function piSyloFieldBrainExtension(pi: ExtensionAPI): void {
11
+ registerFieldBrainTools(pi)
12
+ }
@@ -1,56 +1,56 @@
1
- import { execFile } from 'node:child_process'
2
- import { promisify } from 'node:util'
3
- import { fileURLToPath } from 'node:url'
4
- import path from 'node:path'
5
-
6
- const execFileAsync = promisify(execFile)
7
-
8
- export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
9
- export const SCRIPTS_DIR = path.join(PACKAGE_ROOT, 'scripts')
10
-
11
- export type ToolContentBlock = { type: 'text'; text: string }
12
-
13
- function resolvePython(): { command: string; prefixArgs: string[] } {
14
- const envPython = process.env.SYLO_PYTHON?.trim()
15
- if (envPython) {
16
- return { command: envPython, prefixArgs: [] }
17
- }
18
- return { command: process.platform === 'win32' ? 'python' : 'python3', prefixArgs: [] }
19
- }
20
-
21
- export function toolError(text: string): { content: ToolContentBlock[] } {
22
- return { content: [{ type: 'text', text }] }
23
- }
24
-
25
- export async function runPythonScript(
26
- scriptName: string,
27
- args: string[] = [],
28
- timeoutMs = 120_000,
29
- ): Promise<{ content: ToolContentBlock[] }> {
30
- const scriptPath = path.join(SCRIPTS_DIR, scriptName)
31
- const { command, prefixArgs } = resolvePython()
32
- try {
33
- const { stdout, stderr } = await execFileAsync(command, [...prefixArgs, scriptPath, ...args], {
34
- cwd: PACKAGE_ROOT,
35
- maxBuffer: 8 * 1024 * 1024,
36
- windowsHide: true,
37
- timeout: timeoutMs,
38
- env: { ...process.env },
39
- })
40
- const trimmed = stdout.trim()
41
- if (!trimmed) {
42
- return toolError(stderr.trim() || `${scriptName} produced no output`)
43
- }
44
- const parsed = JSON.parse(trimmed) as { ok?: boolean; error?: string; operator_chat?: string }
45
- if (parsed.ok === false) {
46
- return toolError(parsed.error ?? `${scriptName} failed`)
47
- }
48
- if (typeof parsed.operator_chat === 'string' && parsed.operator_chat.trim()) {
49
- return { content: [{ type: 'text', text: parsed.operator_chat.trim() }] }
50
- }
51
- return { content: [{ type: 'text', text: trimmed }] }
52
- } catch (err) {
53
- const message = err instanceof Error ? err.message : String(err)
54
- return toolError(message)
55
- }
56
- }
1
+ import { execFile } from 'node:child_process'
2
+ import { promisify } from 'node:util'
3
+ import { fileURLToPath } from 'node:url'
4
+ import path from 'node:path'
5
+
6
+ const execFileAsync = promisify(execFile)
7
+
8
+ export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
9
+ export const SCRIPTS_DIR = path.join(PACKAGE_ROOT, 'scripts')
10
+
11
+ export type ToolContentBlock = { type: 'text'; text: string }
12
+
13
+ function resolvePython(): { command: string; prefixArgs: string[] } {
14
+ const envPython = process.env.SYLO_PYTHON?.trim()
15
+ if (envPython) {
16
+ return { command: envPython, prefixArgs: [] }
17
+ }
18
+ return { command: process.platform === 'win32' ? 'python' : 'python3', prefixArgs: [] }
19
+ }
20
+
21
+ export function toolError(text: string): { content: ToolContentBlock[] } {
22
+ return { content: [{ type: 'text', text }] }
23
+ }
24
+
25
+ export async function runPythonScript(
26
+ scriptName: string,
27
+ args: string[] = [],
28
+ timeoutMs = 120_000,
29
+ ): Promise<{ content: ToolContentBlock[] }> {
30
+ const scriptPath = path.join(SCRIPTS_DIR, scriptName)
31
+ const { command, prefixArgs } = resolvePython()
32
+ try {
33
+ const { stdout, stderr } = await execFileAsync(command, [...prefixArgs, scriptPath, ...args], {
34
+ cwd: PACKAGE_ROOT,
35
+ maxBuffer: 8 * 1024 * 1024,
36
+ windowsHide: true,
37
+ timeout: timeoutMs,
38
+ env: { ...process.env },
39
+ })
40
+ const trimmed = stdout.trim()
41
+ if (!trimmed) {
42
+ return toolError(stderr.trim() || `${scriptName} produced no output`)
43
+ }
44
+ const parsed = JSON.parse(trimmed) as { ok?: boolean; error?: string; operator_chat?: string }
45
+ if (parsed.ok === false) {
46
+ return toolError(parsed.error ?? `${scriptName} failed`)
47
+ }
48
+ if (typeof parsed.operator_chat === 'string' && parsed.operator_chat.trim()) {
49
+ return { content: [{ type: 'text', text: parsed.operator_chat.trim() }] }
50
+ }
51
+ return { content: [{ type: 'text', text: trimmed }] }
52
+ } catch (err) {
53
+ const message = err instanceof Error ? err.message : String(err)
54
+ return toolError(message)
55
+ }
56
+ }
package/package.json CHANGED
@@ -1,19 +1,11 @@
1
1
  {
2
2
  "name": "sylo-fieldbrain",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "FieldBrain — shared shop knowledge (projects, docs, brains, maintenance notes)",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "pi-package"
8
8
  ],
9
- "files": [
10
- "extensions",
11
- "scripts",
12
- "shared",
13
- "skills",
14
- "README.md",
15
- "LICENSE"
16
- ],
17
9
  "scripts": {
18
10
  "build:ui": "vite build --config ui/vite.config.ts && node scripts/postbuild-ui.mjs"
19
11
  },
@@ -40,5 +32,30 @@
40
32
  "typescript": "^5.7.3",
41
33
  "vite": "^6.4.3"
42
34
  },
43
- "license": "MIT"
35
+ "license": "MIT",
36
+ "gitHead": "f05700bce9bf8ef8574894f24a8a3fa71da11d61",
37
+ "dist": {
38
+ "integrity": "sha512-62UYi0DcgbL1c5CI0v2ZDmUxM9jeAORPNFfn4ge6ycO7WegIwFYZv7twa0KiJ6gKAIXPUD8gq2WTk2U8AQeIFg==",
39
+ "shasum": "376e8c8eaa305754fc4de17f12a43e84bc29411e",
40
+ "tarball": "https://registry.npmjs.org/sylo-fieldbrain/-/sylo-fieldbrain-0.1.0.tgz",
41
+ "fileCount": 83,
42
+ "unpackedSize": 567514,
43
+ "signatures": [
44
+ {
45
+ "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
46
+ "sig": "MEUCIH6ZoxJ/s3llpwRyDU6G4rAFNg8LG4F+6OIkN3DitnjcAiEA0QK5v38raDGObRdfClmz/ekj+UDQj7nGXGFxyCa/u6s="
47
+ }
48
+ ]
49
+ },
50
+ "directories": {},
51
+ "maintainers": [
52
+ {
53
+ "name": "yeti-trix",
54
+ "email": "spencer.current@gmail.com"
55
+ }
56
+ ],
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/Yeti-Trix/sylo-fieldbrain.git"
60
+ }
44
61
  }