@celljs/ta-protocol 4.13.0 → 4.13.1
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.
|
@@ -106,6 +106,14 @@ export declare namespace TaHostUtil {
|
|
|
106
106
|
function reach(events: {
|
|
107
107
|
emit(event: string, data: unknown): void;
|
|
108
108
|
}, name: string, waitMs?: number): Promise<TaHostAnswer | undefined>;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt) has `mark`. pi puts the
|
|
111
|
+
* role in the `<addendum>` section of the system prompt; the mark is looked for there only, never in the whole
|
|
112
|
+
* prompt, which holds the user's AGENTS.md and other context files too, and they may well name the mark.
|
|
113
|
+
*/
|
|
114
|
+
function marked(systemPrompt: string | undefined, mark: string): boolean;
|
|
115
|
+
/** The role a session was opened with, out of its system prompt: the `<addendum>` section, before the project's context. */
|
|
116
|
+
function role(systemPrompt: string | undefined): string;
|
|
109
117
|
}
|
|
110
118
|
/**
|
|
111
119
|
* The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
|
|
@@ -42,6 +42,30 @@ export var TaHostUtil;
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
TaHostUtil.reach = reach;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt) has `mark`. pi puts the
|
|
47
|
+
* role in the `<addendum>` section of the system prompt; the mark is looked for there only, never in the whole
|
|
48
|
+
* prompt, which holds the user's AGENTS.md and other context files too, and they may well name the mark.
|
|
49
|
+
*/
|
|
50
|
+
function marked(systemPrompt, mark) {
|
|
51
|
+
return role(systemPrompt).includes(mark);
|
|
52
|
+
}
|
|
53
|
+
TaHostUtil.marked = marked;
|
|
54
|
+
/** The role a session was opened with, out of its system prompt: the `<addendum>` section, before the project's context. */
|
|
55
|
+
function role(systemPrompt) {
|
|
56
|
+
if (!systemPrompt) {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
const open = '<addendum>\n';
|
|
60
|
+
const start = systemPrompt.indexOf(open);
|
|
61
|
+
const context = systemPrompt.indexOf('<project_context>\n');
|
|
62
|
+
if (start < 0 || (context >= 0 && context < start)) {
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
const end = systemPrompt.indexOf('\n</addendum>', start);
|
|
66
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
67
|
+
}
|
|
68
|
+
TaHostUtil.role = role;
|
|
45
69
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
46
70
|
/**
|
|
47
71
|
* The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
|
|
@@ -106,6 +106,14 @@ export declare namespace TaHostUtil {
|
|
|
106
106
|
function reach(events: {
|
|
107
107
|
emit(event: string, data: unknown): void;
|
|
108
108
|
}, name: string, waitMs?: number): Promise<TaHostAnswer | undefined>;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt) has `mark`. pi puts the
|
|
111
|
+
* role in the `<addendum>` section of the system prompt; the mark is looked for there only, never in the whole
|
|
112
|
+
* prompt, which holds the user's AGENTS.md and other context files too, and they may well name the mark.
|
|
113
|
+
*/
|
|
114
|
+
function marked(systemPrompt: string | undefined, mark: string): boolean;
|
|
115
|
+
/** The role a session was opened with, out of its system prompt: the `<addendum>` section, before the project's context. */
|
|
116
|
+
function role(systemPrompt: string | undefined): string;
|
|
109
117
|
}
|
|
110
118
|
/**
|
|
111
119
|
* The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
|
|
@@ -45,6 +45,30 @@ var TaHostUtil;
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
TaHostUtil.reach = reach;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt) has `mark`. pi puts the
|
|
50
|
+
* role in the `<addendum>` section of the system prompt; the mark is looked for there only, never in the whole
|
|
51
|
+
* prompt, which holds the user's AGENTS.md and other context files too, and they may well name the mark.
|
|
52
|
+
*/
|
|
53
|
+
function marked(systemPrompt, mark) {
|
|
54
|
+
return role(systemPrompt).includes(mark);
|
|
55
|
+
}
|
|
56
|
+
TaHostUtil.marked = marked;
|
|
57
|
+
/** The role a session was opened with, out of its system prompt: the `<addendum>` section, before the project's context. */
|
|
58
|
+
function role(systemPrompt) {
|
|
59
|
+
if (!systemPrompt) {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
const open = '<addendum>\n';
|
|
63
|
+
const start = systemPrompt.indexOf(open);
|
|
64
|
+
const context = systemPrompt.indexOf('<project_context>\n');
|
|
65
|
+
if (start < 0 || (context >= 0 && context < start)) {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
const end = systemPrompt.indexOf('\n</addendum>', start);
|
|
69
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
70
|
+
}
|
|
71
|
+
TaHostUtil.role = role;
|
|
48
72
|
})(TaHostUtil || (exports.TaHostUtil = TaHostUtil = {}));
|
|
49
73
|
/**
|
|
50
74
|
* The event of pi's `pi.events` by which an extension whose tools change files without pi's `edit` and
|