@crouton-kit/crouter 0.3.2 → 0.3.3
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/dist/commands/human.js +6 -24
- package/package.json +2 -2
package/dist/commands/human.js
CHANGED
|
@@ -21,7 +21,7 @@ import { readConfig } from '../core/config.js';
|
|
|
21
21
|
import { mkdirSync, existsSync } from 'node:fs';
|
|
22
22
|
import { join, resolve } from 'node:path';
|
|
23
23
|
import { randomBytes } from 'node:crypto';
|
|
24
|
-
import { ask, launchReview, display, inbox, scanInbox, validateDeck, parseDeck, deckPath, atomicWriteJson, readJson, } from '@crouton-kit/humanloop';
|
|
24
|
+
import { ask, launchReview, display, inbox, scanInbox, validateDeck, approveDeck, notifyDeck, parseDeck, deckPath, atomicWriteJson, readJson, } from '@crouton-kit/humanloop';
|
|
25
25
|
const DECK_SCHEMA_HINT = 'Deck must match the humanloop deck schema: {title?, ' +
|
|
26
26
|
'source?:{sessionName?,askedBy?,blockedSince?}, ' +
|
|
27
27
|
'interactions:[{id,title,subtitle?,(body?|bodyPath?),options:[{id,label,' +
|
|
@@ -146,20 +146,10 @@ const humanApprove = defineLeaf({
|
|
|
146
146
|
const title = input['title'];
|
|
147
147
|
const subtitle = input['subtitle'];
|
|
148
148
|
const body = input['body'];
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
options: [
|
|
154
|
-
{ id: 'yes', label: 'Yes' },
|
|
155
|
-
{ id: 'no', label: 'No' },
|
|
156
|
-
],
|
|
157
|
-
};
|
|
158
|
-
if (subtitle !== undefined)
|
|
159
|
-
interaction['subtitle'] = subtitle;
|
|
160
|
-
if (body !== undefined)
|
|
161
|
-
interaction['body'] = body;
|
|
162
|
-
const deck = validateDeck({ interactions: [interaction] });
|
|
149
|
+
const deck = approveDeck(title, {
|
|
150
|
+
...(subtitle !== undefined ? { subtitle } : {}),
|
|
151
|
+
...(body !== undefined ? { body } : {}),
|
|
152
|
+
});
|
|
163
153
|
const cwd = process.cwd();
|
|
164
154
|
const { jobId } = createJob('human', { cwd });
|
|
165
155
|
const idir = interactionDir(jobId, cwd);
|
|
@@ -250,15 +240,7 @@ const humanNotify = defineLeaf({
|
|
|
250
240
|
run: async (input) => {
|
|
251
241
|
const title = input['title'];
|
|
252
242
|
const body = input['body'];
|
|
253
|
-
const
|
|
254
|
-
id: 'notify',
|
|
255
|
-
title,
|
|
256
|
-
kind: 'notify',
|
|
257
|
-
options: [{ id: 'ack', label: 'OK' }],
|
|
258
|
-
};
|
|
259
|
-
if (body !== undefined)
|
|
260
|
-
interaction['body'] = body;
|
|
261
|
-
const deck = validateDeck({ interactions: [interaction] });
|
|
243
|
+
const deck = notifyDeck(title, body !== undefined ? { body } : {});
|
|
262
244
|
const cwd = process.cwd();
|
|
263
245
|
const id = `nfy-${randomBytes(4).toString('hex')}`;
|
|
264
246
|
const idir = interactionDir(id, cwd);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crouton-kit/crouter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "crtr — fast access to skills, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@crouton-kit/humanloop": "^0.3.
|
|
38
|
+
"@crouton-kit/humanloop": "^0.3.8",
|
|
39
39
|
"commander": "^13.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|