@possumtech/rummy 0.2.6 → 0.2.8
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/.env.example +2 -3
- package/PLUGINS.md +105 -82
- package/bin/rummy.js +9 -2
- package/migrations/001_initial_schema.sql +53 -68
- package/package.json +4 -6
- package/service.js +2 -2
- package/src/agent/AgentLoop.js +91 -58
- package/src/agent/ContextAssembler.js +2 -2
- package/src/agent/KnownStore.js +30 -11
- package/src/agent/ProjectAgent.js +1 -3
- package/src/agent/TurnExecutor.js +119 -31
- package/src/agent/XmlParser.js +20 -0
- package/src/agent/known_checks.sql +5 -4
- package/src/agent/known_queries.sql +4 -3
- package/src/agent/known_store.sql +29 -15
- package/src/agent/loops.sql +63 -0
- package/src/agent/runs.sql +7 -7
- package/src/agent/schemes.sql +2 -2
- package/src/agent/turns.sql +3 -3
- package/src/hooks/PluginContext.js +1 -10
- package/src/hooks/RummyContext.js +16 -8
- package/src/plugins/ask_user/ask_user.js +3 -2
- package/src/plugins/cp/cp.js +7 -7
- package/src/plugins/current/current.js +3 -4
- package/src/plugins/engine/engine.sql +5 -3
- package/src/plugins/engine/turn_context.sql +9 -4
- package/src/plugins/env/docs.md +2 -0
- package/src/plugins/env/env.js +3 -2
- package/src/plugins/file/file.js +9 -19
- package/src/plugins/get/docs.md +7 -3
- package/src/plugins/get/get.js +22 -6
- package/src/plugins/hedberg/docs.md +0 -9
- package/src/plugins/hedberg/hedberg.js +2 -5
- package/src/plugins/hedberg/matcher.js +1 -1
- package/src/plugins/hedberg/patterns.js +6 -6
- package/src/plugins/helpers.js +2 -2
- package/src/plugins/index.js +28 -15
- package/src/plugins/instructions/instructions.js +1 -1
- package/src/plugins/known/known.js +9 -11
- package/src/plugins/mv/mv.js +7 -7
- package/src/plugins/previous/previous.js +6 -5
- package/src/plugins/progress/progress.js +6 -0
- package/src/plugins/prompt/prompt.js +9 -10
- package/src/plugins/rm/docs.md +3 -1
- package/src/plugins/rm/rm.js +24 -7
- package/src/plugins/rpc/rpc.js +33 -42
- package/src/plugins/set/docs.md +3 -1
- package/src/plugins/set/set.js +22 -16
- package/src/plugins/sh/sh.js +3 -2
- package/src/plugins/skills/skills.js +3 -4
- package/src/plugins/store/docs.md +2 -1
- package/src/plugins/store/store.js +14 -3
- package/src/plugins/summarize/summarize.js +1 -1
- package/src/plugins/telemetry/telemetry.js +17 -7
- package/src/plugins/unknown/unknown.js +3 -2
- package/src/plugins/update/update.js +1 -1
- package/src/server/ClientConnection.js +3 -5
- package/src/sql/v_model_context.sql +20 -23
- package/src/sql/v_run_log.sql +3 -3
- package/src/agent/prompt_queue.sql +0 -39
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
-- INIT: create_v_model_context
|
|
2
2
|
CREATE VIEW IF NOT EXISTS v_model_context AS
|
|
3
3
|
WITH
|
|
4
|
-
|
|
4
|
+
visible AS (
|
|
5
5
|
SELECT
|
|
6
6
|
ke.run_id
|
|
7
7
|
, ke.id
|
|
8
8
|
, ke.path
|
|
9
9
|
, ke.body
|
|
10
10
|
, ke.scheme
|
|
11
|
-
, ke.
|
|
11
|
+
, ke.status
|
|
12
|
+
, ke.fidelity
|
|
12
13
|
, ke.turn
|
|
13
14
|
, ke.updated_at
|
|
14
15
|
, ke.attributes
|
|
15
16
|
, ke.tokens AS tokens_full
|
|
16
17
|
, CASE
|
|
17
|
-
--
|
|
18
|
-
WHEN ke.
|
|
18
|
+
-- Stored entries not in context
|
|
19
|
+
WHEN ke.fidelity = 'stored' THEN NULL
|
|
20
|
+
-- 202 Accepted (proposed) hidden until resolved
|
|
21
|
+
WHEN ke.status = 202 THEN NULL
|
|
19
22
|
-- Audit schemes (model_visible = 0) hidden
|
|
20
23
|
WHEN s.model_visible = 0 THEN NULL
|
|
21
|
-
--
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
WHEN ke.state = 'stored' THEN NULL
|
|
25
|
-
-- Result/structural states are visible at full fidelity
|
|
26
|
-
WHEN ke.state IN ('pass', 'error', 'warn', 'pattern', 'read', 'info', 'summary') THEN 'full'
|
|
27
|
-
ELSE NULL
|
|
28
|
-
END AS fidelity
|
|
24
|
+
-- Everything else visible at its fidelity
|
|
25
|
+
ELSE ke.fidelity
|
|
26
|
+
END AS visible_fidelity
|
|
29
27
|
FROM known_entries AS ke
|
|
30
28
|
JOIN schemes AS s ON s.name = COALESCE(ke.scheme, 'file')
|
|
31
|
-
WHERE ke.state NOT IN ('proposed')
|
|
32
29
|
),
|
|
33
30
|
projected AS (
|
|
34
31
|
SELECT
|
|
@@ -36,21 +33,21 @@ projected AS (
|
|
|
36
33
|
, id
|
|
37
34
|
, path
|
|
38
35
|
, scheme
|
|
39
|
-
,
|
|
40
|
-
, fidelity
|
|
36
|
+
, status
|
|
37
|
+
, visible_fidelity AS fidelity
|
|
41
38
|
, turn
|
|
42
39
|
, updated_at
|
|
43
40
|
, attributes
|
|
44
41
|
, CASE
|
|
45
|
-
WHEN
|
|
42
|
+
WHEN visible_fidelity IN ('full', 'summary') THEN body
|
|
46
43
|
ELSE ''
|
|
47
44
|
END AS body
|
|
48
45
|
, CASE
|
|
49
|
-
WHEN scheme IS NULL AND
|
|
46
|
+
WHEN scheme IS NULL AND visible_fidelity IN ('full', 'summary') THEN 'file'
|
|
50
47
|
WHEN scheme IS NULL THEN 'file_index'
|
|
51
|
-
WHEN scheme IN ('http', 'https') AND
|
|
48
|
+
WHEN scheme IN ('http', 'https') AND visible_fidelity IN ('full', 'summary') THEN 'file'
|
|
52
49
|
WHEN scheme IN ('http', 'https') THEN 'file_index'
|
|
53
|
-
WHEN scheme IN ('known', 'skill') AND
|
|
50
|
+
WHEN scheme IN ('known', 'skill') AND visible_fidelity = 'full' THEN 'known'
|
|
54
51
|
WHEN scheme IN ('known', 'skill') THEN 'known_index'
|
|
55
52
|
WHEN scheme = 'unknown' THEN 'unknown'
|
|
56
53
|
WHEN scheme IN ('ask', 'act', 'progress') THEN 'prompt'
|
|
@@ -59,15 +56,15 @@ projected AS (
|
|
|
59
56
|
WHEN scheme = 'tool' THEN 'tool'
|
|
60
57
|
ELSE 'result'
|
|
61
58
|
END AS category
|
|
62
|
-
FROM
|
|
63
|
-
WHERE
|
|
59
|
+
FROM visible
|
|
60
|
+
WHERE visible_fidelity IS NOT NULL
|
|
64
61
|
)
|
|
65
62
|
SELECT
|
|
66
63
|
run_id
|
|
67
64
|
, path
|
|
68
65
|
, scheme
|
|
69
66
|
, fidelity
|
|
70
|
-
,
|
|
67
|
+
, status
|
|
71
68
|
, body
|
|
72
69
|
, attributes
|
|
73
70
|
, category
|
|
@@ -88,7 +85,7 @@ SELECT
|
|
|
88
85
|
ELSE 6
|
|
89
86
|
END
|
|
90
87
|
, CASE scheme WHEN 'skill' THEN 0 ELSE 1 END
|
|
91
|
-
, CASE
|
|
88
|
+
, CASE fidelity
|
|
92
89
|
WHEN 'index' THEN 0
|
|
93
90
|
WHEN 'summary' THEN 1
|
|
94
91
|
ELSE 2
|
package/src/sql/v_run_log.sql
CHANGED
|
@@ -4,8 +4,8 @@ SELECT
|
|
|
4
4
|
ke.run_id
|
|
5
5
|
, ke.path
|
|
6
6
|
, ke.body
|
|
7
|
-
, ke.
|
|
8
|
-
, COALESCE(ke.scheme,
|
|
7
|
+
, ke.status
|
|
8
|
+
, COALESCE(ke.scheme, 'file') AS tool
|
|
9
9
|
, COALESCE(
|
|
10
10
|
json_extract(ke.attributes, '$.command')
|
|
11
11
|
, json_extract(ke.attributes, '$.file')
|
|
@@ -17,7 +17,7 @@ FROM known_entries AS ke
|
|
|
17
17
|
JOIN schemes AS s ON s.name = COALESCE(ke.scheme, 'file')
|
|
18
18
|
WHERE
|
|
19
19
|
ke.scheme IS NOT NULL
|
|
20
|
-
AND ke.
|
|
20
|
+
AND ke.status != 202
|
|
21
21
|
AND s.category NOT IN ('knowledge', 'file')
|
|
22
22
|
AND ke.scheme NOT IN ('system', 'reasoning', 'model', 'content')
|
|
23
23
|
ORDER BY ke.id;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
-- PREP: enqueue_prompt
|
|
2
|
-
INSERT INTO prompt_queue (run_id, mode, model, prompt, config)
|
|
3
|
-
VALUES (:run_id, :mode, :model, :prompt, :config)
|
|
4
|
-
RETURNING id;
|
|
5
|
-
|
|
6
|
-
-- PREP: claim_next_prompt
|
|
7
|
-
UPDATE prompt_queue
|
|
8
|
-
SET status = 'active'
|
|
9
|
-
WHERE
|
|
10
|
-
id = (
|
|
11
|
-
SELECT
|
|
12
|
-
id
|
|
13
|
-
FROM prompt_queue
|
|
14
|
-
WHERE run_id = :run_id AND status = 'pending'
|
|
15
|
-
ORDER BY id
|
|
16
|
-
LIMIT 1
|
|
17
|
-
)
|
|
18
|
-
RETURNING id, run_id, mode, model, prompt, config;
|
|
19
|
-
|
|
20
|
-
-- PREP: complete_prompt
|
|
21
|
-
UPDATE prompt_queue
|
|
22
|
-
SET status = 'completed', result = :result
|
|
23
|
-
WHERE id = :id;
|
|
24
|
-
|
|
25
|
-
-- PREP: abort_active_prompt
|
|
26
|
-
UPDATE prompt_queue
|
|
27
|
-
SET status = 'aborted'
|
|
28
|
-
WHERE run_id = :run_id AND status = 'active';
|
|
29
|
-
|
|
30
|
-
-- PREP: get_pending_prompts
|
|
31
|
-
SELECT id, mode, model, prompt, status, created_at
|
|
32
|
-
FROM prompt_queue
|
|
33
|
-
WHERE run_id = :run_id AND status IN ('pending', 'active')
|
|
34
|
-
ORDER BY id;
|
|
35
|
-
|
|
36
|
-
-- PREP: reset_active_prompts
|
|
37
|
-
UPDATE prompt_queue
|
|
38
|
-
SET status = 'pending'
|
|
39
|
-
WHERE status = 'active';
|