merge: integrate upstream main with local Makelore changes
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import YAML from 'yaml';
|
||||
import { CodingCapabilityRegistryImpl } from '@electron/coding-plugins/registry';
|
||||
import type { PiProviderSelection } from '@electron/coding-runtime/pi/provider-config';
|
||||
import {
|
||||
buildPiManagedInputArgs,
|
||||
getPiManagedPaths,
|
||||
MAKELORE_DEFAULT_LANGUAGE_PROMPT,
|
||||
materializePiAgentResources,
|
||||
resolveBundledCodingSkillsDir,
|
||||
resolveExplicitCodingSkillPaths,
|
||||
@@ -84,6 +85,9 @@ describe('Pi managed resource loader', () => {
|
||||
});
|
||||
|
||||
expect(await readFile(resources.promptPath, 'utf8')).toBe(prompt);
|
||||
expect(await readFile(resources.languagePromptPath, 'utf8')).toBe(MAKELORE_DEFAULT_LANGUAGE_PROMPT);
|
||||
expect(MAKELORE_DEFAULT_LANGUAGE_PROMPT).toContain('默认使用简体中文');
|
||||
expect(MAKELORE_DEFAULT_LANGUAGE_PROMPT).toContain('可见的思考过程');
|
||||
expect(resources.skillIds).toEqual(['grilling']);
|
||||
expect(resources.skillEntries).toEqual([
|
||||
{ id: 'grilling', entryPath: 'grilling/SKILL.md' },
|
||||
@@ -97,6 +101,7 @@ describe('Pi managed resource loader', () => {
|
||||
projectId: 'project-1',
|
||||
agentId: 'agent-1',
|
||||
promptFile: 'agent-1.md',
|
||||
languagePromptFile: 'agent-1.language.md',
|
||||
skillIds: ['grilling'],
|
||||
skillEntries: [{ id: 'grilling', entryPath: 'grilling/SKILL.md' }],
|
||||
catalogRevision: 11,
|
||||
@@ -138,9 +143,11 @@ describe('Pi managed resource loader', () => {
|
||||
'--model', 'model-a',
|
||||
'--thinking', 'medium',
|
||||
'--system-prompt', resources.promptPath,
|
||||
'--append-system-prompt', resources.languagePromptPath,
|
||||
'--skill', path.join(fixture.skillsDir, 'agent-browser', 'SKILL.md'),
|
||||
]);
|
||||
expect(serialized).not.toContain(prompt);
|
||||
expect(serialized).not.toContain(MAKELORE_DEFAULT_LANGUAGE_PROMPT);
|
||||
expect(serialized).not.toContain('private-account-id');
|
||||
expect(serialized).not.toContain(path.join(fixture.projectDir, '.pi'));
|
||||
expect(serialized).not.toContain(path.join(fixture.projectDir, '.agents'));
|
||||
@@ -266,6 +273,24 @@ describe('Pi managed resource loader', () => {
|
||||
const restored = await resolve();
|
||||
expect(restored.effectiveSkillIds).toEqual(assignedSkillIds);
|
||||
expect(restored.tools).toHaveLength(10);
|
||||
|
||||
});
|
||||
|
||||
it('keeps the platform Chinese-language prompt when the Agent prompt is empty', async () => {
|
||||
const fixture = await fixtureRoot();
|
||||
const resources = await materializePiAgentResources({
|
||||
userDataDir: fixture.userDataDir,
|
||||
projectId: 'project-1',
|
||||
agentId: 'agent-1',
|
||||
prompt: '',
|
||||
skillEntries: [],
|
||||
catalogRevision: 0,
|
||||
bundledSkillsDir: fixture.skillsDir,
|
||||
revision: { provider: 1, resources: 1 },
|
||||
});
|
||||
|
||||
expect(await readFile(resources.promptPath, 'utf8')).toBe('');
|
||||
expect(await readFile(resources.languagePromptPath, 'utf8')).toBe(MAKELORE_DEFAULT_LANGUAGE_PROMPT);
|
||||
});
|
||||
|
||||
it('rejects unknown skills and unsafe managed path segments', async () => {
|
||||
|
||||
Reference in New Issue
Block a user