bkper 5.7.2 → 5.8.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 +25 -0
- package/lib/agent/bundle/agent-entry.js +110 -103
- package/lib/agent/context-resources.d.ts +44 -0
- package/lib/agent/context-resources.d.ts.map +1 -0
- package/lib/agent/context-resources.js +110 -0
- package/lib/agent/context-resources.js.map +1 -0
- package/lib/agent/interactive/run-agent-mode.d.ts +2 -0
- package/lib/agent/interactive/run-agent-mode.d.ts.map +1 -1
- package/lib/agent/interactive/run-agent-mode.js +22 -3
- package/lib/agent/interactive/run-agent-mode.js.map +1 -1
- package/lib/agent/startup-maintenance.d.ts +13 -2
- package/lib/agent/startup-maintenance.d.ts.map +1 -1
- package/lib/agent/startup-maintenance.js +35 -8
- package/lib/agent/startup-maintenance.js.map +1 -1
- package/lib/cli.js +3 -0
- package/lib/cli.js.map +1 -1
- package/lib/commands/agent-command.d.ts +9 -1
- package/lib/commands/agent-command.d.ts.map +1 -1
- package/lib/commands/agent-command.js +45 -4
- package/lib/commands/agent-command.js.map +1 -1
- package/lib/commands/apps/dev.d.ts.map +1 -1
- package/lib/commands/apps/dev.js +5 -4
- package/lib/commands/apps/dev.js.map +1 -1
- package/lib/commands/apps/git/credentials.d.ts +1 -0
- package/lib/commands/apps/git/credentials.d.ts.map +1 -1
- package/lib/commands/apps/git/credentials.js +1 -1
- package/lib/commands/apps/git/credentials.js.map +1 -1
- package/lib/commands/context/book-context.d.ts +20 -0
- package/lib/commands/context/book-context.d.ts.map +1 -0
- package/lib/commands/context/book-context.js +40 -0
- package/lib/commands/context/book-context.js.map +1 -0
- package/lib/commands/context/domain-context.d.ts +21 -0
- package/lib/commands/context/domain-context.d.ts.map +1 -0
- package/lib/commands/context/domain-context.js +39 -0
- package/lib/commands/context/domain-context.js.map +1 -0
- package/lib/commands/context/git-credential.d.ts +17 -0
- package/lib/commands/context/git-credential.d.ts.map +1 -0
- package/lib/commands/context/git-credential.js +121 -0
- package/lib/commands/context/git-credential.js.map +1 -0
- package/lib/commands/context/platform-context.d.ts +42 -0
- package/lib/commands/context/platform-context.d.ts.map +1 -0
- package/lib/commands/context/platform-context.js +84 -0
- package/lib/commands/context/platform-context.js.map +1 -0
- package/lib/commands/context/register.d.ts +4 -0
- package/lib/commands/context/register.d.ts.map +1 -0
- package/lib/commands/context/register.js +79 -0
- package/lib/commands/context/register.js.map +1 -0
- package/lib/commands/context/user-context.d.ts +36 -0
- package/lib/commands/context/user-context.d.ts.map +1 -0
- package/lib/commands/context/user-context.js +125 -0
- package/lib/commands/context/user-context.js.map +1 -0
- package/lib/dev/auth-middleware.d.ts +11 -1
- package/lib/dev/auth-middleware.d.ts.map +1 -1
- package/lib/dev/auth-middleware.js +16 -1
- package/lib/dev/auth-middleware.js.map +1 -1
- package/lib/dev/local-outbound.d.ts +7 -0
- package/lib/dev/local-outbound.d.ts.map +1 -1
- package/lib/dev/local-outbound.js +26 -12
- package/lib/dev/local-outbound.js.map +1 -1
- package/lib/dev/managed-sandbox.d.ts +11 -0
- package/lib/dev/managed-sandbox.d.ts.map +1 -0
- package/lib/dev/managed-sandbox.js +13 -0
- package/lib/dev/managed-sandbox.js.map +1 -0
- package/lib/dev/tunnel.d.ts +5 -0
- package/lib/dev/tunnel.d.ts.map +1 -1
- package/lib/dev/tunnel.js +15 -0
- package/lib/dev/tunnel.js.map +1 -1
- package/lib/docs/api/managed-agent.md +133 -1
- package/lib/docs/cli/app-management.md +3 -1
- package/lib/docs/cli/data-management.md +14 -1
- package/lib/docs/sdk/bkper-api-types.md +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ResourceDiagnostic, type Skill } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
/**
|
|
3
|
+
* Agent context clones (`~/.bkper/domain` when the person has a company domain, `~/.bkper/user`, and with
|
|
4
|
+
* `bkper agent -b <bookId>` the Book's in `~/.bkper/books/<bookId>`, kept up to date by `bkper context pull` and
|
|
5
|
+
* startup maintenance) in Pi's own resources:
|
|
6
|
+
* their skills and AGENTS.md, read again at every start and `/reload`. Limits as the managed agent's: AGENTS.md at most
|
|
7
|
+
* 16,000 characters, at most 50 skills, per scope.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_CONTEXT_AGENTS_CHARS = 16000;
|
|
10
|
+
export declare const MAX_CONTEXT_SKILLS = 50;
|
|
11
|
+
type SkillsResult = {
|
|
12
|
+
skills: Skill[];
|
|
13
|
+
diagnostics: ResourceDiagnostic[];
|
|
14
|
+
};
|
|
15
|
+
type AgentsFiles = {
|
|
16
|
+
agentsFiles: Array<{
|
|
17
|
+
path: string;
|
|
18
|
+
content: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** The clones a session loads: the company's (when pulled), the user's, and the Book's it works on. */
|
|
22
|
+
export interface ContextDirs {
|
|
23
|
+
domain?: string;
|
|
24
|
+
user: string;
|
|
25
|
+
book?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pi's skills, then the Book's, then the user's, then the domain's. Pi keeps the first skill of a name, so a project's and the
|
|
29
|
+
* person's own local skills win over the context's, a Book's over the user's, and the user's over the domain's (as in the
|
|
30
|
+
* managed agent).
|
|
31
|
+
*/
|
|
32
|
+
export declare function withContextSkills(base: SkillsResult, dirs?: ContextDirs): SkillsResult;
|
|
33
|
+
/**
|
|
34
|
+
* Pi's context files with the domain's AGENTS.md, then the user's, then the Book's, after the global one (Pi's agent
|
|
35
|
+
* directory) and before the project's: later is more specific and wins on conflict.
|
|
36
|
+
*/
|
|
37
|
+
export declare function withContextAgentsFiles(base: AgentsFiles, agentDir: string, dirs?: ContextDirs): AgentsFiles;
|
|
38
|
+
/**
|
|
39
|
+
* With `bkper agent -b <bookId>`: which Book the session works on, and where its context clone is. Its AGENTS.md and skills
|
|
40
|
+
* are loaded beside the user's.
|
|
41
|
+
*/
|
|
42
|
+
export declare function bookContextNote(bookId: string, dir: string): string;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=context-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-resources.d.ts","sourceRoot":"","sources":["../../src/agent/context-resources.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACb,MAAM,iCAAiC,CAAC;AAIzC;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAC9C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,KAAK,YAAY,GAAG;IAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,EAAE,kBAAkB,EAAE,CAAA;CAAC,CAAC;AACzE,KAAK,WAAW,GAAG;IAAC,WAAW,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAAC,CAAC;AACzE,uGAAuG;AACvG,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAqBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,GAAE,WAA2B,GAAG,YAAY,CA0BrG;AAmBD;;;GAGG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAA2B,GAClC,WAAW,CASb;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAUnE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { loadSkillsFromDir, } from '@earendil-works/pi-coding-agent';
|
|
4
|
+
import { getDomainContextDir } from '../commands/context/domain-context.js';
|
|
5
|
+
import { getUserContextDir } from '../commands/context/user-context.js';
|
|
6
|
+
/**
|
|
7
|
+
* Agent context clones (`~/.bkper/domain` when the person has a company domain, `~/.bkper/user`, and with
|
|
8
|
+
* `bkper agent -b <bookId>` the Book's in `~/.bkper/books/<bookId>`, kept up to date by `bkper context pull` and
|
|
9
|
+
* startup maintenance) in Pi's own resources:
|
|
10
|
+
* their skills and AGENTS.md, read again at every start and `/reload`. Limits as the managed agent's: AGENTS.md at most
|
|
11
|
+
* 16,000 characters, at most 50 skills, per scope.
|
|
12
|
+
*/
|
|
13
|
+
export const MAX_CONTEXT_AGENTS_CHARS = 16000;
|
|
14
|
+
export const MAX_CONTEXT_SKILLS = 50;
|
|
15
|
+
const defaultDirs = () => ({ domain: getDomainContextDir(), user: getUserContextDir() });
|
|
16
|
+
/** One clone's skills, in name order, at most 50, with a warning beyond. */
|
|
17
|
+
function cloneSkills(dir, whose) {
|
|
18
|
+
const skillsDir = path.join(dir, '.agents', 'skills');
|
|
19
|
+
if (!fs.existsSync(skillsDir))
|
|
20
|
+
return { skills: [], diagnostics: [] };
|
|
21
|
+
const loaded = loadSkillsFromDir({ dir: skillsDir, source: 'bkper-context' });
|
|
22
|
+
const sorted = [...loaded.skills].sort((a, b) => a.name.localeCompare(b.name));
|
|
23
|
+
const diagnostics = [...loaded.diagnostics];
|
|
24
|
+
if (sorted.length > MAX_CONTEXT_SKILLS) {
|
|
25
|
+
diagnostics.push({
|
|
26
|
+
type: 'warning',
|
|
27
|
+
message: `${sorted.length} skills in ${whose}; only the first ${MAX_CONTEXT_SKILLS}, by name, load`,
|
|
28
|
+
path: skillsDir,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return { skills: sorted.slice(0, MAX_CONTEXT_SKILLS), diagnostics };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Pi's skills, then the Book's, then the user's, then the domain's. Pi keeps the first skill of a name, so a project's and the
|
|
35
|
+
* person's own local skills win over the context's, a Book's over the user's, and the user's over the domain's (as in the
|
|
36
|
+
* managed agent).
|
|
37
|
+
*/
|
|
38
|
+
export function withContextSkills(base, dirs = defaultDirs()) {
|
|
39
|
+
const skills = [...base.skills];
|
|
40
|
+
const diagnostics = [...base.diagnostics];
|
|
41
|
+
const clones = [
|
|
42
|
+
...(dirs.book ? [{ dir: dirs.book, whose: "this Book's agent context" }] : []),
|
|
43
|
+
{ dir: dirs.user, whose: 'your agent context' },
|
|
44
|
+
...(dirs.domain ? [{ dir: dirs.domain, whose: "your company's agent context" }] : []),
|
|
45
|
+
];
|
|
46
|
+
for (const { dir, whose } of clones) {
|
|
47
|
+
const loaded = cloneSkills(dir, whose);
|
|
48
|
+
diagnostics.push(...loaded.diagnostics);
|
|
49
|
+
for (const skill of loaded.skills) {
|
|
50
|
+
const winner = skills.find(existing => existing.name === skill.name);
|
|
51
|
+
if (!winner) {
|
|
52
|
+
skills.push(skill);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
diagnostics.push({
|
|
56
|
+
type: 'collision',
|
|
57
|
+
message: `name "${skill.name}" collision`,
|
|
58
|
+
path: skill.filePath,
|
|
59
|
+
collision: { resourceType: 'skill', name: skill.name, winnerPath: winner.filePath, loserPath: skill.filePath },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { skills, diagnostics };
|
|
64
|
+
}
|
|
65
|
+
/** A clone's AGENTS.md, cut at 16,000 characters; undefined without one. */
|
|
66
|
+
function agentsFile(dir) {
|
|
67
|
+
const file = path.join(dir, 'AGENTS.md');
|
|
68
|
+
let content;
|
|
69
|
+
try {
|
|
70
|
+
content = fs.readFileSync(file, 'utf8');
|
|
71
|
+
}
|
|
72
|
+
catch (_a) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
if (content.length > MAX_CONTEXT_AGENTS_CHARS) {
|
|
76
|
+
content =
|
|
77
|
+
content.slice(0, MAX_CONTEXT_AGENTS_CHARS) +
|
|
78
|
+
`\n\n[AGENTS.md truncated at ${MAX_CONTEXT_AGENTS_CHARS} characters]`;
|
|
79
|
+
}
|
|
80
|
+
return { path: file, content };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Pi's context files with the domain's AGENTS.md, then the user's, then the Book's, after the global one (Pi's agent
|
|
84
|
+
* directory) and before the project's: later is more specific and wins on conflict.
|
|
85
|
+
*/
|
|
86
|
+
export function withContextAgentsFiles(base, agentDir, dirs = defaultDirs()) {
|
|
87
|
+
const added = [...(dirs.domain ? [dirs.domain] : []), dirs.user, ...(dirs.book ? [dirs.book] : [])].flatMap(dir => { var _a; return (_a = agentsFile(dir)) !== null && _a !== void 0 ? _a : []; });
|
|
88
|
+
if (!added.length)
|
|
89
|
+
return base;
|
|
90
|
+
const paths = new Set(added.map(file => file.path));
|
|
91
|
+
const global = base.agentsFiles.filter(item => path.dirname(item.path) === path.resolve(agentDir));
|
|
92
|
+
const rest = base.agentsFiles.filter(item => !global.includes(item) && !paths.has(item.path));
|
|
93
|
+
return { agentsFiles: [...global, ...added, ...rest] };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* With `bkper agent -b <bookId>`: which Book the session works on, and where its context clone is. Its AGENTS.md and skills
|
|
97
|
+
* are loaded beside the user's.
|
|
98
|
+
*/
|
|
99
|
+
export function bookContextNote(bookId, dir) {
|
|
100
|
+
return [
|
|
101
|
+
'## Book agent context',
|
|
102
|
+
'',
|
|
103
|
+
`This session works on Book ${bookId}. Its agent context clone is ${dir}: its AGENTS.md and .agents/skills say how that ` +
|
|
104
|
+
'Book works, for everyone who can view it, and load with your other context. Its procedures apply to that Book only. It never ' +
|
|
105
|
+
'holds Book data, documents or reports. Pushing publishes to everyone who can view the Book (only its editors can ' +
|
|
106
|
+
'push): before pushing, show the user the diff and who it affects. If a push is rejected, pull, rebase and ask again; ' +
|
|
107
|
+
'never force-push.',
|
|
108
|
+
].join('\n');
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=context-resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-resources.js","sourceRoot":"","sources":["../../src/agent/context-resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACH,iBAAiB,GAGpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAC,iBAAiB,EAAC,MAAM,qCAAqC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAWrC,MAAM,WAAW,GAAG,GAAgB,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAC,CAAC,CAAC;AAEpG,4EAA4E;AAC5E,SAAS,WAAW,CAAC,GAAW,EAAE,KAAa;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAC,CAAC;IACpE,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,MAAM,WAAW,GAAG,CAAC,G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AM,UAAU,eAAe,CAAC,MAAc,EAAE,GAAW;IACvD,OAAO;QACH,uBAAuB;QACvB,EAAE;QACF,8BAA8B,MAAM,gCAAgC,GAAG,kDAAkD;YACrH,+HAA+H;YAC/H,mHAAmH;YACnH,uHAAuH;YACvH,mBAAmB;KAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -29,6 +29,8 @@ export interface SessionOptions {
|
|
|
29
29
|
noContextFiles?: boolean;
|
|
30
30
|
messages?: string[];
|
|
31
31
|
fileArgs?: string[];
|
|
32
|
+
/** `-b, --book`: the Book whose agent context loads beside the user's. */
|
|
33
|
+
bookId?: string;
|
|
32
34
|
}
|
|
33
35
|
export declare function createAgentModeDependencies(sessionOptions?: SessionOptions): AgentModeDependencies;
|
|
34
36
|
export declare function runAgentMode(dependencies?: AgentModeDependencies): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-agent-mode.d.ts","sourceRoot":"","sources":["../../../src/agent/interactive/run-agent-mode.ts"],"names":[],"mappings":"AACA,OAAO,EASH,KAAK,6BAA6B,EAClC,KAAK,IAAI,EAGZ,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"run-agent-mode.d.ts","sourceRoot":"","sources":["../../../src/agent/interactive/run-agent-mode.ts"],"names":[],"mappings":"AACA,OAAO,EASH,KAAK,6BAA6B,EAClC,KAAK,IAAI,EAGZ,MAAM,iCAAiC,CAAC;AAezC,OAAO,EAAqB,KAAK,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,uBAAuB,CAAC;AAY/B,MAAM,WAAW,qBAAqB;IAClC,aAAa,EAAE,MAAM,OAAO,CAAC;QACzB,OAAO,EAAE,sBAAsB,CAAC;QAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,WAAW,CAAC,EAAE,6BAA6B,EAAE,CAAC;QAC9C,aAAa,CAAC,EAAE,aAAa,CAAC;KACjC,CAAC,CAAC;IACH,qBAAqB,EAAE,CACnB,OAAO,EAAE,sBAAsB,EAC/B,oBAAoB,CAAC,EAAE,MAAM,EAC7B,aAAa,CAAC,EAAE,aAAa,KAC5B;QACD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACxB,CAAC;CACL;AAcD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAsCD,wBAAgB,2BAA2B,CACvC,cAAc,GAAE,cAAmB,GACpC,qBAAqB,CAmMvB;AAED,wBAAsB,YAAY,CAC9B,YAAY,GAAE,qBAAqD,GACpE,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -12,8 +12,12 @@ import { createAgentSessionFromServices, createAgentSessionRuntime, createAgentS
|
|
|
12
12
|
import { isBkperAgentVerboseDiagnosticsEnabled, normalizeBkperAgentExtensions, registerBkperAgentBuiltins, } from '../extensions/builtins.js';
|
|
13
13
|
import { getBkperAiBaseUrlOverride } from '../extensions/bkper-ai-provider.js';
|
|
14
14
|
import { editHandoffGoal } from '../extensions/handoff-goal-editor.js';
|
|
15
|
+
import { bookContextNote, withContextAgentsFiles, withContextSkills } from '../context-resources.js';
|
|
16
|
+
import { getBookContextDir } from '../../commands/context/book-context.js';
|
|
17
|
+
import { getDomainContextDir } from '../../commands/context/domain-context.js';
|
|
18
|
+
import { getUserContextDir } from '../../commands/context/user-context.js';
|
|
15
19
|
import { AgentStartupError } from '../startup-error.js';
|
|
16
|
-
import { runStartupMaintenance } from '../startup-maintenance.js';
|
|
20
|
+
import { runStartupMaintenance, startupMaintenanceDependencies } from '../startup-maintenance.js';
|
|
17
21
|
import { getBkperAgentSystemPrompt } from '../system-prompt.js';
|
|
18
22
|
import { buildInitialPrompt } from './initial-prompt.js';
|
|
19
23
|
import { FilePromptHistory, getPromptHistoryPath } from './prompt-history-store.js';
|
|
@@ -61,6 +65,8 @@ export function createAgentModeDependencies(sessionOptions = {}) {
|
|
|
61
65
|
getBkperAiBaseUrlOverride();
|
|
62
66
|
const cwd = process.cwd();
|
|
63
67
|
const agentDir = getAgentDir();
|
|
68
|
+
// The company's and the user's context clones, and with --book the Book's beside them (pulled in the background).
|
|
69
|
+
const contextDirs = Object.assign({ domain: getDomainContextDir(), user: getUserContextDir() }, (sessionOptions.bookId ? { book: getBookContextDir(sessionOptions.bookId) } : {}));
|
|
64
70
|
const startupSettingsManager = SettingsManager.create(cwd, agentDir);
|
|
65
71
|
const startupDiagnostics = collectSettingsDiagnostics(startupSettingsManager, 'startup session lookup');
|
|
66
72
|
const createRuntime = (_a) => __awaiter(this, [_a], void 0, function* ({ cwd, agentDir, sessionManager, sessionStartEvent, }) {
|
|
@@ -96,10 +102,23 @@ export function createAgentModeDependencies(sessionOptions = {}) {
|
|
|
96
102
|
noSkills: sessionOptions.noSkills,
|
|
97
103
|
noPromptTemplates: sessionOptions.noPromptTemplates,
|
|
98
104
|
noContextFiles: sessionOptions.noContextFiles,
|
|
99
|
-
|
|
105
|
+
// With --book, the agent is told which Book it works on.
|
|
106
|
+
systemPromptOverride: () => [
|
|
107
|
+
getBkperAgentSystemPrompt(selectedTools),
|
|
108
|
+
contextDirs.book && sessionOptions.bookId
|
|
109
|
+
? bookContextNote(sessionOptions.bookId, contextDirs.book)
|
|
110
|
+
: undefined,
|
|
111
|
+
]
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.join('\n\n'),
|
|
114
|
+
// The agent context clones, read again at every /reload; the project's files win.
|
|
115
|
+
skillsOverride: base => sessionOptions.noSkills ? base : withContextSkills(base, contextDirs),
|
|
116
|
+
agentsFilesOverride: base => sessionOptions.noContextFiles
|
|
117
|
+
? base
|
|
118
|
+
: withContextAgentsFiles(base, agentDir, contextDirs),
|
|
100
119
|
extensionFactories: [
|
|
101
120
|
(pi) => {
|
|
102
|
-
registerBkperAgentBuiltins(pi, runStartupMaintenance, settingsManager, process.env, modelRuntime, dispatchHandoffCommand, (prefill, context) => editHandoffGoal(prefill, context, {
|
|
121
|
+
registerBkperAgentBuiltins(pi, callbacks => runStartupMaintenance(callbacks, startupMaintenanceDependencies(sessionOptions.bookId)), settingsManager, process.env, modelRuntime, dispatchHandoffCommand, (prefill, context) => editHandoffGoal(prefill, context, {
|
|
103
122
|
history: promptHistory,
|
|
104
123
|
templates: services.resourceLoader.getPrompts().prompts,
|
|
105
124
|
externalEditorCommand: settingsManager.getExternalEditorCommand(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-agent-mode.js","sourceRoot":"","sources":["../../../src/agent/interactive/run-agent-mode.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EACH,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,EAC1B,WAAW,EACX,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,GAKlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,qCAAqC,EACrC,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AAO;gBACP,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;gBAClD,WAAW,EAAE,CAAC,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;gBAC5D,aAAa;aAChB,CAAC;QACN,CAAC,CAAA;QACD,qBAAqB,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,EAAE,CACpE,IAAI,oBAAoB,CAAC,OAAO,kCACzB,aAAa,KAChB,oBAAoB,EACpB,mBAAmB,EAAE,+BAA+B,CAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CACnC,IACH;KACT,CAAC;AACN,CAAC;AAED,MAAM,UAAgB,YAAY;yDAC9B,eAAsC,2BAA2B,EAAE;;;QAEnE,YAAA,OAAO,CAAC,GAAG,EAAC,qBAAqB,uCAArB,qBAAqB,GAAK,GAAG,EAAC;QAE1C,MAAM,EAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,GAAG,EAAE,EAAE,aAAa,EAAC,GAClE,MAAM,YAAY,CAAC,aAAa,EAAE,CAAC;QACvC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAE/B,MAAM,IAAI,GAAG,YAAY,CAAC,qBAAqB,CAC3C,OAAO,EACP,oBAAoB,EACpB,aAAa,CAChB,CAAC;QAEF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type StartUpdateCheckOptions, type UpdateNotice } from '../upgrade/index.js';
|
|
2
|
+
import { type BookPullOutcome } from '../commands/context/book-context.js';
|
|
3
|
+
import { type DomainPullOutcome } from '../commands/context/domain-context.js';
|
|
4
|
+
import { type PullOutcome } from '../commands/context/user-context.js';
|
|
2
5
|
type NotificationType = 'info' | 'warning' | 'error';
|
|
3
6
|
export interface StartupMaintenanceCallbacks {
|
|
4
7
|
notify: (message: string, type?: NotificationType) => void;
|
|
@@ -6,15 +9,23 @@ export interface StartupMaintenanceCallbacks {
|
|
|
6
9
|
export interface StartupMaintenanceDependencies {
|
|
7
10
|
readNotice: () => UpdateNotice | undefined;
|
|
8
11
|
startUpdateCheck: () => boolean;
|
|
12
|
+
/** Bring the user's agent context clone up to date; undefined when there is nothing to pull with. */
|
|
13
|
+
pullContext?: () => Promise<PullOutcome | undefined>;
|
|
14
|
+
/** The same for the company's (domain's) clone, when the person has a domain. */
|
|
15
|
+
pullDomainContext?: () => Promise<DomainPullOutcome | undefined>;
|
|
16
|
+
/** With `bkper agent -b <bookId>`, the same for that Book's clone. */
|
|
17
|
+
pullBookContext?: () => Promise<BookPullOutcome | undefined>;
|
|
9
18
|
}
|
|
10
19
|
/**
|
|
11
20
|
* Unlike plain commands (once a day), interactive sessions check on every
|
|
12
21
|
* start, so new releases are picked up by the next session.
|
|
13
22
|
*/
|
|
14
23
|
export declare function startAgentUpdateCheck(options?: StartUpdateCheckOptions): boolean;
|
|
24
|
+
/** The real dependencies: the user's and the company's context; with a Book, its context too. */
|
|
25
|
+
export declare function startupMaintenanceDependencies(bookId?: string): StartupMaintenanceDependencies;
|
|
15
26
|
/**
|
|
16
|
-
*
|
|
17
|
-
* check. The install itself runs in the detached update worker.
|
|
27
|
+
* Starts the background pulls of the agent context (the user's, the company's, and the Book's with `--book`), reports the outcome of the last background update and starts
|
|
28
|
+
* the daily check. The install itself runs in the detached update worker. Never waits on the network.
|
|
18
29
|
*/
|
|
19
30
|
export declare function runStartupMaintenance(callbacks: StartupMaintenanceCallbacks, dependencies?: StartupMaintenanceDependencies): Promise<void>;
|
|
20
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACpB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,WA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AED,iGAAiG;AACjG,wBAAgB,8BAA8B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,8BAA8B,CAQ9F;AA4BD;;;GAGG;AACH,wBAAsB,qBAAqB,CACvC,SAAS,EAAE,2BAA2B,EACtC,YAAY,GAAE,8BAAiE,GAChF,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
|
@@ -8,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { AGENT_CHECK_INTERVAL_MS, formatUpdateNotice, getUpdateNotice, isUpdateCheckDisabled, maybeStartUpdateCheck, readUpdateState, } from '../upgrade/index.js';
|
|
11
|
+
import { isLoggedIn } from '../auth/local-auth-service.js';
|
|
12
|
+
import { pullBookContext } from '../commands/context/book-context.js';
|
|
13
|
+
import { pullDomainContext } from '../commands/context/domain-context.js';
|
|
14
|
+
import { pullUserContext } from '../commands/context/user-context.js';
|
|
15
|
+
const UNPUSHED_CONTEXT_NOTICE = 'Your agent context in ~/.bkper/user has changes not pushed, so newer published ones were not pulled.';
|
|
16
|
+
const UNPUSHED_DOMAIN_CONTEXT_NOTICE = "Your clone of your company's agent context in ~/.bkper/domain has changes not pushed, so newer published ones were not pulled.";
|
|
17
|
+
const UNPUSHED_BOOK_CONTEXT_NOTICE = "Your clone of this Book's agent context in ~/.bkper/books has changes not pushed, so newer published ones were not pulled.";
|
|
11
18
|
/**
|
|
12
19
|
* Unlike plain commands (once a day), interactive sessions check on every
|
|
13
20
|
* start, so new releases are picked up by the next session.
|
|
@@ -15,18 +22,38 @@ import { AGENT_CHECK_INTERVAL_MS, formatUpdateNotice, getUpdateNotice, isUpdateC
|
|
|
15
22
|
export function startAgentUpdateCheck(options = {}) {
|
|
16
23
|
return maybeStartUpdateCheck(Object.assign(Object.assign({}, options), { intervalMs: AGENT_CHECK_INTERVAL_MS }));
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
startUpdateCheck: () => startAgentUpdateCheck(),
|
|
22
|
-
};
|
|
25
|
+
/** The real dependencies: the user's and the company's context; with a Book, its context too. */
|
|
26
|
+
export function startupMaintenanceDependencies(bookId) {
|
|
27
|
+
return Object.assign({ readNotice: () => getUpdateNotice(readUpdateState()), startUpdateCheck: () => startAgentUpdateCheck(), pullContext: () => __awaiter(this, void 0, void 0, function* () { return (isLoggedIn() ? pullUserContext() : undefined); }), pullDomainContext: () => __awaiter(this, void 0, void 0, function* () { return (isLoggedIn() ? pullDomainContext() : undefined); }) }, (bookId ? { pullBookContext: () => __awaiter(this, void 0, void 0, function* () { return (isLoggedIn() ? pullBookContext(bookId) : undefined); }) } : {}));
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* Pulls the user's agent context in the background, never waited on: newer pushes apply at the next start or `/reload`.
|
|
31
|
+
* Only a clone with unpushed changes is worth telling about.
|
|
32
|
+
*/
|
|
33
|
+
function startContextPull(callbacks, pull, notice) {
|
|
34
|
+
if (!pull) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
void pull().then(outcome => {
|
|
39
|
+
if (outcome === 'unpushed') {
|
|
40
|
+
callbacks.notify(notice, 'info');
|
|
41
|
+
}
|
|
42
|
+
}, () => undefined);
|
|
43
|
+
}
|
|
44
|
+
catch (_a) {
|
|
45
|
+
// Silent failure — never break the TUI
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Starts the background pulls of the agent context (the user's, the company's, and the Book's with `--book`), reports the outcome of the last background update and starts
|
|
50
|
+
* the daily check. The install itself runs in the detached update worker. Never waits on the network.
|
|
27
51
|
*/
|
|
28
52
|
export function runStartupMaintenance(callbacks_1) {
|
|
29
|
-
return __awaiter(this, arguments, void 0, function* (callbacks, dependencies =
|
|
53
|
+
return __awaiter(this, arguments, void 0, function* (callbacks, dependencies = startupMaintenanceDependencies()) {
|
|
54
|
+
startContextPull(callbacks, dependencies.pullContext, UNPUSHED_CONTEXT_NOTICE);
|
|
55
|
+
startContextPull(callbacks, dependencies.pullDomainContext, UNPUSHED_DOMAIN_CONTEXT_NOTICE);
|
|
56
|
+
startContextPull(callbacks, dependencies.pullBookContext, UNPUSHED_BOOK_CONTEXT_NOTICE);
|
|
30
57
|
if (isUpdateCheckDisabled()) {
|
|
31
58
|
return;
|
|
32
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,GAGlB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,GAGlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAC,eAAe,EAAuB,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAC,iBAAiB,EAAyB,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAC,eAAe,EAAmB,MAAM,qCAAqC,CAAC;AAmBtF,MAAM,uBAAuB,GACzB,sGAAsG,CAAC;AAC3G,MAAM,8BAA8B,GAChC,gIAAgI,CAAC;AACrI,MAAM,4BAA4B,GAC9B,4HAA4H,CAAC;AAEjI;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAmC,EAAE;IACvE,OAAO,qBAAqB,iCAAK,OAAO,KAAE,UAAU,EAAE,uBAAuB,IAAE,CAAC;AACpF,CAAC;AAED,iGAAiG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,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;QAC/E,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;QAC5F,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,eAAe,EAAE,4BAA4B,CAAC,CAAC;QACxF,IAAI,qBAAqB,EAAE,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,MAAM,EAAE,CAAC;gBACT,SAAS,CAAC,MAAM,CACZ,kBAAkB,CAAC,MAAM,CAAC,EAC1B,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CACnD,CAAC;YACN,CAAC;YACD,YAAY,CAAC,gBAAgB,EAAE,CAAC;QACpC,CAAC;QAAC,WAAM,CAAC;YACL,uCAAuC;QAC3C,CAAC;IACL,CAAC;CAAA"}
|
package/lib/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import 'dotenv/config'; // Must be first to load env vars before other imports
|
|
|
12
12
|
import { program } from 'commander';
|
|
13
13
|
import { registerAuthCommands } from './commands/auth/register.js';
|
|
14
14
|
import { registerAppCommands } from './commands/apps/register.js';
|
|
15
|
+
import { registerContextCommands } from './commands/context/register.js';
|
|
15
16
|
import { registerBookCommands } from './commands/books/register.js';
|
|
16
17
|
import { registerAccountCommands } from './commands/accounts/register.js';
|
|
17
18
|
import { registerGroupCommands } from './commands/groups/register.js';
|
|
@@ -30,6 +31,7 @@ function registerAgentCommands(command) {
|
|
|
30
31
|
command
|
|
31
32
|
.command('agent [piArgs...]')
|
|
32
33
|
.description('Start Bkper Agent, or run Pi CLI commands as `bkper agent <command>` (e.g. `bkper agent mcp add`)')
|
|
34
|
+
.option('-b, --book <bookId>', "Load this Book's agent context beside yours")
|
|
33
35
|
.allowUnknownOption(true)
|
|
34
36
|
.allowExcessArguments(true);
|
|
35
37
|
}
|
|
@@ -71,6 +73,7 @@ function main() {
|
|
|
71
73
|
registerCollectionCommands(program);
|
|
72
74
|
registerFileCommands(program);
|
|
73
75
|
registerEventCommands(program);
|
|
76
|
+
registerContextCommands(program);
|
|
74
77
|
// Agent bridge command
|
|
75
78
|
registerAgentCommands(program);
|
|
76
79
|
// Upgrade command
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,+BAA+B,GAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OA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C,OAAO,CAAC,CAAC;QACtB,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAE1C,yEAAyE;QACzE,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE/B,gBAAgB;QAChB,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,oBAAoB;QACpB,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC9B,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACrC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACjC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACpC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC9B,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAEjC,uBAAuB;QACvB,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE/B,kBAAkB;QAClB,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEhC,IAAI,+BAA+B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO;QACX,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -15,6 +15,14 @@ export interface AgentCommandDependencies {
|
|
|
15
15
|
* supported by pi.
|
|
16
16
|
*/
|
|
17
17
|
export declare function parseEmbeddedSessionOptions(args: string[], cwd?: string): SessionOptions | undefined;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Bkper's own `-b, --book <bookId>` (Pi has no `-b`): the Book whose agent context loads beside the user's. Taken out
|
|
20
|
+
* before Pi parses the rest.
|
|
21
|
+
*/
|
|
22
|
+
export declare function takeBookOption(args: string[]): {
|
|
23
|
+
bookId?: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
};
|
|
26
|
+
export declare function runAgentCommand(allArgs: string[], dependencies?: AgentCommandDependencies): Promise<void>;
|
|
19
27
|
export declare function registerAgentCommands(program: Command): void;
|
|
20
28
|
//# sourceMappingURL=agent-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-command.d.ts","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGH,KAAK,cAAc,EACtB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-command.d.ts","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGH,KAAK,cAAc,EACtB,MAAM,wCAAwC,CAAC;AAKhD,MAAM,WAAW,uBAAuB;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,kBAAkB,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACzC;AAqGD;;;GAGG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,GAAE,MAAsB,GAC5B,cAAc,GAAG,SAAS,CAyB5B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBlF;AAED,wBAAsB,eAAe,CACjC,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,GAAE,wBAAsD,GACrE,OAAO,CAAC,IAAI,CAAC,CAkCf;AASD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAS5D"}
|
|
@@ -11,7 +11,9 @@ import path from 'node:path';
|
|
|
11
11
|
import { main as runPiMain, parseArgs, } from '@earendil-works/pi-coding-agent';
|
|
12
12
|
import { registerBkperAiProvider } from '../agent/extensions/bkper-ai-provider.js';
|
|
13
13
|
import { createAgentModeDependencies, runAgentMode, } from '../agent/interactive/run-agent-mode.js';
|
|
14
|
+
import { AgentStartupError } from '../agent/startup-error.js';
|
|
14
15
|
import { getBkperAgentSystemPrompt } from '../agent/system-prompt.js';
|
|
16
|
+
import { BOOK_ID } from './context/platform-context.js';
|
|
15
17
|
// Unit tests and custom dependency injection historically omitted terminal state.
|
|
16
18
|
// Production dependencies always provide the real process TTY state below.
|
|
17
19
|
const ASSUMED_INTERACTIVE_ENVIRONMENT = {
|
|
@@ -124,15 +126,46 @@ export function parseEmbeddedSessionOptions(args, cwd = process.cwd()) {
|
|
|
124
126
|
};
|
|
125
127
|
return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
|
|
126
128
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Bkper's own `-b, --book <bookId>` (Pi has no `-b`): the Book whose agent context loads beside the user's. Taken out
|
|
131
|
+
* before Pi parses the rest.
|
|
132
|
+
*/
|
|
133
|
+
export function takeBookOption(args) {
|
|
134
|
+
const rest = [];
|
|
135
|
+
let bookId;
|
|
136
|
+
for (let index = 0; index < args.length; index++) {
|
|
137
|
+
const arg = args[index];
|
|
138
|
+
let value;
|
|
139
|
+
if (arg === '-b' || arg === '--book') {
|
|
140
|
+
value = args[++index];
|
|
141
|
+
if (value === undefined)
|
|
142
|
+
throw new AgentStartupError(`${arg} requires a Book ID`);
|
|
143
|
+
}
|
|
144
|
+
else if (arg.startsWith('--book=')) {
|
|
145
|
+
value = arg.slice('--book='.length);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
rest.push(arg);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (!BOOK_ID.test(value))
|
|
152
|
+
throw new AgentStartupError(`'${value}' is not a Book ID`);
|
|
153
|
+
bookId = value;
|
|
154
|
+
}
|
|
155
|
+
return Object.assign(Object.assign({}, (bookId ? { bookId } : {})), { args: rest });
|
|
156
|
+
}
|
|
157
|
+
export function runAgentCommand(allArgs_1) {
|
|
158
|
+
return __awaiter(this, arguments, void 0, function* (allArgs, dependencies = createDefaultDependencies()) {
|
|
129
159
|
const canRunEmbeddedInteractive = canRunEmbeddedInteractiveMode(dependencies);
|
|
160
|
+
const { bookId, args: piArgs } = isPiManagementCommand(allArgs) ? { args: allArgs } : takeBookOption(allArgs);
|
|
161
|
+
const embedded = (options) => bookId ? Object.assign({ bookId }, options) : options;
|
|
130
162
|
if (piArgs.length === 0) {
|
|
131
163
|
if (!canRunEmbeddedInteractive) {
|
|
164
|
+
refuseBookOutsideAgent(bookId);
|
|
132
165
|
yield dependencies.runPi(buildPiArgs(piArgs), PI_SESSION_OPTIONS);
|
|
133
166
|
return;
|
|
134
167
|
}
|
|
135
|
-
yield dependencies.runInteractiveMode();
|
|
168
|
+
yield dependencies.runInteractiveMode(embedded(undefined));
|
|
136
169
|
return;
|
|
137
170
|
}
|
|
138
171
|
if (isPiManagementCommand(piArgs)) {
|
|
@@ -143,17 +176,25 @@ export function runAgentCommand(piArgs_1) {
|
|
|
143
176
|
if (!options || !canRunEmbeddedInteractive) {
|
|
144
177
|
// Args only pi supports (e.g. --fork, --print, --mode) or non-interactive
|
|
145
178
|
// terminals are forwarded to pi for normal passthrough behavior.
|
|
179
|
+
refuseBookOutsideAgent(bookId);
|
|
146
180
|
const args = buildPiArgs(piArgs);
|
|
147
181
|
yield dependencies.runPi(args, PI_SESSION_OPTIONS);
|
|
148
182
|
return;
|
|
149
183
|
}
|
|
150
|
-
yield dependencies.runInteractiveMode(options);
|
|
184
|
+
yield dependencies.runInteractiveMode(embedded(options));
|
|
151
185
|
});
|
|
152
186
|
}
|
|
187
|
+
/** A Book's context loads only in Bkper Agent's interactive mode; never silently dropped. */
|
|
188
|
+
function refuseBookOutsideAgent(bookId) {
|
|
189
|
+
if (bookId) {
|
|
190
|
+
throw new AgentStartupError('--book works only in the interactive agent, without options only pi supports');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
153
193
|
export function registerAgentCommands(program) {
|
|
154
194
|
program
|
|
155
195
|
.command('agent [piArgs...]')
|
|
156
196
|
.description('Start Bkper Agent, or run Pi CLI commands as `bkper agent <command>` (e.g. `bkper agent mcp add`)')
|
|
197
|
+
.option('-b, --book <bookId>', "Load this Book's agent context beside yours")
|
|
157
198
|
.allowUnknownOption(true)
|
|
158
199
|
.allowExcessArguments(true);
|
|
159
200
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-command.js","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACH,IAAI,IAAI,SAAS,EACjB,SAAS,GAGZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,MAAM,wCAAwC,C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H,wBAAsB,GAAG,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/dev.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmSjE"}
|