Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/de/get-started/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Einen Projektagenten erstellen und testen
description: Einem Projektagenten einen klaren Auftrag geben, ihn starten und das Ergebnis prüfen.
---

Ein Projektagent ist ein wiederverwendbarer Arbeitsauftrag für Projektaufgaben. Du legst Anweisungen, Laufzeit, Modell und Werkzeuge fest, startest ihn an einer Aufgabe und prüfst das Ergebnis.
Ein Projektagent ist ein wiederverwendbarer Arbeitsauftrag für Projektaufgaben. Du legst Anweisungen, Laufzeit, Modell und Werkzeuge fest, startest ihn an einer Aufgabe und prüfst das Ergebnis. Solange ein Projekt keinen eigenen Agenten hat, können seine Aufgaben an den [Standard-Agenten](/de/platform/projects/project-agents#standard-agent) der Organisation gehen.

## Was du brauchst

Expand Down
2 changes: 1 addition & 1 deletion docs/de/get-started/members.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Wähle im Bereich **Start** unter **Projekte** ein Projekt, auf das du zugreifen

</Frame>

Öffne eine Aufgabe und lies Beschreibung, Zuweisung und Diskussion. In jedem Projekt, das du öffnen kannst, erstellst du Aufgaben und änderst die, die du erstellt hast oder die dir zugewiesen sind, etwa um die Arbeit einem Agenten des Projekts zu übergeben. [Projektaufgaben verwalten](/de/platform/projects/tasks) erklärt die tägliche Aufgabenarbeit; [Projekte nutzen](/de/tutorials/member/use-projects) führt durch ein vollständiges Beispiel.
Öffne eine Aufgabe und lies Beschreibung, Zuweisung und Diskussion. In jedem Projekt, das du öffnen kannst, erstellst du Aufgaben und änderst die, die du erstellt hast oder die dir zugewiesen sind, etwa um die Arbeit einem Agenten des Projekts zu übergeben oder, in einem Projekt ohne eigene Agenten, dem [Standard-Agenten](/de/platform/projects/project-agents#standard-agent) der Organisation. [Projektaufgaben verwalten](/de/platform/projects/tasks) erklärt die tägliche Aufgabenarbeit; [Projekte nutzen](/de/tutorials/member/use-projects) führt durch ein vollständiges Beispiel.

## Zur Arbeit zurückkehren

Expand Down
2 changes: 1 addition & 1 deletion docs/de/platform/projects/project-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Auch ein Projekt ohne eigene Agenten kann Arbeit an einen Agenten übergeben. So

</Frame>

Der Tab **Agenten** führt ihn mit dem Abzeichen **Standard**. Niemand bearbeitet ihn: Agent-Laufzeit, Modell und Anweisungen folgen den Einstellungen der Organisation, die Tale bei jedem Start eines Laufs neu liest, und seine Ausstattung sind die Dokument-Skills `docx`, `pptx`, `xlsx` und `pdf` des Projekts. Auf **Automatisch** nutzt jeder Lauf ein Modell, das die Person, die ihn startet, nutzen darf. Er kann also für verschiedene Personen mit verschiedenen Modellen laufen.
Der Tab **Agenten** führt ihn mit dem Abzeichen **Standard**. Niemand bearbeitet ihn: Agent-Laufzeit, Modell und Anweisungen folgen den Einstellungen der Organisation, die Tale bei jedem Start eines Laufs neu liest, und seine Ausstattung sind die Dokument-Skills `docx`, `pptx`, `xlsx` und `pdf`, die das Projekt beim Start eines Laufs nutzen kann. Schaltet ein Admin einen davon ab, fällt er weg, statt den Agenten aufzuhalten. Auf **Automatisch** nutzt jeder Lauf ein Modell, das die Person, die ihn startet, nutzen darf. Er kann also für verschiedene Personen mit verschiedenen Modellen laufen.

Um dem Projekt einen eigenen Agenten zu geben, wähle **Neuer Agent**. Ab dann bietet das Projekt den Standard-Agenten nicht mehr an; der bereits eingerichtete bleibt zuweisbar, bis du ihn löschst. Beim Löschen bleibt der Verlauf seiner Aufgaben erhalten, und solange das Projekt keine Agenten hat, richtet die nächste Aufgabe für den Standard-Agenten ihn wieder ein.

Expand Down
2 changes: 1 addition & 1 deletion docs/en/get-started/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Create and test a project agent
description: Give a project agent a focused job, start it on a task, and review the result.
---

A project agent is a reusable brief for work on project tasks. You choose its instructions, runtime, model, and tools, then start it on a task and review what it produces.
A project agent is a reusable brief for work on project tasks. You choose its instructions, runtime, model, and tools, then start it on a task and review what it produces. Until a project has an agent of its own, its tasks can go to the organization's [standard agent](/platform/projects/project-agents#standard-agent).

## Before you begin

Expand Down
2 changes: 1 addition & 1 deletion docs/en/get-started/members.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In Home, choose a project you can access under **Projects**. Use **Tasks** to se

</Frame>

Open a task to read its description, assignee, and discussion. You can create tasks in any project you can open and change the ones you created or that are assigned to you, for example to hand the work to one of the project's agents. Follow [manage project tasks](/platform/projects/tasks) for ordinary task work and [use projects](/tutorials/member/use-projects) for a complete example.
Open a task to read its description, assignee, and discussion. You can create tasks in any project you can open and change the ones you created or that are assigned to you, for example to hand the work to one of the project's agents, or, in a project without agents of its own, to the organization's [standard agent](/platform/projects/project-agents#standard-agent). Follow [manage project tasks](/platform/projects/tasks) for ordinary task work and [use projects](/tutorials/member/use-projects) for a complete example.

## Return to your work

Expand Down
2 changes: 1 addition & 1 deletion docs/en/platform/projects/project-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ A project without agents of its own can still take on agent work. Unless an admi

</Frame>

The **Agents** tab lists it with the **Standard** badge. Nobody edits it: its agent type, model and instructions follow the organization's settings, read again whenever a run starts, and its equipment is the project's document skills `docx`, `pptx`, `xlsx` and `pdf`. On **Automatic**, each run uses a model that the person who starts it may use, so it can run on different models for different people.
The **Agents** tab lists it with the **Standard** badge. Nobody edits it: its agent type, model and instructions follow the organization's settings, read again whenever a run starts, and its equipment is whichever of the document skills `docx`, `pptx`, `xlsx` and `pdf` the project can use when a run starts, so a skill an admin turns off drops out instead of stopping the agent. On **Automatic**, each run uses a model that the person who starts it may use, so it can run on different models for different people.

To give the project an agent of its own, select **New agent**. From then on, the project isn't offered the standard agent any more; the one already set up stays assignable until you delete it. Deleting it keeps the history of its tasks, and while the project has no agents, the next task given to the standard agent sets it up again.

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/get-started/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Créer et tester un agent de projet
description: Donner une tâche précise à un agent, le lancer et examiner son résultat.
---

Un agent de projet est une consigne réutilisable pour les tâches du projet. Tu choisis ses instructions, son environnement d’exécution, son modèle et ses outils, puis tu le lances sur une tâche et examines ce qu’il produit.
Un agent de projet est une consigne réutilisable pour les tâches du projet. Tu choisis ses instructions, son environnement d’exécution, son modèle et ses outils, puis tu le lances sur une tâche et examines ce qu’il produit. Tant qu’un projet n’a pas d’agent propre, ses tâches peuvent aller à l’[agent standard](/fr/platform/projects/project-agents#standard-agent) de l’organisation.

## Avant de commencer

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/get-started/members.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Dans **Accueil**, choisis un projet accessible sous **Projets**. Consulte **Tâc

</Frame>

Ouvre une tâche pour lire sa description, son attribution et la discussion. Dans tout projet que tu peux ouvrir, tu crées des tâches et modifies celles que tu as créées ou qui te sont attribuées, par exemple pour confier le travail à l’un des agents du projet. [Gérer les tâches du projet](/fr/platform/projects/tasks) explique le travail courant ; [utiliser les projets](/fr/tutorials/member/use-projects) propose un exemple complet.
Ouvre une tâche pour lire sa description, son attribution et la discussion. Dans tout projet que tu peux ouvrir, tu crées des tâches et modifies celles que tu as créées ou qui te sont attribuées, par exemple pour confier le travail à l’un des agents du projet ou, dans un projet sans agents propres, à l’[agent standard](/fr/platform/projects/project-agents#standard-agent) de l’organisation. [Gérer les tâches du projet](/fr/platform/projects/tasks) explique le travail courant ; [utiliser les projets](/fr/tutorials/member/use-projects) propose un exemple complet.

## Reprendre ton travail

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/platform/projects/project-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Un projet sans agents propres peut quand même confier du travail à un agent. S

</Frame>

L’onglet **Agents** l’affiche avec le badge **Standard**. Personne ne le modifie : son harness, son modèle et ses instructions suivent les réglages de l’organisation, relus à chaque démarrage d’une exécution, et son équipement se limite aux skills de documents `docx`, `pptx`, `xlsx` et `pdf` du projet. Sur **Automatique**, chaque exécution utilise un modèle que la personne qui la démarre peut utiliser ; il peut donc fonctionner avec des modèles différents selon les personnes.
L’onglet **Agents** l’affiche avec le badge **Standard**. Personne ne le modifie : son harness, son modèle et ses instructions suivent les réglages de l’organisation, relus à chaque démarrage d’une exécution, et son équipement se limite aux skills de documents `docx`, `pptx`, `xlsx` et `pdf` que le projet peut utiliser au démarrage d’une exécution. Si un admin en désactive un, il disparaît de son équipement au lieu de bloquer l’agent. Sur **Automatique**, chaque exécution utilise un modèle que la personne qui la démarre peut utiliser ; il peut donc fonctionner avec des modèles différents selon les personnes.

Pour donner au projet un agent propre, choisis **Nouvel agent**. Dès lors, le projet ne propose plus l’agent standard ; celui déjà mis en place reste assignable jusqu’à ce que tu le supprimes. Sa suppression conserve l’historique de ses tâches, et tant que le projet n’a pas d’agents, la prochaine tâche confiée à l’agent standard le remet en place.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import type { Sql } from 'postgres';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import { listSkillsForViewer } from '../../core/skills/file_actions.ts';
import { resolveOrgSlug } from '../../lib/org-config.ts';
import { listProjectSkillSlugs } from './composer.ts';

vi.mock('../../core/skills/file_actions.ts', () => ({
listSkillsForViewer: vi.fn(),
}));
vi.mock('../../lib/org-config.ts', () => ({ resolveOrgSlug: vi.fn() }));

/** A postgres.js stand-in answering the project's team scope. */
function fakeSql(teamIds: string[] | null): Sql {
const tag = (strings: TemplateStringsArray) =>
Promise.resolve(
strings.join('?').includes('FROM app.projects') ? [{ teamIds }] : [],
);
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- a two-member stand-in for the postgres.js template function
return Object.assign(tag, {
unsafe: (text: string) => text,
}) as unknown as Sql;
}

beforeEach(() => {
vi.mocked(resolveOrgSlug).mockReset().mockResolvedValue('acme');
vi.mocked(listSkillsForViewer)
.mockReset()
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- only the slugs are read
.mockResolvedValue({
skills: [{ slug: 'docx' }, { slug: 'house-style' }],
} as unknown as Awaited<ReturnType<typeof listSkillsForViewer>>);
});

describe('listProjectSkillSlugs — what the project itself can equip', () => {
it('lists the skills visible to the project and its teams, as a launch resolves them', async () => {
await expect(
listProjectSkillSlugs(fakeSql(['team-1']), {
organizationId: 'org-1',
projectId: 'project-1',
}),
).resolves.toEqual(['docx', 'house-style']);
expect(listSkillsForViewer).toHaveBeenCalledWith({
orgSlug: 'acme',
viewer: { kind: 'project', teamIds: ['team-1'] },
});
});

it('lists nothing for an organization without a configuration home', async () => {
vi.mocked(resolveOrgSlug).mockResolvedValue(null);

await expect(
listProjectSkillSlugs(fakeSql([]), {
organizationId: 'org-1',
projectId: 'project-1',
}),
).resolves.toEqual([]);
expect(listSkillsForViewer).not.toHaveBeenCalled();
});
});
22 changes: 22 additions & 0 deletions services/platform/backend/domains/chat/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,28 @@ export async function listProjectCapabilities(
};
}

/**
* The skill slugs visible to a PROJECT — org-wide plus its teams' — exactly
* as its agents' equipment resolves at launch, without a member's access
* check: for the organization's standard agent, which is kept in step with
* what its project can equip whoever its run acts for.
*/
export async function listProjectSkillSlugs(
sql: Sql,
args: { organizationId: string; projectId: string },
): Promise<string[]> {
const orgSlug = await resolveOrgSlug(sql, args.organizationId);
if (orgSlug === null) return [];
const listing = await listSkillsForViewer({
orgSlug,
viewer: {
kind: 'project',
teamIds: await projectTeamIds(sql, args.projectId),
},
});
return listing.skills.map((skill) => skill.slug);
}

/**
* What an AUTOMATION's agent node can equip: org-wide skills, optionally
* widened to a project's team skills, plus the org's connected connectors.
Expand Down
12 changes: 8 additions & 4 deletions services/platform/backend/domains/projects/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1801,8 +1801,11 @@ export async function insertManagedProjectAgent(

/**
* Bring a standard agent's stored settings in line with what the policy
* resolved for a run (`standard-agent.ts`), so its row — the Agents tab, the
* run card, the next run's resume plan — says what actually runs. Writes
* resolved for a run (`standard-agent.ts`) and with the document skills its
* project can equip now, so its row — the Agents tab, the run card, the
* next run's resume plan, the launch's skill staging — says what actually
* runs: a skill an admin since disabled is dropped rather than failing
* every start of an agent nobody can edit. Writes
* only on a difference, and no audit row: this is the organization's own
* setting applied, not a person's edit (the policy save audits that).
*
Expand All @@ -1821,20 +1824,21 @@ export async function alignManagedProjectAgent(
},
fields: Pick<
ManagedProjectAgentFields,
'harness' | 'model' | 'modelProvider' | 'instructions'
'harness' | 'model' | 'modelProvider' | 'skills' | 'instructions'
>,
): Promise<boolean> {
const changed = await tx<{ id: string }[]>`
UPDATE app.project_agents SET
harness = ${fields.harness}, model = ${fields.model},
model_provider = ${fields.modelProvider},
model_provider = ${fields.modelProvider}, skills = ${fields.skills},
instructions = ${fields.instructions}, updated_at_ms = ${Date.now()}
WHERE id = (
SELECT id FROM app.project_agents
WHERE id = ${agent.id} AND managed
AND (harness IS DISTINCT FROM ${fields.harness}
OR model IS DISTINCT FROM ${fields.model}
OR model_provider IS DISTINCT FROM ${fields.modelProvider}
OR skills IS DISTINCT FROM ${fields.skills}
OR instructions IS DISTINCT FROM ${fields.instructions})
FOR UPDATE SKIP LOCKED
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* count it once, and both answer it;
* - nobody edits the standard agent: a save answers `PROJECT_AGENT_MANAGED`
* and writes nothing;
* - a start brings its row in line with what resolved, and never waits for
* a row another start holds (`FOR UPDATE SKIP LOCKED`);
* - a start brings its row in line with what resolved — runtime, model,
* instructions and the document skills the project can still equip —
* and never waits for a row another start holds (`FOR UPDATE SKIP
* LOCKED`);
* - a project with agents of its own is left to them
* (`STANDARD_AGENT_NOT_NEEDED`);
* - switched off, the standard agent is created nowhere and starts nothing
Expand Down Expand Up @@ -139,7 +141,7 @@ export async function checkStandardAgent(
harness: 'claude-code',
model: 'lane-model',
modelProvider: 'lane-provider',
skills: [] as string[],
skills: ['docx', 'pptx'],
instructions: 'Do the task.',
};
const project = { id: projectId, name: 'Standard agent lane' };
Expand Down Expand Up @@ -198,10 +200,12 @@ export async function checkStandardAgent(

// ---- a start aligns the row, and never waits for it ---------------------
const target = { id: first.agentId, organizationId: orgId, projectId };
// An admin disabled `pptx` since the agent was set up: the start drops it.
const resolved = {
harness: 'claude-code',
model: 'healed-model',
modelProvider: 'lane-provider',
skills: ['docx'],
instructions: 'Do the task.',
};
// Another start holds the row: the alignment skips it at once.
Expand All @@ -224,17 +228,18 @@ export async function checkStandardAgent(
const again = await sql.begin((tx) =>
alignManagedProjectAgent(tx, target, resolved),
);
const aligned = await sql<{ model: string }[]>`
SELECT model FROM app.project_agents WHERE id = ${first.agentId}
const aligned = await sql<{ model: string; skills: string[] }[]>`
SELECT model, skills FROM app.project_agents WHERE id = ${first.agentId}
`;
record(
'standard agent: a start aligns its row once, and skips a row another start holds',
'standard agent: a start aligns its row once, dropping a skill gone since, and skips a row another start holds',
whileHeld === false &&
whileHeldMs < 2_000 &&
healed &&
!again &&
aligned[0]?.model === 'healed-model',
`whileHeld=${String(whileHeld)} in ${whileHeldMs}ms healed=${String(healed)} again=${String(again)} model=${aligned[0]?.model}`,
aligned[0]?.model === 'healed-model' &&
aligned[0].skills.join(',') === 'docx',
`whileHeld=${String(whileHeld)} in ${whileHeldMs}ms healed=${String(healed)} again=${String(again)} model=${aligned[0]?.model} skills=${aligned[0]?.skills.join(',')}`,
);

// ---- a project with agents of its own ----------------------------------
Expand Down
Loading
Loading