@nettee/beacon 0.4.8 → 0.4.9
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.
|
@@ -3,8 +3,6 @@ import { type ChannelRegistry } from "./channels.js";
|
|
|
3
3
|
export declare const profilePersonaFile = "persona.md";
|
|
4
4
|
export declare const profileTaskFile = "task.md";
|
|
5
5
|
export declare const playbookProfileDirectoryName = ".beacon-profile";
|
|
6
|
-
/** @deprecated Use playbookProfileDirectoryName. */
|
|
7
|
-
export declare const workspaceProfileDirectoryName = ".beacon-profile";
|
|
8
6
|
export type DeliveryDestination = {
|
|
9
7
|
chatId: string;
|
|
10
8
|
name?: string | undefined;
|
|
@@ -43,8 +41,6 @@ export type LoadProfileOptions = {
|
|
|
43
41
|
channelsPath?: string;
|
|
44
42
|
};
|
|
45
43
|
export declare function playbookProfileDirectory(playbook: string): string;
|
|
46
|
-
/** @deprecated Use playbookProfileDirectory. */
|
|
47
|
-
export declare function workspaceProfileDirectory(playbook: string): string;
|
|
48
44
|
/** Expand `~` / `$HOME` and resolve relative paths against the Profile playbook. */
|
|
49
45
|
export declare function resolveSkillPath(rawPath: string, playbook: string): string;
|
|
50
46
|
export declare function loadProfile(profileId: string, profilesDirectory?: string, options?: LoadProfileOptions): Promise<Profile>;
|
|
@@ -10,8 +10,6 @@ const profileIdPattern = /^[a-z0-9](?:[a-z0-9_-]{0,62})$/;
|
|
|
10
10
|
export const profilePersonaFile = "persona.md";
|
|
11
11
|
export const profileTaskFile = "task.md";
|
|
12
12
|
export const playbookProfileDirectoryName = ".beacon-profile";
|
|
13
|
-
/** @deprecated Use playbookProfileDirectoryName. */
|
|
14
|
-
export const workspaceProfileDirectoryName = playbookProfileDirectoryName;
|
|
15
13
|
/** Admin DM: raw Feishu chat_id only (bot×person DMs are not channel registry entries). */
|
|
16
14
|
const adminDestinationSchema = z
|
|
17
15
|
.object({ chat_id: z.string().trim().min(1) })
|
|
@@ -63,12 +61,9 @@ const skillsSchema = z
|
|
|
63
61
|
paths: z.array(z.string().trim().min(1)).default([]),
|
|
64
62
|
})
|
|
65
63
|
.strict();
|
|
66
|
-
const
|
|
64
|
+
const profileDocumentSchema = z
|
|
67
65
|
.object({
|
|
68
|
-
|
|
69
|
-
playbook: z.string().min(1).optional(),
|
|
70
|
-
/** Legacy alias for `playbook`. Dual-read during rename; prefer `playbook`. */
|
|
71
|
-
workspace: z.string().min(1).optional(),
|
|
66
|
+
playbook: z.string().min(1),
|
|
72
67
|
runtime: z.literal("pi"),
|
|
73
68
|
model: z
|
|
74
69
|
.object({
|
|
@@ -90,34 +85,6 @@ const profileDocumentFieldsSchema = z
|
|
|
90
85
|
skills: skillsSchema.optional(),
|
|
91
86
|
})
|
|
92
87
|
.strict();
|
|
93
|
-
const profileDocumentSchema = profileDocumentFieldsSchema
|
|
94
|
-
.superRefine((document, context) => {
|
|
95
|
-
if (!document.playbook && !document.workspace) {
|
|
96
|
-
context.addIssue({
|
|
97
|
-
code: "custom",
|
|
98
|
-
message: "Profile must declare playbook (legacy key: workspace)",
|
|
99
|
-
path: ["playbook"],
|
|
100
|
-
});
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (document.playbook &&
|
|
104
|
-
document.workspace &&
|
|
105
|
-
document.playbook !== document.workspace) {
|
|
106
|
-
context.addIssue({
|
|
107
|
-
code: "custom",
|
|
108
|
-
message: "Profile playbook and legacy workspace must match when both are set",
|
|
109
|
-
path: ["playbook"],
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
.transform((document) => {
|
|
114
|
-
const playbook = document.playbook ?? document.workspace;
|
|
115
|
-
if (!playbook) {
|
|
116
|
-
throw new Error("Profile must declare playbook (legacy key: workspace)");
|
|
117
|
-
}
|
|
118
|
-
const { workspace: _legacy, playbook: _preferred, ...rest } = document;
|
|
119
|
-
return { ...rest, playbook };
|
|
120
|
-
});
|
|
121
88
|
function assertProfileId(profileId) {
|
|
122
89
|
if (!profileIdPattern.test(profileId)) {
|
|
123
90
|
throw new Error(`Invalid Profile ID: ${JSON.stringify(profileId)}`);
|
|
@@ -130,10 +97,6 @@ function isWithin(parent, child) {
|
|
|
130
97
|
export function playbookProfileDirectory(playbook) {
|
|
131
98
|
return join(playbook, playbookProfileDirectoryName);
|
|
132
99
|
}
|
|
133
|
-
/** @deprecated Use playbookProfileDirectory. */
|
|
134
|
-
export function workspaceProfileDirectory(playbook) {
|
|
135
|
-
return playbookProfileDirectory(playbook);
|
|
136
|
-
}
|
|
137
100
|
async function isExistingFile(path) {
|
|
138
101
|
try {
|
|
139
102
|
return (await stat(path)).isFile();
|
|
@@ -39,8 +39,7 @@ const skillsSchema = z
|
|
|
39
39
|
.strict();
|
|
40
40
|
const profileDocumentSchema = z
|
|
41
41
|
.object({
|
|
42
|
-
playbook: z.string().min(1)
|
|
43
|
-
workspace: z.string().min(1).optional(),
|
|
42
|
+
playbook: z.string().min(1),
|
|
44
43
|
runtime: z.literal("pi"),
|
|
45
44
|
model: z
|
|
46
45
|
.object({
|
|
@@ -60,34 +59,7 @@ const profileDocumentSchema = z
|
|
|
60
59
|
.optional(),
|
|
61
60
|
skills: skillsSchema.optional(),
|
|
62
61
|
})
|
|
63
|
-
.strict()
|
|
64
|
-
.superRefine((document, context) => {
|
|
65
|
-
if (!document.playbook && !document.workspace) {
|
|
66
|
-
context.addIssue({
|
|
67
|
-
code: "custom",
|
|
68
|
-
message: "Profile must declare playbook (legacy key: workspace)",
|
|
69
|
-
path: ["playbook"],
|
|
70
|
-
});
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (document.playbook &&
|
|
74
|
-
document.workspace &&
|
|
75
|
-
document.playbook !== document.workspace) {
|
|
76
|
-
context.addIssue({
|
|
77
|
-
code: "custom",
|
|
78
|
-
message: "Profile playbook and legacy workspace must match when both are set",
|
|
79
|
-
path: ["playbook"],
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
.transform((document) => {
|
|
84
|
-
const playbook = document.playbook ?? document.workspace;
|
|
85
|
-
if (!playbook) {
|
|
86
|
-
throw new Error("Profile must declare playbook (legacy key: workspace)");
|
|
87
|
-
}
|
|
88
|
-
const { workspace: _legacy, playbook: _preferred, ...rest } = document;
|
|
89
|
-
return { ...rest, playbook };
|
|
90
|
-
});
|
|
62
|
+
.strict();
|
|
91
63
|
function toNotifyView(notify) {
|
|
92
64
|
if (!notify)
|
|
93
65
|
return null;
|
|
@@ -44,24 +44,7 @@ const inputSchema = z.discriminatedUnion("kind", [
|
|
|
44
44
|
.strict(),
|
|
45
45
|
z.object({ kind: z.literal("manual"), text: z.string().min(1) }).strict(),
|
|
46
46
|
]);
|
|
47
|
-
const runSchema = z
|
|
48
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
49
|
-
return value;
|
|
50
|
-
}
|
|
51
|
-
const record = value;
|
|
52
|
-
if (typeof record.playbook === "string") {
|
|
53
|
-
if ("workspace" in record) {
|
|
54
|
-
const { workspace: _legacy, ...rest } = record;
|
|
55
|
-
return rest;
|
|
56
|
-
}
|
|
57
|
-
return record;
|
|
58
|
-
}
|
|
59
|
-
if (typeof record.workspace === "string") {
|
|
60
|
-
const { workspace, ...rest } = record;
|
|
61
|
-
return { ...rest, playbook: workspace };
|
|
62
|
-
}
|
|
63
|
-
return record;
|
|
64
|
-
}, z
|
|
47
|
+
const runSchema = z
|
|
65
48
|
.object({
|
|
66
49
|
runId: z.string().min(1),
|
|
67
50
|
sessionId: z
|
|
@@ -84,7 +67,7 @@ const runSchema = z.preprocess((value) => {
|
|
|
84
67
|
systemPrompt: z.string().min(1).optional(),
|
|
85
68
|
failure: failureSchema.optional(),
|
|
86
69
|
})
|
|
87
|
-
.strict()
|
|
70
|
+
.strict();
|
|
88
71
|
const outcomeSchema = z.union([
|
|
89
72
|
z
|
|
90
73
|
.object({
|