spine-framework 0.3.115 → 0.3.116
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-framework",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.116",
|
|
4
4
|
"description": "Multi-tenant, modular application platform for modern SaaS systems",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
".framework/migrations/028_fix_message_data_permissions.sql",
|
|
38
38
|
".framework/migrations/029_tighten_support_triage_prompt.sql",
|
|
39
39
|
".framework/migrations/030_messages_updated_by.sql",
|
|
40
|
-
".framework/migrations/031_cil_vector_types.sql",
|
|
41
|
-
".framework/migrations/032_cil_agent_config.sql",
|
|
42
|
-
".framework/migrations/033_cil_chunk_schema_fields.sql",
|
|
43
|
-
".framework/migrations/034_cil_self_seed.sql",
|
|
44
40
|
".framework/public/",
|
|
45
41
|
".framework/scripts/",
|
|
46
42
|
".framework/seeds/",
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
-- Migration 031: CIL vector types — patch cil_chunk type design_schema
|
|
2
|
-
--
|
|
3
|
-
-- The seed file (custom/apps/cortex/seed/types.json) defines cil_chunk with
|
|
4
|
-
-- no vector_types because the generate() function in embeddings.ts reads
|
|
5
|
-
-- vector_types from the type's design_schema at runtime.
|
|
6
|
-
--
|
|
7
|
-
-- This migration patches in the three CIL vector types for cil_chunk so that
|
|
8
|
-
-- calls to generate() produce semantic, structural, and contract vectors.
|
|
9
|
-
--
|
|
10
|
-
-- Also adds vector_types for cil_config (semantic only) and cil_project (semantic).
|
|
11
|
-
--
|
|
12
|
-
-- Safe to re-run: uses jsonb_set which is idempotent on the same value.
|
|
13
|
-
--
|
|
14
|
-
-- NOTE: This only patches rows where the type already exists. The seed must
|
|
15
|
-
-- have been applied (via spine install-app) before this migration runs.
|
|
16
|
-
|
|
17
|
-
-- ── cil_chunk: semantic + structural + contract ───────────────────────────────
|
|
18
|
-
UPDATE public.types
|
|
19
|
-
SET design_schema = jsonb_set(
|
|
20
|
-
design_schema,
|
|
21
|
-
'{vector_types}',
|
|
22
|
-
'["semantic", "structural", "contract"]'::jsonb,
|
|
23
|
-
true -- create if missing
|
|
24
|
-
)
|
|
25
|
-
WHERE kind = 'item'
|
|
26
|
-
AND slug = 'cil_chunk';
|
|
27
|
-
|
|
28
|
-
-- ── cil_project: semantic only (project descriptions) ─────────────────────────
|
|
29
|
-
UPDATE public.types
|
|
30
|
-
SET design_schema = jsonb_set(
|
|
31
|
-
design_schema,
|
|
32
|
-
'{vector_types}',
|
|
33
|
-
'["semantic"]'::jsonb,
|
|
34
|
-
true
|
|
35
|
-
)
|
|
36
|
-
WHERE kind = 'item'
|
|
37
|
-
AND slug = 'cil_project';
|
|
38
|
-
|
|
39
|
-
-- ── cil_config: semantic (config field descriptions) ──────────────────────────
|
|
40
|
-
UPDATE public.types
|
|
41
|
-
SET design_schema = jsonb_set(
|
|
42
|
-
design_schema,
|
|
43
|
-
'{vector_types}',
|
|
44
|
-
'["semantic"]'::jsonb,
|
|
45
|
-
true
|
|
46
|
-
)
|
|
47
|
-
WHERE kind = 'item'
|
|
48
|
-
AND slug = 'cil_config';
|
|
49
|
-
|
|
50
|
-
-- ── embedding_fields for cil_chunk structural vector ─────────────────────────
|
|
51
|
-
-- structural vector uses these fields from item.data for its JSON snapshot
|
|
52
|
-
UPDATE public.types
|
|
53
|
-
SET design_schema = jsonb_set(
|
|
54
|
-
design_schema,
|
|
55
|
-
'{embedding_fields,structural}',
|
|
56
|
-
'["chunk_type","file_path","stability","is_dead_code","boundary_confidence","doc_confidence","review_status"]'::jsonb,
|
|
57
|
-
true
|
|
58
|
-
)
|
|
59
|
-
WHERE kind = 'item'
|
|
60
|
-
AND slug = 'cil_chunk';
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
-- Migration 032: CIL AI Agent + Prompt Config
|
|
2
|
-
--
|
|
3
|
-
-- Seeds the Code Intelligence Layer conversational agent so it can answer
|
|
4
|
-
-- questions about the codebase using cil_chunk embeddings as RAG context.
|
|
5
|
-
--
|
|
6
|
-
-- The agent is scoped to the Cortex app (is_system = false so it can be
|
|
7
|
-
-- overridden per-tenant). A second system-level prompt config with
|
|
8
|
-
-- retrieval_policy.item_types = ["cil_chunk"] ensures the agent only pulls
|
|
9
|
-
-- code chunk embeddings rather than KB articles.
|
|
10
|
-
--
|
|
11
|
-
-- Safe to re-run: uses INSERT ... ON CONFLICT DO NOTHING on (app_id, name)
|
|
12
|
-
-- and ON CONFLICT (slug) DO NOTHING for prompt_configs.
|
|
13
|
-
|
|
14
|
-
-- ── CIL Conversational Agent ─────────────────────────────────────────────────
|
|
15
|
-
INSERT INTO public.ai_agents (
|
|
16
|
-
id,
|
|
17
|
-
app_id,
|
|
18
|
-
name,
|
|
19
|
-
description,
|
|
20
|
-
agent_type,
|
|
21
|
-
system_prompt,
|
|
22
|
-
model_config,
|
|
23
|
-
ownership,
|
|
24
|
-
is_system,
|
|
25
|
-
is_active,
|
|
26
|
-
created_at,
|
|
27
|
-
updated_at
|
|
28
|
-
)
|
|
29
|
-
SELECT
|
|
30
|
-
gen_random_uuid(),
|
|
31
|
-
(SELECT id FROM public.apps WHERE slug = 'cortex'),
|
|
32
|
-
'CIL Codebase Assistant',
|
|
33
|
-
'Conversational agent that answers questions about the codebase using the Code Intelligence Layer. Retrieves chunk contracts, call graphs, and documentation via semantic search.',
|
|
34
|
-
'rag',
|
|
35
|
-
'You are a Code Intelligence Layer assistant. Your job is to answer questions about this codebase accurately and concisely.
|
|
36
|
-
|
|
37
|
-
You have access to a semantic index of every named chunk in the codebase. Each chunk record contains:
|
|
38
|
-
- chunk_name: the function / class / component name
|
|
39
|
-
- macro: one-sentence purpose statement
|
|
40
|
-
- micro: implementation detail
|
|
41
|
-
- input_spec: parameter names, types, constraints
|
|
42
|
-
- output_spec: return type and shape
|
|
43
|
-
- side_effects: DB writes, API calls, file I/O
|
|
44
|
-
- stability: stable | internal | experimental
|
|
45
|
-
- file_path: source file location
|
|
46
|
-
|
|
47
|
-
When answering:
|
|
48
|
-
1. Ground your answer in the retrieved chunk contracts — do not invent APIs.
|
|
49
|
-
2. Always cite the chunk_name and file_path when referencing a specific function.
|
|
50
|
-
3. If you cannot find a relevant chunk, say so explicitly — do not guess.
|
|
51
|
-
4. For refactoring questions, always mention callers / blast radius if known.
|
|
52
|
-
5. Keep answers concise. Use markdown code blocks for code examples.
|
|
53
|
-
6. If asked "is X safe to change?", check if stability = stable before confirming.
|
|
54
|
-
|
|
55
|
-
Avoid hallucinating parameter names, return types, or side effects that are not in the retrieved contracts.',
|
|
56
|
-
'{"model": "gpt-4o-mini", "temperature": 0.2, "max_tokens": 1500}',
|
|
57
|
-
'platform',
|
|
58
|
-
false,
|
|
59
|
-
true,
|
|
60
|
-
now(),
|
|
61
|
-
now()
|
|
62
|
-
WHERE NOT EXISTS (
|
|
63
|
-
SELECT 1 FROM public.ai_agents
|
|
64
|
-
WHERE app_id = (SELECT id FROM public.apps WHERE slug = 'cortex')
|
|
65
|
-
AND name = 'CIL Codebase Assistant'
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
-- ── CIL Agent Prompt Config ───────────────────────────────────────────────────
|
|
69
|
-
INSERT INTO public.prompt_configs (
|
|
70
|
-
id,
|
|
71
|
-
app_id,
|
|
72
|
-
slug,
|
|
73
|
-
name,
|
|
74
|
-
context_template,
|
|
75
|
-
model,
|
|
76
|
-
temperature,
|
|
77
|
-
max_tokens,
|
|
78
|
-
is_multi_turn,
|
|
79
|
-
max_history_messages,
|
|
80
|
-
confidence_threshold,
|
|
81
|
-
output_mode,
|
|
82
|
-
knowledge_sources,
|
|
83
|
-
available_tools,
|
|
84
|
-
metadata,
|
|
85
|
-
ownership,
|
|
86
|
-
is_system,
|
|
87
|
-
is_active,
|
|
88
|
-
created_at,
|
|
89
|
-
updated_at
|
|
90
|
-
)
|
|
91
|
-
SELECT
|
|
92
|
-
gen_random_uuid(),
|
|
93
|
-
(SELECT id FROM public.apps WHERE slug = 'cortex'),
|
|
94
|
-
'cil_codebase_assistant',
|
|
95
|
-
'CIL Codebase Assistant',
|
|
96
|
-
'Answer the user''s question about the codebase using the retrieved chunk contracts above.
|
|
97
|
-
If the answer involves a specific function, always include: chunk_name, file_path, and what it does.',
|
|
98
|
-
'gpt-4o-mini',
|
|
99
|
-
0.2,
|
|
100
|
-
1500,
|
|
101
|
-
true,
|
|
102
|
-
10,
|
|
103
|
-
0.3,
|
|
104
|
-
'text',
|
|
105
|
-
'[]'::jsonb,
|
|
106
|
-
'[]'::jsonb,
|
|
107
|
-
jsonb_build_object(
|
|
108
|
-
'retrieval_policy', jsonb_build_object(
|
|
109
|
-
'item_types', jsonb_build_array('cil_chunk'),
|
|
110
|
-
'vector_types', jsonb_build_array('semantic', 'contract'),
|
|
111
|
-
'max_security_level', 'internal',
|
|
112
|
-
'require_approved', true
|
|
113
|
-
)
|
|
114
|
-
),
|
|
115
|
-
'platform',
|
|
116
|
-
false,
|
|
117
|
-
true,
|
|
118
|
-
now(),
|
|
119
|
-
now()
|
|
120
|
-
WHERE NOT EXISTS (
|
|
121
|
-
SELECT 1 FROM public.prompt_configs WHERE slug = 'cil_codebase_assistant'
|
|
122
|
-
);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
-- Migration 033: Add missing fields to CIL item type design_schemas
|
|
2
|
-
--
|
|
3
|
-
-- Adds fields that are written by the backend functions but were absent from
|
|
4
|
-
-- the design_schema definitions in types.json:
|
|
5
|
-
--
|
|
6
|
-
-- cil_chunk:
|
|
7
|
-
-- - hash_updated_at written by custom_cil-validate ?action=update_hash
|
|
8
|
-
-- - kb_type written by custom_cil-ingest pass2 (discriminator field)
|
|
9
|
-
--
|
|
10
|
-
-- cil_file:
|
|
11
|
-
-- - line_count written by custom_cil-ingest pass1
|
|
12
|
-
-- - existing_marker_names written by custom_cil-ingest pass1
|
|
13
|
-
-- - existing_marker_count written by custom_cil-ingest pass1
|
|
14
|
-
-- - kb_type discriminator field
|
|
15
|
-
--
|
|
16
|
-
-- Safe to re-run: uses jsonb || operator (merge) so existing schema fields are
|
|
17
|
-
-- preserved. Only adds new keys — does not overwrite existing ones.
|
|
18
|
-
|
|
19
|
-
-- ── cil_chunk — add hash_updated_at + kb_type ───────────────────────────────
|
|
20
|
-
UPDATE public.types
|
|
21
|
-
SET design_schema = design_schema || jsonb_build_object(
|
|
22
|
-
'fields', (design_schema->'fields') || jsonb_build_object(
|
|
23
|
-
'hash_updated_at', jsonb_build_object(
|
|
24
|
-
'label', 'Hash Updated At',
|
|
25
|
-
'data_type', 'text'
|
|
26
|
-
),
|
|
27
|
-
'kb_type', jsonb_build_object(
|
|
28
|
-
'label', 'KB Type',
|
|
29
|
-
'data_type', 'text'
|
|
30
|
-
)
|
|
31
|
-
)
|
|
32
|
-
)
|
|
33
|
-
WHERE slug = 'cil_chunk'
|
|
34
|
-
AND kind = 'item'
|
|
35
|
-
AND NOT (design_schema->'fields' ? 'hash_updated_at');
|
|
36
|
-
|
|
37
|
-
-- ── cil_file — add line_count, existing_marker_names, existing_marker_count, kb_type ─
|
|
38
|
-
UPDATE public.types
|
|
39
|
-
SET design_schema = design_schema || jsonb_build_object(
|
|
40
|
-
'fields', (design_schema->'fields') || jsonb_build_object(
|
|
41
|
-
'line_count', jsonb_build_object(
|
|
42
|
-
'label', 'Line Count',
|
|
43
|
-
'data_type', 'number'
|
|
44
|
-
),
|
|
45
|
-
'existing_marker_names', jsonb_build_object(
|
|
46
|
-
'label', 'Existing Marker Names',
|
|
47
|
-
'data_type', 'text'
|
|
48
|
-
),
|
|
49
|
-
'existing_marker_count', jsonb_build_object(
|
|
50
|
-
'label', 'Existing Marker Count',
|
|
51
|
-
'data_type', 'number'
|
|
52
|
-
),
|
|
53
|
-
'kb_type', jsonb_build_object(
|
|
54
|
-
'label', 'KB Type',
|
|
55
|
-
'data_type', 'text'
|
|
56
|
-
)
|
|
57
|
-
)
|
|
58
|
-
)
|
|
59
|
-
WHERE slug = 'cil_file'
|
|
60
|
-
AND kind = 'item'
|
|
61
|
-
AND NOT (design_schema->'fields' ? 'kb_type');
|
|
62
|
-
|
|
63
|
-
-- ── cil_project — add kb_type ────────────────────────────────────────────────
|
|
64
|
-
UPDATE public.types
|
|
65
|
-
SET design_schema = design_schema || jsonb_build_object(
|
|
66
|
-
'fields', (design_schema->'fields') || jsonb_build_object(
|
|
67
|
-
'kb_type', jsonb_build_object(
|
|
68
|
-
'label', 'KB Type',
|
|
69
|
-
'data_type', 'text'
|
|
70
|
-
)
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
WHERE slug = 'cil_project'
|
|
74
|
-
AND kind = 'item'
|
|
75
|
-
AND NOT (design_schema->'fields' ? 'kb_type');
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
-- Migration 034: CIL Self-Seed — register spine-ia as a CIL project
|
|
2
|
-
--
|
|
3
|
-
-- Seeds the spine-ia repository itself as a `cil_project` item so that
|
|
4
|
-
-- Pass 1–5 of the Code Intelligence Layer pipeline can be run against it
|
|
5
|
-
-- immediately after install, without needing to create the project via the UI.
|
|
6
|
-
--
|
|
7
|
-
-- The repo_path defaults to the standard CascadeProjects location. Operators
|
|
8
|
-
-- running the app on a different machine should update the repo_path via:
|
|
9
|
-
-- PATCH /api/custom_cil-project?action=update&id=<SPINE_IA_PROJECT_ID>
|
|
10
|
-
-- body: { data: { repo_path: "/path/to/your/spine-ia" } }
|
|
11
|
-
--
|
|
12
|
-
-- Safe to re-run: the INSERT is guarded by WHERE NOT EXISTS on the title.
|
|
13
|
-
-- The hard-coded UUID allows other migrations to reference this project.
|
|
14
|
-
|
|
15
|
-
-- Known stable UUID for the spine-ia CIL project (update if your DB uses a different value)
|
|
16
|
-
DO $$
|
|
17
|
-
DECLARE
|
|
18
|
-
v_cil_project_type_id uuid;
|
|
19
|
-
v_spine_account_id uuid;
|
|
20
|
-
v_cortex_app_id uuid;
|
|
21
|
-
v_existing_id uuid;
|
|
22
|
-
BEGIN
|
|
23
|
-
-- Resolve the cil_project type
|
|
24
|
-
SELECT id INTO v_cil_project_type_id
|
|
25
|
-
FROM public.types
|
|
26
|
-
WHERE slug = 'cil_project' AND kind = 'item'
|
|
27
|
-
LIMIT 1;
|
|
28
|
-
|
|
29
|
-
IF v_cil_project_type_id IS NULL THEN
|
|
30
|
-
RAISE NOTICE 'cil_project type not found — skipping CIL self-seed. Run install-app cortex first.';
|
|
31
|
-
RETURN;
|
|
32
|
-
END IF;
|
|
33
|
-
|
|
34
|
-
-- Resolve the system account (spine-system or the first account if not found)
|
|
35
|
-
SELECT id INTO v_spine_account_id
|
|
36
|
-
FROM public.accounts
|
|
37
|
-
WHERE slug = 'spine-system'
|
|
38
|
-
LIMIT 1;
|
|
39
|
-
|
|
40
|
-
IF v_spine_account_id IS NULL THEN
|
|
41
|
-
SELECT id INTO v_spine_account_id FROM public.accounts ORDER BY created_at LIMIT 1;
|
|
42
|
-
END IF;
|
|
43
|
-
|
|
44
|
-
IF v_spine_account_id IS NULL THEN
|
|
45
|
-
RAISE NOTICE 'No account found — skipping CIL self-seed.';
|
|
46
|
-
RETURN;
|
|
47
|
-
END IF;
|
|
48
|
-
|
|
49
|
-
-- Resolve the cortex app
|
|
50
|
-
SELECT id INTO v_cortex_app_id
|
|
51
|
-
FROM public.apps
|
|
52
|
-
WHERE slug = 'cortex'
|
|
53
|
-
LIMIT 1;
|
|
54
|
-
|
|
55
|
-
-- Check if the project already exists
|
|
56
|
-
SELECT id INTO v_existing_id
|
|
57
|
-
FROM public.items
|
|
58
|
-
WHERE title = 'spine-ia'
|
|
59
|
-
AND type_id = v_cil_project_type_id
|
|
60
|
-
AND account_id = v_spine_account_id
|
|
61
|
-
LIMIT 1;
|
|
62
|
-
|
|
63
|
-
IF v_existing_id IS NOT NULL THEN
|
|
64
|
-
RAISE NOTICE 'spine-ia CIL project already seeded (id: %). Skipping.', v_existing_id;
|
|
65
|
-
RETURN;
|
|
66
|
-
END IF;
|
|
67
|
-
|
|
68
|
-
-- Insert the project item
|
|
69
|
-
INSERT INTO public.items (
|
|
70
|
-
id,
|
|
71
|
-
type_id,
|
|
72
|
-
account_id,
|
|
73
|
-
app_id,
|
|
74
|
-
title,
|
|
75
|
-
description,
|
|
76
|
-
status,
|
|
77
|
-
is_active,
|
|
78
|
-
data,
|
|
79
|
-
created_at,
|
|
80
|
-
updated_at
|
|
81
|
-
) VALUES (
|
|
82
|
-
-- Fixed UUID so other tooling can reference it; change if collision occurs
|
|
83
|
-
'00000001-c11a-4a1e-0000-00000000001a',
|
|
84
|
-
v_cil_project_type_id,
|
|
85
|
-
v_spine_account_id,
|
|
86
|
-
v_cortex_app_id,
|
|
87
|
-
'spine-ia',
|
|
88
|
-
'The spine-ia monorepo — Spine framework core + Cortex CIL app',
|
|
89
|
-
'active',
|
|
90
|
-
true,
|
|
91
|
-
jsonb_build_object(
|
|
92
|
-
'kb_type', 'cil_project',
|
|
93
|
-
'project_id', '00000001-c11a-4a1e-0000-00000000001a',
|
|
94
|
-
'repo_path', '/Users/thistle/CascadeProjects/spine-ia',
|
|
95
|
-
'language_mix', 'TypeScript, SQL',
|
|
96
|
-
'description', 'The spine-ia monorepo — Spine framework core + Cortex CIL app',
|
|
97
|
-
'ingestion_status', 'not_started',
|
|
98
|
-
'file_count', 0,
|
|
99
|
-
'chunk_count', 0,
|
|
100
|
-
'last_ingested_at', NULL,
|
|
101
|
-
'globs', jsonb_build_array(
|
|
102
|
-
'custom/**/*.ts', 'custom/**/*.tsx',
|
|
103
|
-
'.framework/functions/**/*.ts',
|
|
104
|
-
'.framework/migrations/**/*.sql'
|
|
105
|
-
),
|
|
106
|
-
'exclude_globs', jsonb_build_array(
|
|
107
|
-
'node_modules/**', '.assembled/**', 'dist/**', 'build/**',
|
|
108
|
-
'**/*.test.ts', '**/*.spec.ts', '**/*.d.ts'
|
|
109
|
-
)
|
|
110
|
-
),
|
|
111
|
-
now(),
|
|
112
|
-
now()
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
RAISE NOTICE 'spine-ia CIL project seeded successfully (id: 00000001-c11a-4a1e-0000-00000000001a)';
|
|
116
|
-
END $$;
|