advisers 0.1.0-preview.1 → 0.1.0-preview.2
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/bin/advisers.js +58 -0
- package/index.js +1 -1
- package/package.json +10 -2
package/bin/advisers.js
CHANGED
|
@@ -76,6 +76,9 @@ Usage:
|
|
|
76
76
|
advisers why <pref-id> explain a preference
|
|
77
77
|
advisers forget <pref-id> forget a preference (tombstone)
|
|
78
78
|
advisers export export the ledger as JSON
|
|
79
|
+
advisers brief <text> print the IntentBrief for a request
|
|
80
|
+
advisers office <kind> <spec.json> <out>
|
|
81
|
+
build docx/xlsx/pptx/mermaid/drawio
|
|
79
82
|
advisers soul show print soul.md
|
|
80
83
|
advisers soul set <file> set soul.md from a file (human action)
|
|
81
84
|
advisers soul init write a minimal starter soul.md
|
|
@@ -158,6 +161,56 @@ function exportLedger() {
|
|
|
158
161
|
console.log(JSON.stringify(loadLedger().toJSON(), null, 2))
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
function brief(text) {
|
|
165
|
+
if (!text) {
|
|
166
|
+
console.error('usage: advisers brief <text>')
|
|
167
|
+
process.exitCode = 1
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
const stage = process.env.ADVISERS_STAGE === 'trusted' ? 'trusted' : 'probation'
|
|
171
|
+
const brief = core.buildIntentBrief(text, { stage })
|
|
172
|
+
console.log(core.renderIntentBrief(brief))
|
|
173
|
+
console.log('\n' + core.renderReadback(brief))
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function office(kind, specFile, outFile) {
|
|
177
|
+
const kinds = ['docx', 'xlsx', 'pptx', 'mermaid', 'drawio']
|
|
178
|
+
if (!kinds.includes(kind) || !specFile || !outFile) {
|
|
179
|
+
console.error('usage: advisers office <docx|xlsx|pptx|mermaid|drawio> <spec.json> <out>')
|
|
180
|
+
process.exitCode = 1
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
let mod
|
|
184
|
+
if (process.env.ADVISERS_OFFICE_LOCAL === '1') {
|
|
185
|
+
mod = await import('../../office/dist/index.js')
|
|
186
|
+
} else {
|
|
187
|
+
try {
|
|
188
|
+
mod = await import('advisers-office')
|
|
189
|
+
} catch {
|
|
190
|
+
console.error('advisers-office is not installed; run `npm i -g advisers-office@next`')
|
|
191
|
+
process.exitCode = 1
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const spec = JSON.parse(readFileSync(specFile, 'utf8'))
|
|
196
|
+
if (kind === 'mermaid') {
|
|
197
|
+
writeFileSync(outFile, mod.buildMermaid(spec))
|
|
198
|
+
console.log(`wrote ${outFile}`)
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
if (kind === 'drawio') {
|
|
202
|
+
writeFileSync(outFile, mod.buildDrawio(spec))
|
|
203
|
+
console.log(`wrote ${outFile}`)
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
const builder = kind === 'docx' ? mod.buildDocx : kind === 'xlsx' ? mod.buildXlsx : mod.buildPptx
|
|
207
|
+
const buffer = await builder(spec)
|
|
208
|
+
writeFileSync(outFile, buffer)
|
|
209
|
+
const result = await mod.validateOffice(buffer, kind)
|
|
210
|
+
console.log(result.ok ? `wrote ${outFile} (${buffer.length} bytes)` : `wrote ${outFile}, missing: ${result.missing.join(', ')}`)
|
|
211
|
+
if (!result.ok) process.exitCode = 1
|
|
212
|
+
}
|
|
213
|
+
|
|
161
214
|
function soul(sub, file) {
|
|
162
215
|
if (sub === 'show') {
|
|
163
216
|
const doc = loadSoul()
|
|
@@ -228,6 +281,11 @@ if (!command || command === 'help' || command === '--help') {
|
|
|
228
281
|
forget(args[0])
|
|
229
282
|
} else if (command === 'export') {
|
|
230
283
|
exportLedger()
|
|
284
|
+
} else if (command === 'brief') {
|
|
285
|
+
brief(args.join(' ').trim())
|
|
286
|
+
} else if (command === 'office') {
|
|
287
|
+
await office(args[0], args[1], args[2])
|
|
288
|
+
process.exit(process.exitCode || 0)
|
|
231
289
|
} else if (command === 'soul') {
|
|
232
290
|
soul(args[0], args[1])
|
|
233
291
|
} else {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "advisers",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.2",
|
|
4
4
|
"description": "A staff of AI advisers: a cordis-native personal secretary runtime with scoped memory, commitments, and reviewable routines.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cordis",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"advisers-core": "0.1.0-preview.
|
|
33
|
+
"advisers-core": "0.1.0-preview.2"
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
@@ -43,5 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"advisers-office": "0.1.0-preview.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"advisers-office": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
}
|