@hasna/instructions 0.6.1 → 0.7.0
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 +123 -6
- package/dist/chunks/{apply-ynfn1av7.js → apply-7svah2qm.js} +5 -3
- package/dist/chunks/{apply-sfzja1f3.js → apply-jp13sa1e.js} +6 -3
- package/dist/chunks/database-wstmr56z.js +23 -0
- package/dist/chunks/{index-85n5wnd8.js → index-1cnyjnd7.js} +5 -7
- package/dist/chunks/{index-pkscjnj5.js → index-3djthcm6.js} +0 -1
- package/dist/chunks/{index-v7dkb384.js → index-4pfq42t5.js} +129 -77
- package/dist/chunks/index-5d7zdftc.js +186 -0
- package/dist/chunks/{index-1hpwskwd.js → index-7m4j8a33.js} +205 -329
- package/dist/chunks/index-8rb7ng2y.js +148 -0
- package/dist/chunks/index-arrrx0ed.js +344 -0
- package/dist/chunks/{index-9p9gn7gh.js → index-bzyxvwcd.js} +5 -7
- package/dist/chunks/index-fpeyzn3n.js +186 -0
- package/dist/chunks/{index-axhwg61p.js → index-fwbs6tma.js} +15 -4
- package/dist/chunks/index-n3fjspr0.js +119 -0
- package/dist/chunks/{index-e9epbsvs.js → index-z3ma4aqk.js} +15 -4
- package/dist/chunks/legacy-store-migration-z2m5yzyk.js +322 -0
- package/dist/chunks/{local-a9nen65z.js → local-5wvv5xv3.js} +2 -2
- package/dist/chunks/{local-0d8qrc92.js → local-zxa5dpf4.js} +13 -188
- package/dist/chunks/s3-backup-n2z4fwyh.js +240 -0
- package/dist/chunks/s3-config-hhght91k.js +14 -0
- package/dist/chunks/s3-object-store-90tgbh6k.js +14 -0
- package/dist/chunks/{sync-m46fc257.js → sync-2075deve.js} +5 -4
- package/dist/chunks/{sync-vy1yjvs6.js → sync-r8t7zsp3.js} +4 -4
- package/dist/chunks/{template-02wjvv05.js → template-fsfxpe4p.js} +1 -1
- package/dist/chunks/{template-ke972qqe.js → template-wgnzdn7h.js} +1 -1
- package/dist/cli/index.js +1011 -247
- package/dist/data/config-store.d.ts +1 -0
- package/dist/data/config-store.d.ts.map +1 -1
- package/dist/index.js +840 -215
- package/dist/lib/apply.d.ts +7 -0
- package/dist/lib/apply.d.ts.map +1 -1
- package/dist/lib/compact-output.d.ts +1 -0
- package/dist/lib/compact-output.d.ts.map +1 -1
- package/dist/lib/export.d.ts +22 -3
- package/dist/lib/export.d.ts.map +1 -1
- package/dist/lib/import.d.ts +18 -0
- package/dist/lib/import.d.ts.map +1 -1
- package/dist/lib/legacy-store-migration.d.ts +39 -0
- package/dist/lib/legacy-store-migration.d.ts.map +1 -0
- package/dist/lib/managed-skill-runtimes.d.ts +1 -0
- package/dist/lib/managed-skill-runtimes.d.ts.map +1 -1
- package/dist/lib/sync-dir.d.ts.map +1 -1
- package/dist/mcp/index.js +31 -20
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +205 -10
- package/dist/sdk/resolve.d.ts +1 -1
- package/dist/sdk/resolve.d.ts.map +1 -1
- package/dist/sdk/v1-client.d.ts +57 -0
- package/dist/sdk/v1-client.d.ts.map +1 -0
- package/dist/sdk/v1.generated.d.ts +212 -21
- package/dist/sdk/v1.generated.d.ts.map +1 -1
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/index.d.ts +13 -5
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1180 -432
- package/dist/server/openapi.d.ts +1264 -92
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/v1.d.ts +25 -1
- package/dist/server/v1.d.ts.map +1 -1
- package/dist/storage/cloud-store.d.ts +57 -1
- package/dist/storage/cloud-store.d.ts.map +1 -1
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +725 -0
- package/dist/storage/s3-backup.d.ts +76 -0
- package/dist/storage/s3-backup.d.ts.map +1 -0
- package/dist/storage/s3-config.d.ts +46 -0
- package/dist/storage/s3-config.d.ts.map +1 -0
- package/dist/storage/s3-object-store.d.ts +70 -0
- package/dist/storage/s3-object-store.d.ts.map +1 -0
- package/dist/types/index.d.ts +65 -3
- package/dist/types/index.d.ts.map +1 -1
- package/hasna.contract.json +110 -0
- package/migrations/0001_instructions.sql +63 -0
- package/migrations/0002_api_keys.sql +20 -0
- package/migrations/0003_idempotency_receipts.sql +24 -0
- package/package.json +22 -11
- package/assets/skills/inbox/SKILL.md +0 -86
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/instructions",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "AI coding agent instruction
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "AI coding agent instruction and configuration manager with fail-closed hosted clients, explicit local SQLite, native S3 backups, CLI, MCP, HTTP API, and generated SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -20,34 +20,41 @@
|
|
|
20
20
|
"./sdk": {
|
|
21
21
|
"types": "./dist/sdk/index.d.ts",
|
|
22
22
|
"import": "./dist/sdk/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./storage": {
|
|
25
|
+
"types": "./dist/storage/index.d.ts",
|
|
26
|
+
"import": "./dist/storage/index.js"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"files": [
|
|
26
30
|
"dist",
|
|
27
|
-
"assets/skills/inbox/SKILL.md",
|
|
28
31
|
"LICENSE",
|
|
29
32
|
"README.md",
|
|
30
33
|
"!dist/**/*.test.d.ts",
|
|
31
34
|
"!dist/**/*.test.d.ts.map",
|
|
32
|
-
"!dist/test-support/**"
|
|
35
|
+
"!dist/test-support/**",
|
|
36
|
+
"migrations",
|
|
37
|
+
"hasna.contract.json"
|
|
33
38
|
],
|
|
34
39
|
"scripts": {
|
|
35
40
|
"clean": "rm -rf dist",
|
|
36
|
-
"build": "bun run clean && bun build src/cli/index.tsx --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external ink --external react --external chalk --external pg --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external pg --external @modelcontextprotocol/sdk && bun build src/server/index.ts --outdir dist/server --target bun --external pg && bun build src/index.ts --outdir dist --target bun --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun && tsc --emitDeclarationOnly --outDir dist",
|
|
37
|
-
"build:server": "bun run clean && bun build src/cli/index.tsx --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external ink --external react --external chalk --external pg --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external pg --external @modelcontextprotocol/sdk && bun build src/server/index.ts --outdir dist/server --target bun --external pg && bun build src/index.ts --outdir dist --target bun --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun",
|
|
41
|
+
"build": "bun run clean && bun build src/cli/index.tsx --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external ink --external react --external chalk --external pg --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external pg --external @modelcontextprotocol/sdk && bun build src/server/index.ts --outdir dist/server --target bun --external pg && bun build src/index.ts --outdir dist --target bun --external pg && bun build src/storage/index.ts --outdir dist/storage --target bun && bun build src/sdk/index.ts --outdir dist/sdk --target bun && tsc --emitDeclarationOnly --outDir dist",
|
|
42
|
+
"build:server": "bun run clean && bun build src/cli/index.tsx --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external ink --external react --external chalk --external pg --external @modelcontextprotocol/sdk && bun build src/mcp/index.ts --outdir dist --root src --target bun --splitting --chunk-naming \"chunks/[name]-[hash].[ext]\" --external pg --external @modelcontextprotocol/sdk && bun build src/server/index.ts --outdir dist/server --target bun --external pg && bun build src/index.ts --outdir dist --target bun --external pg && bun build src/storage/index.ts --outdir dist/storage --target bun && bun build src/sdk/index.ts --outdir dist/sdk --target bun",
|
|
38
43
|
"migrate": "bun run src/server/index.ts migrate",
|
|
39
44
|
"generate:sdk": "bun run scripts/generate-sdk.ts",
|
|
40
45
|
"kit:check": "bunx @hasna/contracts vendor-kit --check",
|
|
41
46
|
"typecheck": "tsc --noEmit",
|
|
42
|
-
"test": "env -u HASNA_INSTRUCTIONS_API_URL -u HASNA_INSTRUCTIONS_API_KEY -u INSTRUCTIONS_API_URL -u INSTRUCTIONS_API_KEY -u HASNA_INSTRUCTIONS_API_KEY_OVERRIDE -u HASNA_INSTRUCTIONS_API_KEY_REF -u HASNA_PROFILE HASNA_STATE_HOME=$(mktemp -d) bun test",
|
|
47
|
+
"test": "env -u HASNA_INSTRUCTIONS_API_URL -u HASNA_INSTRUCTIONS_API_KEY -u INSTRUCTIONS_API_URL -u INSTRUCTIONS_API_KEY -u HASNA_INSTRUCTIONS_API_KEY_OVERRIDE -u HASNA_INSTRUCTIONS_API_KEY_REF -u HASNA_PROFILE HASNA_STATE_HOME=$(mktemp -d) bun test --timeout 120000",
|
|
43
48
|
"check:package-secrets": "bun run src/cli/index.tsx package-manager-scan --fail-on-findings .",
|
|
44
49
|
"dev:cli": "bun run src/cli/index.tsx",
|
|
45
50
|
"dev:mcp": "bun run src/mcp/index.ts",
|
|
46
51
|
"dev:serve": "bun run src/server/index.ts",
|
|
47
52
|
"seed": "bun run scripts/seed.ts",
|
|
48
|
-
"prepublishOnly": "bun run scripts/check-publish-hold.ts && bun run build",
|
|
53
|
+
"prepublishOnly": "bun run scripts/check-publish-hold.ts && bun run typecheck && bun run test && bun run build && bun run scan:artifact",
|
|
49
54
|
"postinstall": "node -e \"const fs=require('node:fs'),path=require('node:path'),os=require('node:os');const home=process.env.HOME||process.env.USERPROFILE||os.homedir();const exact=process.env.HASNA_CONFIGS_HOME;const configHome=process.env.HASNA_CONFIG_HOME;const root=exact&&exact.trim()?path.resolve(exact.trim()):(configHome&&configHome.trim()?path.join(configHome.trim(),'configs'):path.join(home,'.hasna','instructions'));try{fs.mkdirSync(root,{recursive:true,mode:0o700});fs.mkdirSync(path.join(root,'backups'),{recursive:true,mode:0o700});}catch{}\"",
|
|
50
|
-
"prepack": "bun run build"
|
|
55
|
+
"prepack": "bun run build && bun run scan:artifact",
|
|
56
|
+
"test:postgres": "bun scripts/live-postgres-test.ts",
|
|
57
|
+
"scan:artifact": "bun scripts/scan-artifact.ts"
|
|
51
58
|
},
|
|
52
59
|
"keywords": [
|
|
53
60
|
"instructions",
|
|
@@ -85,12 +92,15 @@
|
|
|
85
92
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
86
93
|
"chalk": "^5.4.1",
|
|
87
94
|
"commander": "^13.1.0",
|
|
88
|
-
"hono": "4.13.
|
|
95
|
+
"hono": "4.13.7",
|
|
89
96
|
"ink": "^5.2.0",
|
|
90
97
|
"pg": "^8.13.3",
|
|
91
98
|
"react": "^18.3.1",
|
|
92
99
|
"zod": "^3.24.2"
|
|
93
100
|
},
|
|
101
|
+
"overrides": {
|
|
102
|
+
"hono": "4.13.7"
|
|
103
|
+
},
|
|
94
104
|
"devDependencies": {
|
|
95
105
|
"@hasna/contracts": "1.0.2",
|
|
96
106
|
"@types/bun": "1.3.14",
|
|
@@ -98,5 +108,6 @@
|
|
|
98
108
|
"@types/react": "^18.3.18",
|
|
99
109
|
"bun-types": "1.3.14",
|
|
100
110
|
"typescript": "^5.7.3"
|
|
101
|
-
}
|
|
111
|
+
},
|
|
112
|
+
"packageManager": "bun@1.3.14"
|
|
102
113
|
}
|
|
@@ -1,86 +0,0 @@
|
|
|
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.
|