@elyracode/felagi 0.9.58 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.1] - 2026-11-22
4
+
5
+ ### Changed
6
+
7
+ - Peer dependency on `@elyracode/coding-agent` is now `>=1.0.0`, the first version with the APIs this package uses
8
+
9
+ ## [1.0.0] - 2026-11-22
10
+
11
+ ### Fixed
12
+
13
+ - Fixed a repository `.env` being able to set `FELAGI_URL` and receive the `FELAGI_TOKEN` from your environment. URL and token now come from the same source (both from the environment, else both from the project `.env`), and the project `.env` is only read in trusted projects
14
+
3
15
  ## [0.9.58] - 2026-11-18
4
16
 
5
17
  ## [0.9.57] - 2026-11-10
package/README.md CHANGED
@@ -17,6 +17,8 @@ FELAGI_URL=https://felagi.example.com
17
17
  FELAGI_TOKEN=fat_...
18
18
  ```
19
19
 
20
+ URL and token are always taken from the same place: both from the environment if it sets both, otherwise both from the project's `.env`. The project's `.env` is only read in [trusted projects](../coding-agent/docs/project-trust.md), so a cloned repository cannot send your token to a host of its choosing.
21
+
20
22
  A read-only token works for everything except writes (which answer 403 with a message saying so).
21
23
 
22
24
  ## Tools
@@ -6,9 +6,11 @@
6
6
  * a knowledge base, whiteboards, and agent runs. This extension talks to
7
7
  * its REST API (/api/v1) with a personal token.
8
8
  *
9
- * Configuration (environment or the project's .env):
9
+ * Configuration (environment, or the project's .env in trusted projects):
10
10
  * FELAGI_URL=https://felagi.example.com
11
11
  * FELAGI_TOKEN=fat_...
12
+ * URL and token always come from the same source, so a repository's .env can
13
+ * never point a token from your environment at a host it chooses.
12
14
  *
13
15
  * API notes baked into this client (from the specification):
14
16
  * - An issue's `id` in responses is the human identifier (ACM-231); the
@@ -24,7 +26,7 @@
24
26
 
25
27
  import { existsSync, readFileSync } from "node:fs";
26
28
  import { join } from "node:path";
27
- import type { ExtensionAPI } from "@elyracode/coding-agent";
29
+ import type { ExtensionAPI, ExtensionContext } from "@elyracode/coding-agent";
28
30
  import { Type } from "typebox";
29
31
 
30
32
  // ── Configuration ───────────────────────────────────────────────────────────
@@ -53,12 +55,25 @@ function loadEnv(cwd: string): Record<string, string> {
53
55
  return result;
54
56
  }
55
57
 
56
- function getConfig(cwd: string): FelagiConfig | null {
57
- const env = loadEnv(cwd);
58
- const baseUrl = process.env.FELAGI_URL || env.FELAGI_URL;
59
- const token = process.env.FELAGI_TOKEN || env.FELAGI_TOKEN;
60
- if (!baseUrl || !token) return null;
61
- return { baseUrl: baseUrl.replace(/\/+$/, ""), token };
58
+ type EnvSource = Readonly<Record<string, string | undefined>>;
59
+
60
+ /**
61
+ * Pick URL and token from one source: the process environment first, then the project's
62
+ * .env. Never mix them: a repository-controlled FELAGI_URL combined with a token from the
63
+ * user's environment would send that token to a host the repository chose.
64
+ * `projectEnv` is undefined when the project is not trusted.
65
+ */
66
+ export function resolveFelagiConfig(processEnv: EnvSource, projectEnv: EnvSource | undefined): FelagiConfig | null {
67
+ for (const source of [processEnv, projectEnv]) {
68
+ const baseUrl = source?.FELAGI_URL;
69
+ const token = source?.FELAGI_TOKEN;
70
+ if (baseUrl && token) return { baseUrl: baseUrl.replace(/\/+$/, ""), token };
71
+ }
72
+ return null;
73
+ }
74
+
75
+ function getConfig(ctx: Pick<ExtensionContext, "cwd" | "isProjectTrusted">): FelagiConfig | null {
76
+ return resolveFelagiConfig(process.env, ctx.isProjectTrusted() ? loadEnv(ctx.cwd) : undefined);
62
77
  }
63
78
 
64
79
  // ── HTTP client ─────────────────────────────────────────────────────────────
@@ -110,7 +125,8 @@ function ok(text: string) {
110
125
 
111
126
  function noConfig(): Error {
112
127
  return new Error(
113
- "F\u00e9lagi is not configured. Set FELAGI_URL and FELAGI_TOKEN in the environment or the project's .env file. " +
128
+ "F\u00e9lagi is not configured. Set FELAGI_URL and FELAGI_TOKEN together, either in the environment or in the project's .env file " +
129
+ "(read only in trusted projects; run /trust). " +
114
130
  "Create a token under Settings \u2192 API tokens in F\u00e9lagi.",
115
131
  );
116
132
  }
@@ -260,7 +276,7 @@ export default function (elyra: ExtensionAPI): void {
260
276
  "Use this first when other F\u00e9lagi calls fail, or to learn the workspace issue prefix.",
261
277
  parameters: Type.Object({}),
262
278
  execute: async (_id, _params, _signal, _onUpdate, ctx) => {
263
- const config = getConfig(ctx.cwd);
279
+ const config = getConfig(ctx);
264
280
  if (!config) throw noConfig();
265
281
  const response = await felagiFetch(config, "GET", "/me");
266
282
  if (!response.ok) throw apiError(response);
@@ -306,7 +322,7 @@ export default function (elyra: ExtensionAPI): void {
306
322
  per_page: Type.Optional(Type.Number({ description: "Up to 100 (default 25)" })),
307
323
  }),
308
324
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
309
- const config = getConfig(ctx.cwd);
325
+ const config = getConfig(ctx);
310
326
  if (!config) throw noConfig();
311
327
  const query = new URLSearchParams();
312
328
  if (params.q) query.set("q", params.q);
@@ -342,7 +358,7 @@ export default function (elyra: ExtensionAPI): void {
342
358
  include_artifacts: Type.Optional(Type.Boolean({ description: "Include what runs delivered" })),
343
359
  }),
344
360
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
345
- const config = getConfig(ctx.cwd);
361
+ const config = getConfig(ctx);
346
362
  if (!config) throw noConfig();
347
363
  const issueRef = encodeURIComponent(params.issue);
348
364
  const response = await felagiFetch(config, "GET", `/issues/${issueRef}`);
@@ -406,7 +422,7 @@ export default function (elyra: ExtensionAPI): void {
406
422
  estimate_minutes: Type.Optional(Type.Number()),
407
423
  }),
408
424
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
409
- const config = getConfig(ctx.cwd);
425
+ const config = getConfig(ctx);
410
426
  if (!config) throw noConfig();
411
427
  const response = await felagiFetch(config, "POST", "/issues", params);
412
428
  if (!response.ok) throw apiError(response);
@@ -438,7 +454,7 @@ export default function (elyra: ExtensionAPI): void {
438
454
  estimate_minutes: Type.Optional(Type.Number()),
439
455
  }),
440
456
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
441
- const config = getConfig(ctx.cwd);
457
+ const config = getConfig(ctx);
442
458
  if (!config) throw noConfig();
443
459
  const { issue, ...fields } = params;
444
460
  const response = await felagiFetch(config, "PATCH", `/issues/${encodeURIComponent(issue)}`, fields);
@@ -460,7 +476,7 @@ export default function (elyra: ExtensionAPI): void {
460
476
  body: Type.String(),
461
477
  }),
462
478
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
463
- const config = getConfig(ctx.cwd);
479
+ const config = getConfig(ctx);
464
480
  if (!config) throw noConfig();
465
481
  const response = await felagiFetch(config, "POST", `/issues/${encodeURIComponent(params.issue)}/comments`, {
466
482
  body: params.body,
@@ -486,7 +502,7 @@ export default function (elyra: ExtensionAPI): void {
486
502
  note: Type.Optional(Type.String({ description: "Plain text note" })),
487
503
  }),
488
504
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
489
- const config = getConfig(ctx.cwd);
505
+ const config = getConfig(ctx);
490
506
  if (!config) throw noConfig();
491
507
  if (!params.duration && params.minutes == null) {
492
508
  throw new Error("Provide duration ('2h 30m') or minutes.");
@@ -515,7 +531,7 @@ export default function (elyra: ExtensionAPI): void {
515
531
  source: Type.Optional(Type.String({ description: "manual, timer, or agent_run" })),
516
532
  }),
517
533
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
518
- const config = getConfig(ctx.cwd);
534
+ const config = getConfig(ctx);
519
535
  if (!config) throw noConfig();
520
536
  const query = new URLSearchParams();
521
537
  if (params.mine) query.set("mine", "1");
@@ -569,7 +585,7 @@ export default function (elyra: ExtensionAPI): void {
569
585
  note: Type.Optional(Type.String({ description: "Optional note for 'start'" })),
570
586
  }),
571
587
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
572
- const config = getConfig(ctx.cwd);
588
+ const config = getConfig(ctx);
573
589
  if (!config) throw noConfig();
574
590
 
575
591
  if (params.action === "status") {
@@ -629,7 +645,7 @@ export default function (elyra: ExtensionAPI): void {
629
645
  article_id: Type.Optional(Type.String({ description: "ULID of one article \u2014 returns the full body" })),
630
646
  }),
631
647
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
632
- const config = getConfig(ctx.cwd);
648
+ const config = getConfig(ctx);
633
649
  if (!config) throw noConfig();
634
650
 
635
651
  if (params.article_id) {
@@ -664,7 +680,7 @@ export default function (elyra: ExtensionAPI): void {
664
680
  description: "List F\u00e9lagi projects with status, priority, lead, and which issue types each offers.",
665
681
  parameters: Type.Object({}),
666
682
  execute: async (_id, _params, _signal, _onUpdate, ctx) => {
667
- const config = getConfig(ctx.cwd);
683
+ const config = getConfig(ctx);
668
684
  if (!config) throw noConfig();
669
685
  const response = await felagiFetch(config, "GET", "/projects");
670
686
  if (!response.ok) throw apiError(response);
@@ -698,7 +714,7 @@ export default function (elyra: ExtensionAPI): void {
698
714
  "runtime machine is online.",
699
715
  parameters: Type.Object({}),
700
716
  execute: async (_id, _params, _signal, _onUpdate, ctx) => {
701
- const config = getConfig(ctx.cwd);
717
+ const config = getConfig(ctx);
702
718
  if (!config) throw noConfig();
703
719
  const response = await felagiFetch(config, "GET", "/agents");
704
720
  if (!response.ok) throw apiError(response);
@@ -740,7 +756,7 @@ export default function (elyra: ExtensionAPI): void {
740
756
  ),
741
757
  }),
742
758
  execute: async (_id, params, _signal, _onUpdate, ctx) => {
743
- const config = getConfig(ctx.cwd);
759
+ const config = getConfig(ctx);
744
760
  if (!config) throw noConfig();
745
761
 
746
762
  if (params.action === "queue") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyracode/felagi",
3
- "version": "0.9.58",
3
+ "version": "1.0.1",
4
4
  "description": "Elyra Félagi integration — issues, comments, time tracking, the stopwatch, knowledge base, projects, and agent runs from your Elyra session",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -25,13 +25,20 @@
25
25
  "./extensions/index.ts"
26
26
  ]
27
27
  },
28
+ "files": [
29
+ "extensions",
30
+ "skills",
31
+ "README.md",
32
+ "CHANGELOG.md"
33
+ ],
28
34
  "peerDependencies": {
29
- "@elyracode/coding-agent": "*",
35
+ "@elyracode/coding-agent": ">=1.0.0",
30
36
  "typebox": "*"
31
37
  },
32
38
  "scripts": {
33
39
  "clean": "echo 'nothing to clean'",
34
40
  "build": "echo 'nothing to build'",
35
- "check": "echo 'nothing to check'"
41
+ "check": "echo 'nothing to check'",
42
+ "test": "vitest --run"
36
43
  }
37
44
  }
@@ -34,7 +34,7 @@ Félagi is the team's project portal: people and agents share one board. Issues,
34
34
 
35
35
  ## Setup
36
36
 
37
- Requires `FELAGI_URL` and `FELAGI_TOKEN` (environment or project `.env`). Tokens are created under **Settings → API tokens** in Félagi; a read-only token makes every write answer 403.
37
+ Requires `FELAGI_URL` and `FELAGI_TOKEN`, both in the environment or both in the project `.env` (read only in trusted projects). Tokens are created under **Settings → API tokens** in Félagi; a read-only token makes every write answer 403.
38
38
 
39
39
  ## Semantics Worth Respecting
40
40