@hasna/instructions 0.4.36 → 0.4.39
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 +9 -8
- package/assets/skills/inbox/SKILL.md +86 -0
- package/dashboard/README.md +34 -70
- package/dist/cli/index.js +1839 -721
- package/dist/cli/raw-store-root.test.d.ts +2 -0
- package/dist/cli/raw-store-root.test.d.ts.map +1 -0
- package/dist/data/config-store.d.ts +4 -4
- package/dist/data/config-store.d.ts.map +1 -1
- package/dist/db/configs.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/generated/storage-kit/backend.d.ts +20 -0
- package/dist/generated/storage-kit/backend.d.ts.map +1 -0
- package/dist/generated/storage-kit/index.d.ts +2 -2
- package/dist/generated/storage-kit/index.d.ts.map +1 -1
- package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
- package/dist/generated/storage-kit/own.d.ts +11 -0
- package/dist/generated/storage-kit/own.d.ts.map +1 -0
- package/dist/generated/storage-kit/pool.d.ts +7 -6
- package/dist/generated/storage-kit/pool.d.ts.map +1 -1
- package/dist/generated/storage-kit/tls.d.ts +30 -3
- package/dist/generated/storage-kit/tls.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1237 -704
- package/dist/lib/managed-skill-runtimes.d.ts +80 -0
- package/dist/lib/managed-skill-runtimes.d.ts.map +1 -0
- package/dist/lib/managed-skill-runtimes.test.d.ts +2 -0
- package/dist/lib/managed-skill-runtimes.test.d.ts.map +1 -0
- package/dist/lib/raw-store-root.d.ts +17 -0
- package/dist/lib/raw-store-root.d.ts.map +1 -0
- package/dist/lib/retired-storage-mode.d.ts +8 -0
- package/dist/lib/retired-storage-mode.d.ts.map +1 -0
- package/dist/lib/session-apply.d.ts.map +1 -1
- package/dist/lib/session-authority.d.ts +27 -0
- package/dist/lib/session-authority.d.ts.map +1 -0
- package/dist/lib/session-authority.test.d.ts +2 -0
- package/dist/lib/session-authority.test.d.ts.map +1 -0
- package/dist/lib/session-render.d.ts +5 -3
- package/dist/lib/session-render.d.ts.map +1 -1
- package/dist/mcp/index.js +303 -246
- package/dist/server/cloud.d.ts +2 -2
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +875 -496
- package/dist/status.d.ts +11 -1
- package/dist/status.d.ts.map +1 -1
- package/dist/storage/cloud-store.d.ts.map +1 -1
- package/dist/storage/cloud-store.test.d.ts +2 -0
- package/dist/storage/cloud-store.test.d.ts.map +1 -0
- package/package.json +10 -7
- package/dist/generated/storage-kit/mode.d.ts +0 -48
- package/dist/generated/storage-kit/mode.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -126,10 +126,10 @@ Surfaces:
|
|
|
126
126
|
- `/v1/*` — versioned cloud API (configs, profiles, snapshots, stats).
|
|
127
127
|
- `/api/*` — the local dashboard/REST surface.
|
|
128
128
|
|
|
129
|
-
###
|
|
129
|
+
### Server data backend (postgresql)
|
|
130
130
|
|
|
131
131
|
When `HASNA_INSTRUCTIONS_DATABASE_URL` is set the `/v1` API reads/writes the
|
|
132
|
-
shared
|
|
132
|
+
shared Postgres **directly** (no local sync/cache in the service) and every
|
|
133
133
|
`/v1` request is authenticated with a `@hasna/contracts` API key
|
|
134
134
|
(`x-api-key` or `Authorization: Bearer`). Reads need `instructions:read`, writes
|
|
135
135
|
need `instructions:write` (an `instructions:*` key satisfies both).
|
|
@@ -153,24 +153,25 @@ and `API_KEY_SIGNING_SECRET` are also accepted). Client apps use
|
|
|
153
153
|
`InstructionsV1Client` is generated from the serve OpenAPI document
|
|
154
154
|
(`bun run generate:sdk`).
|
|
155
155
|
|
|
156
|
-
##
|
|
156
|
+
## Client transports
|
|
157
157
|
|
|
158
158
|
Every CLI command, MCP tool, and SDK method routes through a single `ConfigStore`
|
|
159
159
|
abstraction with two transports:
|
|
160
160
|
|
|
161
161
|
- **local** — on-box SQLite (`LocalConfigStore`), fully first-class. Used when no
|
|
162
162
|
API env vars are set.
|
|
163
|
-
- **api**
|
|
163
|
+
- **api** — HTTP `/v1` + bearer key (`CloudConfigStore`).
|
|
164
164
|
Activated by setting **both** `HASNA_INSTRUCTIONS_API_URL` and
|
|
165
|
-
`HASNA_INSTRUCTIONS_API_KEY`.
|
|
166
|
-
and the self_hosted/cloud distinction is enforced server-side by tenancy.
|
|
165
|
+
`HASNA_INSTRUCTIONS_API_KEY`.
|
|
167
166
|
|
|
168
167
|
Clients never hold a database DSN. The raw Postgres connection is a server-only
|
|
169
|
-
concern (`instructions-serve`)
|
|
168
|
+
concern (`instructions-serve`), selected by `HASNA_INSTRUCTIONS_DATABASE_URL`.
|
|
170
169
|
|
|
171
170
|
## Data Directory
|
|
172
171
|
|
|
173
|
-
Local data
|
|
172
|
+
Local data (the SQLite store and backups) lives under the canonical data root
|
|
173
|
+
`~/.hasna/instructions/` by default. `HASNA_CONFIGS_HOME` remains a supported
|
|
174
|
+
override of the root for legacy setups.
|
|
174
175
|
|
|
175
176
|
## Session Instruction Rendering
|
|
176
177
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: inbox
|
|
3
|
+
description: Arm and verify the package-owned Conversations watcher for direct messages and subscribed channels.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Inbox
|
|
7
|
+
|
|
8
|
+
Use the maintained `@hasna/conversations` surfaces. There is no separate
|
|
9
|
+
`inbox` executable to install or copy.
|
|
10
|
+
|
|
11
|
+
## Prepare the subscriptions
|
|
12
|
+
|
|
13
|
+
Subscribe the session identity to every channel that can change its work:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
conversations channel subscribe <channel> --from <agent> --preview-chars 320
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Read the subscriptions back before arming:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
conversations channel subscriptions --from <agent> --json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The readback must contain the intended, non-empty channel set. Each row must
|
|
26
|
+
carry a seeded `since_message_id`, so the first watch cycle starts from the
|
|
27
|
+
subscription baseline instead of replaying history.
|
|
28
|
+
|
|
29
|
+
## Arm the watcher
|
|
30
|
+
|
|
31
|
+
First prove the hosted heartbeat path works:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
conversations agents heartbeat --from <agent> --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Only after that command succeeds, arm:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
conversations watch --from <agent> --all --interval 60000 --full-content
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--all` watches direct messages plus every subscribed channel. Several
|
|
44
|
+
comma-separated identities may be supplied to `--from`; reads are the union
|
|
45
|
+
and the first identity is primary for writes.
|
|
46
|
+
|
|
47
|
+
The watcher reports repeated poll failures as `DEGRADED` and announces
|
|
48
|
+
`RECOVERED` after a successful poll. Treat those lines as visibility state,
|
|
49
|
+
not as message content.
|
|
50
|
+
|
|
51
|
+
## Manual fallback when hosted watch is degraded
|
|
52
|
+
|
|
53
|
+
If the heartbeat command fails, do not claim the watcher is armed. Keep the
|
|
54
|
+
subscription baseline and use bounded manual reads until the hosted path is
|
|
55
|
+
healthy:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
conversations digest <channel> --since <ISO8601> --json
|
|
59
|
+
conversations digest --to <agent> --since <ISO8601> --json
|
|
60
|
+
conversations blockers --from <agent> --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Page every digest through `has_more` and `next_cursor`. Preserve the newest
|
|
64
|
+
successfully read timestamp or cursor between coordination passes. A manual
|
|
65
|
+
read is degraded service: say so explicitly, schedule the next bounded pass,
|
|
66
|
+
and do not describe it as a live monitor.
|
|
67
|
+
|
|
68
|
+
## Verify delivery, not just process lifetime
|
|
69
|
+
|
|
70
|
+
Have a different agent send one uniquely labelled canary to a subscribed
|
|
71
|
+
channel and one direct message. The watcher must surface both within one poll
|
|
72
|
+
interval. A running process, successful subscription write, or quiet first
|
|
73
|
+
poll alone does not prove delivery.
|
|
74
|
+
|
|
75
|
+
After both canaries arrive, record the local runtime gate:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
instructions managed-skills status --from <agent> --delivery-verified --json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`--delivery-verified` is an evidence assertion, not a probe. Use it only in the
|
|
82
|
+
same acceptance pass that observed both canaries.
|
|
83
|
+
|
|
84
|
+
`conversations watch` does not monitor Todos assignments. If the session also
|
|
85
|
+
needs task-assignment awareness, keep that as a separate bounded Todos read;
|
|
86
|
+
do not add another Conversations wrapper or executable.
|
package/dashboard/README.md
CHANGED
|
@@ -1,73 +1,37 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
1
|
+
# Instructions dashboard (legacy API client)
|
|
2
|
+
|
|
3
|
+
This directory contains a React/Vite dashboard with pages for configs,
|
|
4
|
+
profiles, apply/sync, snapshots, and machines. Its checked-in API client uses
|
|
5
|
+
the former unauthenticated local `/api/*` routes at
|
|
6
|
+
`http://localhost:3457`.
|
|
7
|
+
|
|
8
|
+
Current `instructions-serve` exposes authenticated `/v1/*` and deliberately
|
|
9
|
+
does not mount `/api/*`. As a result, this dashboard is not operational against
|
|
10
|
+
the current server until its client, response shapes, and authentication are
|
|
11
|
+
migrated to `/v1`. The server may still serve `dashboard/dist` as static files
|
|
12
|
+
when a build is present; serving the assets does not restore the old API.
|
|
13
|
+
|
|
14
|
+
## Source layout
|
|
15
|
+
|
|
16
|
+
- `src/api.ts` — fixed-base legacy `/api` client.
|
|
17
|
+
- `src/pages/ConfigsPage.tsx` — search, inspect, and edit config content.
|
|
18
|
+
- `src/pages/ProfilesPage.tsx` — create, inspect, preview, and apply profiles.
|
|
19
|
+
- `src/pages/ApplyPage.tsx` — preview/apply configs and legacy directory sync.
|
|
20
|
+
- `src/pages/HistoryPage.tsx` — inspect config snapshots.
|
|
21
|
+
- `src/pages/MachinesPage.tsx` — machine and category statistics.
|
|
22
|
+
|
|
23
|
+
## Development
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bun install
|
|
27
|
+
bun run dev
|
|
28
|
+
bun run lint
|
|
29
|
+
bun run build
|
|
44
30
|
```
|
|
45
31
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// eslint.config.js
|
|
50
|
-
import reactX from 'eslint-plugin-react-x'
|
|
51
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
32
|
+
The Vite dev server alone does not provide API endpoints. For UI work before
|
|
33
|
+
the `/v1` migration, use a purpose-built mock or a compatible legacy server;
|
|
34
|
+
do not expose an unauthenticated `/api` shim in production.
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
files: ['**/*.{ts,tsx}'],
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
73
|
-
```
|
|
36
|
+
See the repository's [HTTP API reference](../docs/http-api.md) for the current
|
|
37
|
+
server contract.
|