takomi 2.1.36 → 2.1.38
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/.pi/README.md +6 -3
- package/.pi/agents/orchestrator.md +9 -5
- package/.pi/extensions/oauth-router/commands.ts +36 -35
- package/.pi/extensions/oauth-router/index.ts +8 -8
- package/.pi/extensions/takomi-context-manager/diagnostics-tools.ts +40 -7
- package/.pi/extensions/takomi-context-manager/diagnostics.ts +534 -55
- package/.pi/extensions/takomi-context-manager/index.ts +14 -2
- package/.pi/extensions/takomi-context-manager/model-policy-gate.ts +16 -4
- package/.pi/extensions/takomi-context-manager/policy-tools.ts +7 -0
- package/.pi/extensions/takomi-context-manager/prerequisite-gates.ts +2 -0
- package/.pi/extensions/takomi-context-manager/session-state.ts +160 -0
- package/.pi/extensions/takomi-context-manager/skill-registry.ts +120 -0
- package/.pi/extensions/takomi-context-manager/skill-tools.ts +26 -3
- package/.pi/extensions/takomi-context-manager/state.ts +11 -1
- package/.pi/extensions/takomi-context-manager/types.ts +9 -1
- package/.pi/extensions/takomi-runtime/command-text.ts +2 -1
- package/.pi/extensions/takomi-runtime/commands.ts +13 -1
- package/.pi/extensions/takomi-subagents/index.ts +30 -3
- package/.pi/extensions/takomi-subagents/native-render.ts +3 -1
- package/.pi/extensions/takomi-subagents/pi-subagents-engine.ts +18 -3
- package/.pi/extensions/takomi-subagents/tool-runner.ts +38 -3
- package/.pi/prompts/takomi-prompt.md +6 -4
- package/.pi/takomi/policies/subagent-routing.md +9 -1
- package/.pi/takomi/policies/takomi-lifecycle-routing.md +3 -1
- package/README.md +22 -11
- package/assets/.agent/skills/exam-creator-skill/SKILL.md +182 -0
- package/assets/.agent/skills/exam-creator-skill/references/model-routing-policy.md +48 -0
- package/assets/.agent/skills/exam-creator-skill/references/workflow-rulebook.md +115 -0
- package/package.json +2 -2
- package/src/cli.js +38 -1
- package/src/doctor.js +7 -1
- package/src/pi-harness.js +96 -0
package/src/doctor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import pc from 'picocolors';
|
|
4
|
-
import { inspectPiHarnessEnvironment } from './pi-harness.js';
|
|
4
|
+
import { formatRawPiSubagentsFindings, inspectPiHarnessEnvironment } from './pi-harness.js';
|
|
5
5
|
import { getStoreSkills, isStoreInitialized } from './store.js';
|
|
6
6
|
import { PI_MANIFEST_PATH } from './pi-installer.js';
|
|
7
7
|
import { SKILLS_MANIFEST_PATH, SKILLS_ROOT } from './skills-installer.js';
|
|
@@ -41,6 +41,7 @@ export async function runDoctor({ version, cwd = process.cwd() } = {}) {
|
|
|
41
41
|
? `${report.piSubagents.globalPackageJson}${report.piSubagents.globalVersion ? ` (${report.piSubagents.globalVersion})` : ''}`
|
|
42
42
|
: 'missing'));
|
|
43
43
|
console.log(status(report.piSubagents.binaryInstalled, 'pi-subagents installer binary', report.piSubagents.binaryPath || 'missing'));
|
|
44
|
+
console.log(status(report.rawPiSubagentsActivation.findings.length === 0, 'Raw Pi subagent tool hidden', report.rawPiSubagentsActivation.findings.length ? 'raw subagent activation detected' : 'yes'));
|
|
44
45
|
console.log(status(report.installed.routingPolicyPresent || report.project.routingPolicyPresent, 'Routing policy', report.project.routingPolicyPresent ? report.project.targets.routingPolicy : report.installed.targets.routingPolicy));
|
|
45
46
|
console.log(status(await fs.pathExists(SKILLS_ROOT), 'Installed skills root', SKILLS_ROOT));
|
|
46
47
|
console.log(status(await fs.pathExists(SKILLS_MANIFEST_PATH), 'Skills install manifest', SKILLS_MANIFEST_PATH));
|
|
@@ -68,6 +69,11 @@ export async function runDoctor({ version, cwd = process.cwd() } = {}) {
|
|
|
68
69
|
console.log(pc.white(' - Install pi-subagents: npm install -g pi-subagents'));
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
if (report.rawPiSubagentsActivation.findings.length) {
|
|
73
|
+
console.log(pc.white(' - Disable raw Pi subagents so models only see takomi_subagent. Run takomi setup pi or set TAKOMI_DISABLE_RAW_PI_SUBAGENTS=1 takomi refresh pi.'));
|
|
74
|
+
console.log(pc.dim(formatRawPiSubagentsFindings(report.rawPiSubagentsActivation.findings).split(/\r?\n/).map((line) => ` ${line}`).join('\n')));
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
if (!report.project.routingPolicyPresent && !report.installed.routingPolicyPresent) {
|
|
72
78
|
console.log(pc.white(' - Add a routing policy at .pi/takomi/model-routing.md when ready.'));
|
|
73
79
|
}
|
package/src/pi-harness.js
CHANGED
|
@@ -119,6 +119,100 @@ function getGlobalNodeModulesRoot(home = HOME) {
|
|
|
119
119
|
return path.join(home, '.npm-global', 'lib', 'node_modules');
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
async function readJsonIfExists(filePath) {
|
|
123
|
+
try {
|
|
124
|
+
if (await fs.pathExists(filePath)) return await fs.readJson(filePath);
|
|
125
|
+
} catch {}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function writeJsonWithBackup(filePath, value, backupLabel = 'takomi-backup') {
|
|
130
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
131
|
+
if (await fs.pathExists(filePath)) {
|
|
132
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
133
|
+
await fs.copy(filePath, `${filePath}.${backupLabel}-${stamp}`);
|
|
134
|
+
}
|
|
135
|
+
await fs.writeJson(filePath, value, { spaces: 2 });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function removeRawPiSubagentsPackageEntries(settings) {
|
|
139
|
+
if (!settings || typeof settings !== 'object' || Array.isArray(settings)) return { changed: false, settings };
|
|
140
|
+
if (!Array.isArray(settings.packages)) return { changed: false, settings };
|
|
141
|
+
const before = settings.packages.length;
|
|
142
|
+
const nextPackages = settings.packages.filter((entry) => entry !== 'npm:pi-subagents' && entry !== 'pi-subagents');
|
|
143
|
+
if (nextPackages.length === before) return { changed: false, settings };
|
|
144
|
+
return { changed: true, settings: { ...settings, packages: nextPackages } };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export async function inspectRawPiSubagentsActivation({ cwd = process.cwd(), home = HOME } = {}) {
|
|
148
|
+
const user = getPiGlobalTargets(home);
|
|
149
|
+
const project = getProjectPiTargets(cwd);
|
|
150
|
+
const legacyExtension = path.join(user.extensions, 'subagent');
|
|
151
|
+
const findings = [];
|
|
152
|
+
|
|
153
|
+
for (const [scope, filePath] of [['user', user.settings], ['project', project.settings]]) {
|
|
154
|
+
const settings = await readJsonIfExists(filePath);
|
|
155
|
+
const packages = Array.isArray(settings?.packages) ? settings.packages : [];
|
|
156
|
+
if (packages.includes('npm:pi-subagents') || packages.includes('pi-subagents')) {
|
|
157
|
+
findings.push({ type: 'settings-package', scope, path: filePath });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (await fs.pathExists(path.join(legacyExtension, 'index.ts')) || await fs.pathExists(path.join(legacyExtension, 'index.js'))) {
|
|
162
|
+
findings.push({ type: 'legacy-extension', scope: 'user', path: legacyExtension });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return { findings };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export async function disableRawPiSubagentsActivation({ cwd = process.cwd(), home = HOME } = {}) {
|
|
169
|
+
const user = getPiGlobalTargets(home);
|
|
170
|
+
const project = getProjectPiTargets(cwd);
|
|
171
|
+
const actions = [];
|
|
172
|
+
|
|
173
|
+
for (const [scope, filePath] of [['user', user.settings], ['project', project.settings]]) {
|
|
174
|
+
const settings = await readJsonIfExists(filePath);
|
|
175
|
+
const result = removeRawPiSubagentsPackageEntries(settings);
|
|
176
|
+
if (result.changed) {
|
|
177
|
+
await writeJsonWithBackup(filePath, result.settings, 'takomi-disable-raw-pi-subagents');
|
|
178
|
+
actions.push({ type: 'settings-package-removed', scope, path: filePath });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const legacyExtension = path.join(user.extensions, 'subagent');
|
|
183
|
+
if (await fs.pathExists(path.join(legacyExtension, 'index.ts')) || await fs.pathExists(path.join(legacyExtension, 'index.js'))) {
|
|
184
|
+
const disabledRoot = path.join(user.root, 'disabled-extensions');
|
|
185
|
+
await fs.ensureDir(disabledRoot);
|
|
186
|
+
let dest = path.join(disabledRoot, 'subagent');
|
|
187
|
+
if (await fs.pathExists(dest)) {
|
|
188
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
189
|
+
dest = path.join(disabledRoot, `subagent-${stamp}`);
|
|
190
|
+
}
|
|
191
|
+
await fs.move(legacyExtension, dest, { overwrite: false });
|
|
192
|
+
actions.push({ type: 'legacy-extension-moved', scope: 'user', path: legacyExtension, disabledPath: dest });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return { actions };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function formatRawPiSubagentsFindings(findings = []) {
|
|
199
|
+
if (!findings.length) return 'No raw pi-subagents activation found.';
|
|
200
|
+
return findings.map((finding) => {
|
|
201
|
+
if (finding.type === 'settings-package') return `- ${finding.scope} settings package entry: ${finding.path}`;
|
|
202
|
+
if (finding.type === 'legacy-extension') return `- legacy raw subagent extension: ${finding.path}`;
|
|
203
|
+
return `- ${finding.path || JSON.stringify(finding)}`;
|
|
204
|
+
}).join('\n');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function formatRawPiSubagentsDisableActions(actions = []) {
|
|
208
|
+
if (!actions.length) return 'No raw pi-subagents activation changes were needed.';
|
|
209
|
+
return actions.map((action) => {
|
|
210
|
+
if (action.type === 'settings-package-removed') return `- removed raw pi-subagents package from ${action.scope} settings: ${action.path}`;
|
|
211
|
+
if (action.type === 'legacy-extension-moved') return `- moved raw subagent extension out of Pi extensions: ${action.path} -> ${action.disabledPath}`;
|
|
212
|
+
return `- ${action.path || JSON.stringify(action)}`;
|
|
213
|
+
}).join('\n');
|
|
214
|
+
}
|
|
215
|
+
|
|
122
216
|
export async function inspectPiSubagentsDependency(home = HOME) {
|
|
123
217
|
const pkg = await getPackageJson();
|
|
124
218
|
const declaredVersion = pkg?.dependencies?.['pi-subagents'] || null;
|
|
@@ -447,6 +541,7 @@ export async function inspectPiHarnessEnvironment(cwd = process.cwd()) {
|
|
|
447
541
|
const bundled = await inspectBundledPiAssets();
|
|
448
542
|
const installed = await inspectInstalledTakomiPiHarness();
|
|
449
543
|
const piSubagents = await inspectPiSubagentsDependency();
|
|
544
|
+
const rawPiSubagentsActivation = await inspectRawPiSubagentsActivation({ cwd });
|
|
450
545
|
const project = getProjectPiTargets(cwd);
|
|
451
546
|
|
|
452
547
|
return {
|
|
@@ -454,6 +549,7 @@ export async function inspectPiHarnessEnvironment(cwd = process.cwd()) {
|
|
|
454
549
|
bundled,
|
|
455
550
|
installed,
|
|
456
551
|
piSubagents,
|
|
552
|
+
rawPiSubagentsActivation,
|
|
457
553
|
project: {
|
|
458
554
|
targets: project,
|
|
459
555
|
settingsPresent: await fs.pathExists(project.settings),
|