@crouton-kit/humanloop 0.3.18 → 0.3.19
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/api.d.ts +0 -8
- package/dist/api.js +1 -7
- package/dist/cli.js +1 -1
- package/dist/inbox/deck-factories.d.ts +0 -6
- package/dist/inbox/deck-factories.js +0 -16
- package/dist/inbox/deck-schema.d.ts +0 -1
- package/dist/inbox/deck-schema.js +1 -1
- package/dist/inbox/tui.js +0 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -12,14 +12,6 @@ export interface AskOpts {
|
|
|
12
12
|
* on completion, `<dir>/response.json`.
|
|
13
13
|
*/
|
|
14
14
|
export declare function ask(deck: Deck, opts?: AskOpts): Promise<ResolutionEnvelope>;
|
|
15
|
-
export interface ApproveOpts {
|
|
16
|
-
subtitle?: string;
|
|
17
|
-
body?: string;
|
|
18
|
-
dir?: string;
|
|
19
|
-
sessionId?: string;
|
|
20
|
-
}
|
|
21
|
-
/** Sugar: a single `kind:'validation'` Yes/No interaction. */
|
|
22
|
-
export declare function approve(title: string, opts?: ApproveOpts): Promise<boolean>;
|
|
23
15
|
/** Sugar: a single `kind:'notify'` acknowledgement. */
|
|
24
16
|
export declare function notify(title: string, body?: string): Promise<void>;
|
|
25
17
|
export interface InboxOpts {
|
package/dist/api.js
CHANGED
|
@@ -6,7 +6,7 @@ import { scanInbox } from './inbox/scan.js';
|
|
|
6
6
|
import { pickFromInbox } from './inbox/tui.js';
|
|
7
7
|
import { deckPath, atomicWriteJson, readJson, stampCanvasNode } from './inbox/convention.js';
|
|
8
8
|
import { getTerminalSize } from './tui/terminal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { notifyDeck } from './inbox/deck-factories.js';
|
|
10
10
|
const RESPONSE_SCHEMA_ID = 'humanloop.response/v2';
|
|
11
11
|
function managedDir() {
|
|
12
12
|
return mkdtempSync(join(tmpdir(), 'hl-ix-'));
|
|
@@ -78,12 +78,6 @@ export async function ask(deck, opts = {}) {
|
|
|
78
78
|
completedAt,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
/** Sugar: a single `kind:'validation'` Yes/No interaction. */
|
|
82
|
-
export async function approve(title, opts = {}) {
|
|
83
|
-
const deck = approveDeck(title, { subtitle: opts.subtitle, body: opts.body });
|
|
84
|
-
const env = await ask(deck, { dir: opts.dir, sessionId: opts.sessionId });
|
|
85
|
-
return env.responses[0]?.selectedOptionId === 'yes';
|
|
86
|
-
}
|
|
87
81
|
/** Sugar: a single `kind:'notify'` acknowledgement. */
|
|
88
82
|
export async function notify(title, body) {
|
|
89
83
|
const deck = notifyDeck(title, body !== undefined ? { body } : {});
|
package/dist/cli.js
CHANGED
|
@@ -217,7 +217,7 @@ const REQUEST_SCHEMA = {
|
|
|
217
217
|
},
|
|
218
218
|
allowFreetext: { type: 'boolean' },
|
|
219
219
|
freetextLabel: { type: 'string' },
|
|
220
|
-
kind: { type: 'string', enum: ['notify', '
|
|
220
|
+
kind: { type: 'string', enum: ['notify', 'decision', 'context', 'error'] },
|
|
221
221
|
},
|
|
222
222
|
},
|
|
223
223
|
},
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import type { Deck } from '../types.js';
|
|
2
|
-
export interface ApproveDeckOpts {
|
|
3
|
-
subtitle?: string;
|
|
4
|
-
body?: string;
|
|
5
|
-
}
|
|
6
|
-
/** Build a validated Yes/No validation deck. id: 'approve', kind: 'validation'. */
|
|
7
|
-
export declare function approveDeck(title: string, opts?: ApproveDeckOpts): Deck;
|
|
8
2
|
export interface NotifyDeckOpts {
|
|
9
3
|
body?: string;
|
|
10
4
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { validateDeck } from './deck-schema.js';
|
|
2
|
-
/** Build a validated Yes/No validation deck. id: 'approve', kind: 'validation'. */
|
|
3
|
-
export function approveDeck(title, opts = {}) {
|
|
4
|
-
return validateDeck({
|
|
5
|
-
interactions: [{
|
|
6
|
-
id: 'approve',
|
|
7
|
-
title,
|
|
8
|
-
...(opts.subtitle !== undefined ? { subtitle: opts.subtitle } : {}),
|
|
9
|
-
...(opts.body !== undefined ? { body: opts.body } : {}),
|
|
10
|
-
kind: 'validation',
|
|
11
|
-
options: [
|
|
12
|
-
{ id: 'yes', label: 'Yes' },
|
|
13
|
-
{ id: 'no', label: 'No' },
|
|
14
|
-
],
|
|
15
|
-
}],
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
2
|
/** Build a validated single-option notify deck. id: 'notify', kind: 'notify'. */
|
|
19
3
|
export function notifyDeck(title, opts = {}) {
|
|
20
4
|
return validateDeck({
|
|
@@ -29,7 +29,7 @@ const interactionSchema = z.object({
|
|
|
29
29
|
multiSelect: z.boolean().optional(),
|
|
30
30
|
allowFreetext: z.boolean().optional(),
|
|
31
31
|
freetextLabel: z.string().optional(),
|
|
32
|
-
kind: z.enum(['notify', '
|
|
32
|
+
kind: z.enum(['notify', 'decision', 'context', 'error']).optional(),
|
|
33
33
|
preAnswered: preAnswerSchema.optional(),
|
|
34
34
|
});
|
|
35
35
|
const deckSourceSchema = z.object({
|
package/dist/inbox/tui.js
CHANGED
|
@@ -23,14 +23,12 @@ function ansiColor(text, color) {
|
|
|
23
23
|
// ── Row model (ported verbatim from sisyphus cross-session-inbox.ts:8-21) ────
|
|
24
24
|
export const KIND_ICON = {
|
|
25
25
|
notify: '✉',
|
|
26
|
-
validation: '✓',
|
|
27
26
|
decision: '◆',
|
|
28
27
|
context: '✎',
|
|
29
28
|
error: '⚠',
|
|
30
29
|
};
|
|
31
30
|
export const KIND_COLOR = {
|
|
32
31
|
notify: 'gray',
|
|
33
|
-
validation: 'cyan',
|
|
34
32
|
decision: 'cyan',
|
|
35
33
|
context: 'cyan',
|
|
36
34
|
error: 'red',
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ export { defaultGenerateVisual } from './visuals/generate.js';
|
|
|
3
3
|
export { launchReview } from './editor/review.js';
|
|
4
4
|
export { launchReview as review } from './editor/review.js';
|
|
5
5
|
export type { ReviewOptions } from './editor/review.js';
|
|
6
|
-
export { ask,
|
|
6
|
+
export { ask, notify, inbox } from './api.js';
|
|
7
7
|
export { display } from './surfaces/display.js';
|
|
8
8
|
export { scanInbox } from './inbox/scan.js';
|
|
9
9
|
export { renderMarkdown, checkMarkdown, ensureRenderer, isRendererReady, } from './render/termrender.js';
|
|
10
10
|
export { parseDeck, validateDeck, deckSchema } from './inbox/deck-schema.js';
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
11
|
+
export { notifyDeck } from './inbox/deck-factories.js';
|
|
12
|
+
export type { NotifyDeckOpts } from './inbox/deck-factories.js';
|
|
13
13
|
export { deckPath, responsePath, progressPath, visualsDir, interactionState, isResolved, isClaimed, atomicWriteJson, readJson, writeResponse, writeProgress, clearProgress, } from './inbox/convention.js';
|
|
14
14
|
export type { InteractionState } from './inbox/convention.js';
|
|
15
15
|
export type { Interaction, InteractionOption, InteractionResponse, InteractionKind, Deck, DeckSource, MountedPanel, MountedPanelOpts, GenerateVisual, VisualBlock, FeedbackComment, FeedbackResult, ResolutionEnvelope, InboxItem, DisplayOpts, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { defaultGenerateVisual } from './visuals/generate.js';
|
|
|
3
3
|
export { launchReview } from './editor/review.js';
|
|
4
4
|
export { launchReview as review } from './editor/review.js';
|
|
5
5
|
// Interaction-layer surface (SDK).
|
|
6
|
-
export { ask,
|
|
6
|
+
export { ask, notify, inbox } from './api.js';
|
|
7
7
|
export { display } from './surfaces/display.js';
|
|
8
8
|
export { scanInbox } from './inbox/scan.js';
|
|
9
9
|
// Renderer binding — the sole org-wide termrender caller. Consumers
|
|
@@ -13,6 +13,6 @@ export { renderMarkdown, checkMarkdown, ensureRenderer, isRendererReady, } from
|
|
|
13
13
|
export { parseDeck, validateDeck, deckSchema } from './inbox/deck-schema.js';
|
|
14
14
|
// Deck factories — pure builders for common deck shapes (sugar for SDK consumers
|
|
15
15
|
// who want validated Yes/No or notify decks without inline construction).
|
|
16
|
-
export {
|
|
16
|
+
export { notifyDeck } from './inbox/deck-factories.js';
|
|
17
17
|
// Interaction-directory convention helpers (§B) — names humanloop owns.
|
|
18
18
|
export { deckPath, responsePath, progressPath, visualsDir, interactionState, isResolved, isClaimed, atomicWriteJson, readJson, writeResponse, writeProgress, clearProgress, } from './inbox/convention.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Key } from './tui/terminal.js';
|
|
2
|
-
export type InteractionKind = 'notify' | '
|
|
2
|
+
export type InteractionKind = 'notify' | 'decision' | 'context' | 'error' | 'review';
|
|
3
3
|
export interface InteractionOption {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|