@studio-foundation/api 0.13.0 → 0.14.0

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.
Files changed (58) hide show
  1. package/README.md +5 -5
  2. package/dist/bootstrap.d.ts +4 -5
  3. package/dist/bootstrap.d.ts.map +1 -1
  4. package/dist/bootstrap.js +16 -18
  5. package/dist/bootstrap.js.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/server.d.ts +4 -4
  9. package/dist/server.d.ts.map +1 -1
  10. package/dist/server.js +3 -3
  11. package/dist/server.js.map +1 -1
  12. package/dist/trigger-runtime.d.ts +27 -0
  13. package/dist/trigger-runtime.d.ts.map +1 -0
  14. package/dist/trigger-runtime.js +204 -0
  15. package/dist/trigger-runtime.js.map +1 -0
  16. package/dist/trigger-store.d.ts +20 -0
  17. package/dist/trigger-store.d.ts.map +1 -0
  18. package/dist/trigger-store.js +53 -0
  19. package/dist/trigger-store.js.map +1 -0
  20. package/dist/triggers/trigger-loader.d.ts +7 -0
  21. package/dist/triggers/trigger-loader.d.ts.map +1 -0
  22. package/dist/triggers/trigger-loader.js +38 -0
  23. package/dist/triggers/trigger-loader.js.map +1 -0
  24. package/dist/triggers/webhook.d.ts +10 -0
  25. package/dist/triggers/webhook.d.ts.map +1 -0
  26. package/dist/triggers/webhook.js +42 -0
  27. package/dist/triggers/webhook.js.map +1 -0
  28. package/dist/user-store.js +1 -1
  29. package/dist/user-store.js.map +1 -1
  30. package/dist/utils/repo-resolver.d.ts +9 -2
  31. package/dist/utils/repo-resolver.d.ts.map +1 -1
  32. package/dist/utils/repo-resolver.js +42 -2
  33. package/dist/utils/repo-resolver.js.map +1 -1
  34. package/package.json +8 -4
  35. package/dist/integration-runtime.d.ts +0 -22
  36. package/dist/integration-runtime.d.ts.map +0 -1
  37. package/dist/integration-runtime.js +0 -150
  38. package/dist/integration-runtime.js.map +0 -1
  39. package/dist/integration-store.d.ts +0 -26
  40. package/dist/integration-store.d.ts.map +0 -1
  41. package/dist/integration-store.js +0 -78
  42. package/dist/integration-store.js.map +0 -1
  43. package/dist/integrations/linear/failure-handler.d.ts +0 -5
  44. package/dist/integrations/linear/failure-handler.d.ts.map +0 -1
  45. package/dist/integrations/linear/failure-handler.js +0 -73
  46. package/dist/integrations/linear/failure-handler.js.map +0 -1
  47. package/dist/integrations/linear/webhook-handler.d.ts +0 -6
  48. package/dist/integrations/linear/webhook-handler.d.ts.map +0 -1
  49. package/dist/integrations/linear/webhook-handler.js +0 -131
  50. package/dist/integrations/linear/webhook-handler.js.map +0 -1
  51. package/dist/integrations/registry.d.ts +0 -4
  52. package/dist/integrations/registry.d.ts.map +0 -1
  53. package/dist/integrations/registry.js +0 -9
  54. package/dist/integrations/registry.js.map +0 -1
  55. package/dist/integrations/types.d.ts +0 -33
  56. package/dist/integrations/types.d.ts.map +0 -1
  57. package/dist/integrations/types.js +0 -2
  58. package/dist/integrations/types.js.map +0 -1
@@ -1,73 +0,0 @@
1
- const LINEAR_GRAPHQL_URL = 'https://api.linear.app/graphql';
2
- async function gql(query, variables, apiKey) {
3
- const res = await fetch(LINEAR_GRAPHQL_URL, {
4
- method: 'POST',
5
- headers: { 'Content-Type': 'application/json', Authorization: apiKey },
6
- body: JSON.stringify({ query, variables }),
7
- });
8
- if (!res.ok)
9
- throw new Error(`Linear GraphQL HTTP error: ${res.status} ${res.statusText}`);
10
- return res.json();
11
- }
12
- function buildFailureComment(ctx) {
13
- const iterations = ctx.lastGroupFeedback?.iteration;
14
- const iterLabel = iterations != null ? ` après ${iterations} itérations QA` : '';
15
- const rejectionReason = ctx.lastGroupFeedback?.rejection_reason;
16
- const rejectionDetails = ctx.lastGroupFeedback?.rejection_details;
17
- const lines = [];
18
- lines.push(`❌ **Code Builder échoué** —${iterLabel ? ` QA a rejeté${iterLabel}` : ' pipeline échoué'}`);
19
- lines.push('');
20
- if (rejectionReason) {
21
- lines.push('**Dernière raison de rejet :**');
22
- if (rejectionDetails && rejectionDetails.length > 0) {
23
- for (const detail of rejectionDetails)
24
- lines.push(`- ${detail}`);
25
- }
26
- else {
27
- lines.push(`- ${rejectionReason}`);
28
- }
29
- lines.push('');
30
- }
31
- lines.push('**Action requise :** réviser le brief ou augmenter max_iterations');
32
- lines.push('');
33
- lines.push(`**Run ID :** ${ctx.runId}`);
34
- return lines.join('\n');
35
- }
36
- export class LinearFailureHandler {
37
- async handleFailure(ctx) {
38
- const issueId = typeof ctx.meta['linear_issue_id'] === 'string' ? ctx.meta['linear_issue_id'] : undefined;
39
- if (!issueId)
40
- return;
41
- const apiKey = ctx.integrationConfig['LINEAR_API_KEY']
42
- ?? process.env['LINEAR_API_KEY'];
43
- if (!apiKey) {
44
- console.warn('[linear-failure-handler] LINEAR_API_KEY not set — skipping failure notification');
45
- return;
46
- }
47
- const comment = buildFailureComment(ctx);
48
- try {
49
- await gql(`mutation CreateComment($issueId: String!, $body: String!) {
50
- commentCreate(input: { issueId: $issueId, body: $body }) { success }
51
- }`, { issueId, body: comment }, apiKey);
52
- const statesResult = await gql(`query GetWorkflowStates($issueId: String!) {
53
- issue(id: $issueId) { team { states { nodes { id name } } } }
54
- }`, { issueId }, apiKey);
55
- const nodes = (statesResult
56
- .data?.issue?.team?.states?.nodes) ?? [];
57
- const backlogState = nodes.find((s) => s.name === 'Backlog');
58
- if (backlogState) {
59
- await gql(`mutation UpdateIssue($id: String!, $stateId: String!) {
60
- issueUpdate(id: $id, input: { stateId: $stateId }) { success }
61
- }`, { id: issueId, stateId: backlogState.id }, apiKey);
62
- }
63
- else {
64
- console.warn(`[linear-failure-handler] "Backlog" state not found for issue ${issueId} — status not updated`);
65
- }
66
- console.log(`[linear-failure-handler] Failure notification posted for issue ${issueId}`);
67
- }
68
- catch (err) {
69
- console.error('[linear-failure-handler] Failed to notify Linear:', err);
70
- }
71
- }
72
- }
73
- //# sourceMappingURL=failure-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"failure-handler.js","sourceRoot":"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M,YAAY,GAAG,MAAM,GAAG,CAC5B;;UAEE,EACF,EAAE,OAAO,EAAE,EACX,MAAM,CACP,CAAC;YAGF,MAAM,KAAK,GAAG,CACX,YAAuF;iBACrF,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CACpC,IAAI,EAAE,CAAC;YACR,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;YAExE,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,GAAG,CACP;;YAEE,EACF,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,EACzC,MAAM,CACP,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,gEAAgE,OAAO,uBAAuB,CAAC,CAAC;YAC/G,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,kEAAkE,OAAO,EAAE,CAAC,CAAC;QAC3F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE,GAAG,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;CACF"}
@@ -1,6 +0,0 @@
1
- import type { FastifyReply } from 'fastify';
2
- import type { WebhookHandler, WebhookHandlerContext } from '../types.js';
3
- export declare class LinearWebhookHandler implements WebhookHandler {
4
- handle(ctx: WebhookHandlerContext, reply: FastifyReply): Promise<unknown>;
5
- }
6
- //# sourceMappingURL=webhook-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhook-handler.d.ts","sourceRoot":"","sources":["../../../src/integrations/linear/webhook-handler.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA4BzE,qBAAa,oBAAqB,YAAW,cAAc;IACnD,MAAM,CAAC,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CAuHhF"}
@@ -1,131 +0,0 @@
1
- // LinearWebhookHandler — plugin class implementing WebhookHandler
2
- // Extracted from routes/linear-webhook.ts POST /integrations/linear/webhook
3
- // Receives all deps via WebhookHandlerContext instead of Fastify plugin closure.
4
- import { createHmac, timingSafeEqual, randomUUID } from 'node:crypto';
5
- import { join } from 'node:path';
6
- import { loadPipelineByName } from '@studio-foundation/engine';
7
- import { resolveRepoPath } from '../../utils/repo-resolver.js';
8
- function verifyHmac(rawBody, signature, secret) {
9
- const computed = createHmac('sha256', secret).update(rawBody).digest('hex');
10
- try {
11
- const a = Buffer.from(computed, 'hex');
12
- const b = Buffer.from(signature, 'hex');
13
- if (a.length !== b.length)
14
- return false;
15
- return timingSafeEqual(a, b);
16
- }
17
- catch {
18
- return false;
19
- }
20
- }
21
- export class LinearWebhookHandler {
22
- async handle(ctx, reply) {
23
- const { rawBody, headers, integration, store, launcher, configsDir, projectsDir, integrationConfig } = ctx;
24
- // HMAC verification — only when hmac config is present in the integration def
25
- const hmacConfig = integration.webhook?.hmac;
26
- if (hmacConfig) {
27
- const secret = integrationConfig[hmacConfig.secret_env];
28
- if (secret) {
29
- const sig = headers[hmacConfig.header];
30
- if (typeof sig !== 'string') {
31
- return reply.status(401).send({ error: `Missing ${hmacConfig.header} header` });
32
- }
33
- if (!verifyHmac(rawBody, sig, secret)) {
34
- return reply.status(401).send({ error: 'Invalid signature' });
35
- }
36
- }
37
- }
38
- let payload;
39
- try {
40
- payload = JSON.parse(rawBody.toString('utf-8'));
41
- }
42
- catch {
43
- return reply.status(400).send({ error: 'Invalid JSON' });
44
- }
45
- // Only handle Issue update events
46
- if (payload.type !== 'Issue' || payload.action !== 'update') {
47
- return reply.status(200).send({ ignored: true, reason: 'not an issue update' });
48
- }
49
- const issue = payload.data ?? {};
50
- // Only trigger on transitions to "In Progress"
51
- if (issue.state?.name !== 'In Progress') {
52
- return reply.status(200).send({ ignored: true, reason: `state is "${issue.state?.name ?? 'unknown'}"` });
53
- }
54
- // Check integration is active
55
- const config = store.getConfig(integration.name);
56
- if (!config.active) {
57
- return reply.status(200).send({ ignored: true, reason: 'integration is inactive' });
58
- }
59
- const pipeline = config.pipeline ?? 'feature-builder';
60
- const issueUrl = `https://linear.app/studioag/issue/${issue.identifier}`;
61
- // Resolve repo path from pipeline YAML — mirrors CLI behaviour.
62
- // If the pipeline file can't be loaded, fall back gracefully —
63
- // launcher.launch() will surface the proper "pipeline not found" error afterwards.
64
- let pipelineRepoUrl;
65
- let pipelineRepoBranch;
66
- try {
67
- const pipelineDef = await loadPipelineByName(pipeline, join(configsDir, 'pipelines'));
68
- pipelineRepoUrl = pipelineDef.repo?.url;
69
- pipelineRepoBranch = pipelineDef.repo?.branch;
70
- }
71
- catch {
72
- // Pipeline not found or unparseable — launcher.launch() will handle the error
73
- }
74
- let repoPath;
75
- try {
76
- repoPath = await resolveRepoPath({
77
- repoUrl: pipelineRepoUrl,
78
- rawProjectsDir: projectsDir,
79
- pipelineName: pipeline,
80
- branch: pipelineRepoBranch,
81
- });
82
- }
83
- catch (err) {
84
- return reply.status(400).send({ error: err instanceof Error ? err.message : String(err) });
85
- }
86
- // Construct structured input for the configured pipeline
87
- const input = {
88
- brief_summary: [issue.identifier, issue.title].filter(Boolean).join(' — '),
89
- description: issue.description ?? '',
90
- acceptance_criteria: [],
91
- };
92
- const meta = {
93
- linear_issue_id: issue.id,
94
- linear_issue_identifier: issue.identifier,
95
- linear_issue_url: issueUrl,
96
- };
97
- const runId = randomUUID();
98
- const triggerId = randomUUID();
99
- const receivedAt = new Date().toISOString();
100
- try {
101
- await launcher.launch({ runId, pipeline, input, configsDir, repoPath, meta });
102
- store.insertTrigger({
103
- id: triggerId,
104
- integration_name: integration.name,
105
- received_at: receivedAt,
106
- external_id: issue.id,
107
- external_label: [issue.identifier, issue.title].filter(Boolean).join(' — '),
108
- external_url: issueUrl,
109
- pipeline,
110
- run_id: runId,
111
- status: 'success',
112
- });
113
- }
114
- catch (err) {
115
- store.insertTrigger({
116
- id: triggerId,
117
- integration_name: integration.name,
118
- received_at: receivedAt,
119
- external_id: issue.id,
120
- external_label: [issue.identifier, issue.title].filter(Boolean).join(' — '),
121
- external_url: issueUrl,
122
- pipeline,
123
- run_id: runId,
124
- status: 'failed',
125
- });
126
- throw err;
127
- }
128
- return reply.status(202).send({ run_id: runId, stream_url: `/api/runs/${runId}/stream` });
129
- }
130
- }
131
- //# sourceMappingURL=webhook-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhook-handler.js","sourceRoot":"","sources":["../../../src/integrations/linear/webhook-handler.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,4EAA4E;AAC5E,iFAAiF;AAEjF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAc/D,SAAS,UAAU,CAAC,OAAe,EAAE,SAAiB,EAAE,MAAc;IACpE,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACxC,OAAO,eAAe,CAAC,CAAC,EAAE,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
- export declare const WEBHOOK_HANDLERS: Record<string, WebhookHandler>;
3
- export declare const FAILURE_HANDLERS: Record<string, FailureHandler>;
4
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/integrations/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAE3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAE3D,CAAC"}
@@ -1,9 +0,0 @@
1
- import { LinearWebhookHandler } from './linear/webhook-handler.js';
2
- import { LinearFailureHandler } from './linear/failure-handler.js';
3
- export const WEBHOOK_HANDLERS = {
4
- 'linear-webhook': new LinearWebhookHandler(),
5
- };
6
- export const FAILURE_HANDLERS = {
7
- 'linear-failure': new LinearFailureHandler(),
8
- };
9
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/integrations/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,gBAAgB,EAAE,IAAI,oBAAoB,EAAE;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,gBAAgB,EAAE,IAAI,oBAAoB,EAAE;CAC7C,CAAC"}
@@ -1,33 +0,0 @@
1
- import type { FastifyReply } from 'fastify';
2
- import type { IntegrationPluginDef } from '@studio-foundation/contracts';
3
- import type { GroupFeedbackEvent } from '@studio-foundation/engine';
4
- import type { IntegrationStore } from '../integration-store.js';
5
- import type { RunLauncher } from '../launcher.js';
6
- import type { ApiConfig } from '../server.js';
7
- export interface WebhookHandlerContext {
8
- rawBody: Buffer;
9
- headers: Record<string, string | string[] | undefined>;
10
- integration: IntegrationPluginDef;
11
- store: IntegrationStore;
12
- launcher: RunLauncher;
13
- configsDir: string;
14
- projectsDir?: string;
15
- apiConfig: ApiConfig;
16
- integrationConfig: Record<string, unknown>;
17
- }
18
- export interface FailureHandlerContext {
19
- runId: string;
20
- durationMs: number;
21
- status: string;
22
- meta: Record<string, unknown>;
23
- lastGroupFeedback?: GroupFeedbackEvent;
24
- integration: IntegrationPluginDef;
25
- integrationConfig: Record<string, unknown>;
26
- }
27
- export interface WebhookHandler {
28
- handle(ctx: WebhookHandlerContext, reply: FastifyReply): Promise<unknown>;
29
- }
30
- export interface FailureHandler {
31
- handleFailure(ctx: FailureHandlerContext): Promise<void>;
32
- }
33
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/integrations/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,WAAW,EAAE,oBAAoB,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/integrations/types.ts"],"names":[],"mappings":""}