@celljs/ta-channels 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.
- package/extension/index.mjs +23 -2
- package/host/index.mjs +21 -0
- package/package.json +4 -4
package/extension/index.mjs
CHANGED
|
@@ -27,6 +27,27 @@ var TaHostUtil;
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
TaHostUtil2.reach = reach;
|
|
30
|
+
function marked(systemPrompt, mark) {
|
|
31
|
+
return role(systemPrompt).includes(mark);
|
|
32
|
+
}
|
|
33
|
+
TaHostUtil2.marked = marked;
|
|
34
|
+
function role(systemPrompt) {
|
|
35
|
+
if (!systemPrompt) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
const open = `<addendum>
|
|
39
|
+
`;
|
|
40
|
+
const start = systemPrompt.indexOf(open);
|
|
41
|
+
const context = systemPrompt.indexOf(`<project_context>
|
|
42
|
+
`);
|
|
43
|
+
if (start < 0 || context >= 0 && context < start) {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
const end = systemPrompt.indexOf(`
|
|
47
|
+
</addendum>`, start);
|
|
48
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
49
|
+
}
|
|
50
|
+
TaHostUtil2.role = role;
|
|
30
51
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
31
52
|
var TA_ASK_ENTRY = "ta-ask";
|
|
32
53
|
var TaAskUtil;
|
|
@@ -984,7 +1005,7 @@ var ASK_FIRST_MARK = "Ask the user before you hand out work";
|
|
|
984
1005
|
function activate(pi) {
|
|
985
1006
|
let reached;
|
|
986
1007
|
const reach = () => reached ??= TaHostUtil.reach(pi.events, NAME).then((answer) => ({ answered: !!answer, team: answer?.service }));
|
|
987
|
-
const isAgent = (ctx) => ctx.getSystemPrompt()
|
|
1008
|
+
const isAgent = (ctx) => TaHostUtil.marked(ctx.getSystemPrompt(), AGENT_MARK);
|
|
988
1009
|
const allowed = new Set;
|
|
989
1010
|
pi.on("session_start", () => {
|
|
990
1011
|
reach();
|
|
@@ -1027,7 +1048,7 @@ function activate(pi) {
|
|
|
1027
1048
|
throw new Error(answered ? NO_TEAM : NO_SERVER);
|
|
1028
1049
|
}
|
|
1029
1050
|
const input = params ?? {};
|
|
1030
|
-
if (ctx.getSystemPrompt()
|
|
1051
|
+
if (TaHostUtil.marked(ctx.getSystemPrompt(), ASK_FIRST_MARK)) {
|
|
1031
1052
|
const question = TeamAsk.question(tool.name, input, team2.state, allowed);
|
|
1032
1053
|
if (question && !await ask(ctx, question)) {
|
|
1033
1054
|
return { content: [{ type: "text", text: TeamAsk.REFUSED }], details: undefined };
|
package/host/index.mjs
CHANGED
|
@@ -252,6 +252,27 @@ var TaHostUtil;
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
TaHostUtil2.reach = reach;
|
|
255
|
+
function marked(systemPrompt, mark) {
|
|
256
|
+
return role(systemPrompt).includes(mark);
|
|
257
|
+
}
|
|
258
|
+
TaHostUtil2.marked = marked;
|
|
259
|
+
function role(systemPrompt) {
|
|
260
|
+
if (!systemPrompt) {
|
|
261
|
+
return "";
|
|
262
|
+
}
|
|
263
|
+
const open = `<addendum>
|
|
264
|
+
`;
|
|
265
|
+
const start = systemPrompt.indexOf(open);
|
|
266
|
+
const context = systemPrompt.indexOf(`<project_context>
|
|
267
|
+
`);
|
|
268
|
+
if (start < 0 || context >= 0 && context < start) {
|
|
269
|
+
return "";
|
|
270
|
+
}
|
|
271
|
+
const end = systemPrompt.indexOf(`
|
|
272
|
+
</addendum>`, start);
|
|
273
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
274
|
+
}
|
|
275
|
+
TaHostUtil2.role = role;
|
|
255
276
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
256
277
|
var TA_ASK_ENTRY = "ta-ask";
|
|
257
278
|
var TaAskUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-channels",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.1",
|
|
4
4
|
"description": "A pi package for Ta: agents with roles of their own and channels where the user, Ta and the agents talk; Ta builds the team for what the user wants",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@celljs/ta-protocol": "4.13.
|
|
31
|
-
"@celljs/ta-relay": "4.13.
|
|
32
|
-
"@celljs/ta-web": "4.13.
|
|
30
|
+
"@celljs/ta-protocol": "4.13.1",
|
|
31
|
+
"@celljs/ta-relay": "4.13.1",
|
|
32
|
+
"@celljs/ta-web": "4.13.1",
|
|
33
33
|
"@types/react": "^19.3.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|