@astralform/js 7.4.0 → 7.5.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.
package/dist/index.d.cts CHANGED
@@ -619,15 +619,30 @@ interface AgentInfo {
619
619
  isEnabled: boolean;
620
620
  avatarUrl?: string;
621
621
  /**
622
- * What the agent is for. A client shows Projects and Tasks only for `"code"`.
623
- * Absent on Astralform older than 0.70.0 treat that as `"chat"`, which is
624
- * also the server's default.
622
+ * Whether this agent's tasks can name a repository the workspace has GitHub
623
+ * connected and enabled here. A client shows Projects and Tasks on it.
624
+ *
625
+ * Derived by the server from the connector, so it cannot go stale the way the
626
+ * retired `mode` toggle could. It gates a SURFACE, not an ability: naming a
627
+ * repository is optional on every task, and a task that names none is an
628
+ * ordinary chat. Absent on Astralform older than 0.71.0 — fall back to `mode`
629
+ * there.
625
630
  *
626
631
  * It is a property of the WORKSPACE, not of a persona: `GET /v1/agents` selects
627
- * the workspace row itself and returns exactly one entry, so the mode is
628
- * `agents[0].mode` rather than something that varies across the list. The
629
- * workspace picker (`listAgents`) does not carry it, so a client learns an
630
- * agent's mode after opening it.
632
+ * the workspace row itself and returns exactly one entry, so read
633
+ * `agents[0].codeProjectsEnabled`. The workspace picker (`listAgents`) does not
634
+ * carry it, so a client learns this after opening an agent.
635
+ */
636
+ codeProjectsEnabled?: boolean;
637
+ /**
638
+ * @deprecated Removed in the next Astralform release. There is no agent mode —
639
+ * a repository belongs to the TASK, so one agent answers general questions and
640
+ * works in repositories from the same list. Read {@link codeProjectsEnabled}.
641
+ *
642
+ * Still reported for one release, as the STORED value of the retired column, so
643
+ * clients built before the change keep behaving exactly as they did. Do not
644
+ * treat it as an alias for `codeProjectsEnabled`: an agent that never had the
645
+ * toggle set still reports `"chat"` while its tasks can bind perfectly well.
631
646
  */
632
647
  mode?: "chat" | "code";
633
648
  }
@@ -759,9 +774,12 @@ interface ChatStreamRequest {
759
774
  /**
760
775
  * Which project (GitHub repository, `owner/repo`) this task belongs to.
761
776
  *
762
- * Required on the FIRST turn of a conversation on a code-mode agent and
763
- * ignored afterwards a task is bound to one repository for life, so a
764
- * different repository means a new task. Chat-mode agents ignore it entirely.
777
+ * Optional on every agent. The first turn that names one binds the task, and a
778
+ * later turn may omit it or repeat the same value; a DIFFERENT value is refused
779
+ * (409), not ignored a task is bound to one repository for life, so a
780
+ * different repository means a new task. A task that never names one is an
781
+ * ordinary chat; since Astralform 0.71.0 there is no agent mode that requires
782
+ * one.
765
783
  * Astralform >= 0.70.0.
766
784
  */
767
785
  repository?: string;
@@ -789,7 +807,7 @@ interface ChatStreamRequest {
789
807
  reasoning_effort?: ReasoningEffort;
790
808
  temperature?: number;
791
809
  }
792
- /** One repository an app user works with on a code-mode agent. */
810
+ /** One repository an app user works with on an agent. */
793
811
  interface CodeProject {
794
812
  repoFullName: string;
795
813
  addedAt: string;
@@ -1062,12 +1080,13 @@ interface SendOptions$1 extends ModelChoiceOptions {
1062
1080
  */
1063
1081
  goal?: string;
1064
1082
  /**
1065
- * The project this task belongs to (`owner/repo`), on a code-mode agent.
1083
+ * The project this task belongs to (`owner/repo`), when it has one.
1066
1084
  *
1067
- * Send it on the turn that STARTS a task; the binding is write-once, so later
1068
- * turns can omit it (sending a different one is refused). A first turn without
1069
- * it on a code-mode agent is refused too the run needs a repository before it
1070
- * can hold a credential scoped to one. Astralform >= 0.70.0.
1085
+ * Send it on the turn that STARTS a task; the binding is write-once, so a
1086
+ * later turn may omit it or repeat the same value, and a DIFFERENT value is
1087
+ * refused (409) rather than ignored. Omit it entirely and the task is an
1088
+ * ordinary chat since Astralform 0.71.0 no agent requires one, and a first
1089
+ * turn without it is no longer a 400. Astralform >= 0.70.0.
1071
1090
  */
1072
1091
  repository?: string;
1073
1092
  }
@@ -1220,9 +1239,10 @@ declare class AstralformClient {
1220
1239
  /**
1221
1240
  * A page of conversations, newest-updated first.
1222
1241
  *
1223
- * `options.repository` narrows to one project's tasks (`owner/repo`) on a
1224
- * code-mode agent — the same paging applies within the filter, so a client
1225
- * showing tasks per project pages each project separately.
1242
+ * `options.repository` narrows to one project's tasks (`owner/repo`) the same
1243
+ * paging applies within the filter, so a client showing tasks per project pages
1244
+ * each project separately. Tasks that named no repository fall outside every
1245
+ * such filter; list them with no filter at all.
1226
1246
  */
1227
1247
  getConversations(limit?: number, offset?: number, options?: {
1228
1248
  repository?: string;
@@ -1315,10 +1335,11 @@ declare class AstralformClient {
1315
1335
  * The projects (GitHub repositories) this app user works with, and what they
1316
1336
  * may add.
1317
1337
  *
1318
- * A project list is per app user within a code-mode agent: the developer
1319
- * connects the workspace's GitHub account, and each user curates their own
1320
- * list from what that connection covers. Every method 404s on a chat-mode
1321
- * agent, so the surface is invisible rather than empty there.
1338
+ * A project list is per app user: the developer connects the workspace's GitHub
1339
+ * account, and each user curates their own list from what that connection
1340
+ * covers. There is no agent-level gate an agent with no GitHub lists nothing,
1341
+ * reports `not_installed` from `available()`, and refuses `add()`. Read
1342
+ * {@link AgentInfo.codeProjectsEnabled} to decide whether to show the surface.
1322
1343
  */
1323
1344
  readonly code: {
1324
1345
  projects: {
@@ -1816,6 +1837,18 @@ interface SendOptions extends ModelChoiceOptions {
1816
1837
  * goal objective the backend drives to completion. Omit for a normal turn.
1817
1838
  */
1818
1839
  goal?: string;
1840
+ /**
1841
+ * The project this task belongs to (`owner/repo`), when it has one.
1842
+ *
1843
+ * Write-once server-side, and the refusal is the part that matters: the FIRST
1844
+ * turn that names a repository binds the task, a later turn may omit it or
1845
+ * repeat the same value, and a DIFFERENT value is refused (409) rather than
1846
+ * ignored — silently acting on the wrong repository is the failure that rule
1847
+ * exists to prevent. Omit it entirely and the task is an ordinary chat: since
1848
+ * Astralform 0.71.0 there is no agent mode that requires one, so a first turn
1849
+ * without it is no longer a 400. Astralform >= 0.70.0.
1850
+ */
1851
+ repository?: string;
1819
1852
  }
1820
1853
  type StreamManagerEvent = {
1821
1854
  type: "stateChange";
package/dist/index.d.ts CHANGED
@@ -619,15 +619,30 @@ interface AgentInfo {
619
619
  isEnabled: boolean;
620
620
  avatarUrl?: string;
621
621
  /**
622
- * What the agent is for. A client shows Projects and Tasks only for `"code"`.
623
- * Absent on Astralform older than 0.70.0 treat that as `"chat"`, which is
624
- * also the server's default.
622
+ * Whether this agent's tasks can name a repository the workspace has GitHub
623
+ * connected and enabled here. A client shows Projects and Tasks on it.
624
+ *
625
+ * Derived by the server from the connector, so it cannot go stale the way the
626
+ * retired `mode` toggle could. It gates a SURFACE, not an ability: naming a
627
+ * repository is optional on every task, and a task that names none is an
628
+ * ordinary chat. Absent on Astralform older than 0.71.0 — fall back to `mode`
629
+ * there.
625
630
  *
626
631
  * It is a property of the WORKSPACE, not of a persona: `GET /v1/agents` selects
627
- * the workspace row itself and returns exactly one entry, so the mode is
628
- * `agents[0].mode` rather than something that varies across the list. The
629
- * workspace picker (`listAgents`) does not carry it, so a client learns an
630
- * agent's mode after opening it.
632
+ * the workspace row itself and returns exactly one entry, so read
633
+ * `agents[0].codeProjectsEnabled`. The workspace picker (`listAgents`) does not
634
+ * carry it, so a client learns this after opening an agent.
635
+ */
636
+ codeProjectsEnabled?: boolean;
637
+ /**
638
+ * @deprecated Removed in the next Astralform release. There is no agent mode —
639
+ * a repository belongs to the TASK, so one agent answers general questions and
640
+ * works in repositories from the same list. Read {@link codeProjectsEnabled}.
641
+ *
642
+ * Still reported for one release, as the STORED value of the retired column, so
643
+ * clients built before the change keep behaving exactly as they did. Do not
644
+ * treat it as an alias for `codeProjectsEnabled`: an agent that never had the
645
+ * toggle set still reports `"chat"` while its tasks can bind perfectly well.
631
646
  */
632
647
  mode?: "chat" | "code";
633
648
  }
@@ -759,9 +774,12 @@ interface ChatStreamRequest {
759
774
  /**
760
775
  * Which project (GitHub repository, `owner/repo`) this task belongs to.
761
776
  *
762
- * Required on the FIRST turn of a conversation on a code-mode agent and
763
- * ignored afterwards a task is bound to one repository for life, so a
764
- * different repository means a new task. Chat-mode agents ignore it entirely.
777
+ * Optional on every agent. The first turn that names one binds the task, and a
778
+ * later turn may omit it or repeat the same value; a DIFFERENT value is refused
779
+ * (409), not ignored a task is bound to one repository for life, so a
780
+ * different repository means a new task. A task that never names one is an
781
+ * ordinary chat; since Astralform 0.71.0 there is no agent mode that requires
782
+ * one.
765
783
  * Astralform >= 0.70.0.
766
784
  */
767
785
  repository?: string;
@@ -789,7 +807,7 @@ interface ChatStreamRequest {
789
807
  reasoning_effort?: ReasoningEffort;
790
808
  temperature?: number;
791
809
  }
792
- /** One repository an app user works with on a code-mode agent. */
810
+ /** One repository an app user works with on an agent. */
793
811
  interface CodeProject {
794
812
  repoFullName: string;
795
813
  addedAt: string;
@@ -1062,12 +1080,13 @@ interface SendOptions$1 extends ModelChoiceOptions {
1062
1080
  */
1063
1081
  goal?: string;
1064
1082
  /**
1065
- * The project this task belongs to (`owner/repo`), on a code-mode agent.
1083
+ * The project this task belongs to (`owner/repo`), when it has one.
1066
1084
  *
1067
- * Send it on the turn that STARTS a task; the binding is write-once, so later
1068
- * turns can omit it (sending a different one is refused). A first turn without
1069
- * it on a code-mode agent is refused too the run needs a repository before it
1070
- * can hold a credential scoped to one. Astralform >= 0.70.0.
1085
+ * Send it on the turn that STARTS a task; the binding is write-once, so a
1086
+ * later turn may omit it or repeat the same value, and a DIFFERENT value is
1087
+ * refused (409) rather than ignored. Omit it entirely and the task is an
1088
+ * ordinary chat since Astralform 0.71.0 no agent requires one, and a first
1089
+ * turn without it is no longer a 400. Astralform >= 0.70.0.
1071
1090
  */
1072
1091
  repository?: string;
1073
1092
  }
@@ -1220,9 +1239,10 @@ declare class AstralformClient {
1220
1239
  /**
1221
1240
  * A page of conversations, newest-updated first.
1222
1241
  *
1223
- * `options.repository` narrows to one project's tasks (`owner/repo`) on a
1224
- * code-mode agent — the same paging applies within the filter, so a client
1225
- * showing tasks per project pages each project separately.
1242
+ * `options.repository` narrows to one project's tasks (`owner/repo`) the same
1243
+ * paging applies within the filter, so a client showing tasks per project pages
1244
+ * each project separately. Tasks that named no repository fall outside every
1245
+ * such filter; list them with no filter at all.
1226
1246
  */
1227
1247
  getConversations(limit?: number, offset?: number, options?: {
1228
1248
  repository?: string;
@@ -1315,10 +1335,11 @@ declare class AstralformClient {
1315
1335
  * The projects (GitHub repositories) this app user works with, and what they
1316
1336
  * may add.
1317
1337
  *
1318
- * A project list is per app user within a code-mode agent: the developer
1319
- * connects the workspace's GitHub account, and each user curates their own
1320
- * list from what that connection covers. Every method 404s on a chat-mode
1321
- * agent, so the surface is invisible rather than empty there.
1338
+ * A project list is per app user: the developer connects the workspace's GitHub
1339
+ * account, and each user curates their own list from what that connection
1340
+ * covers. There is no agent-level gate an agent with no GitHub lists nothing,
1341
+ * reports `not_installed` from `available()`, and refuses `add()`. Read
1342
+ * {@link AgentInfo.codeProjectsEnabled} to decide whether to show the surface.
1322
1343
  */
1323
1344
  readonly code: {
1324
1345
  projects: {
@@ -1816,6 +1837,18 @@ interface SendOptions extends ModelChoiceOptions {
1816
1837
  * goal objective the backend drives to completion. Omit for a normal turn.
1817
1838
  */
1818
1839
  goal?: string;
1840
+ /**
1841
+ * The project this task belongs to (`owner/repo`), when it has one.
1842
+ *
1843
+ * Write-once server-side, and the refusal is the part that matters: the FIRST
1844
+ * turn that names a repository binds the task, a later turn may omit it or
1845
+ * repeat the same value, and a DIFFERENT value is refused (409) rather than
1846
+ * ignored — silently acting on the wrong repository is the failure that rule
1847
+ * exists to prevent. Omit it entirely and the task is an ordinary chat: since
1848
+ * Astralform 0.71.0 there is no agent mode that requires one, so a first turn
1849
+ * without it is no longer a 400. Astralform >= 0.70.0.
1850
+ */
1851
+ repository?: string;
1819
1852
  }
1820
1853
  type StreamManagerEvent = {
1821
1854
  type: "stateChange";
package/dist/index.js CHANGED
@@ -338,15 +338,16 @@ function isApiKeyConfig(config) {
338
338
  }
339
339
  var AstralformClient = class {
340
340
  constructor(config) {
341
- // --- Code mode: the app user's projects ---
341
+ // --- Projects: the repositories this app user works with ---
342
342
  /**
343
343
  * The projects (GitHub repositories) this app user works with, and what they
344
344
  * may add.
345
345
  *
346
- * A project list is per app user within a code-mode agent: the developer
347
- * connects the workspace's GitHub account, and each user curates their own
348
- * list from what that connection covers. Every method 404s on a chat-mode
349
- * agent, so the surface is invisible rather than empty there.
346
+ * A project list is per app user: the developer connects the workspace's GitHub
347
+ * account, and each user curates their own list from what that connection
348
+ * covers. There is no agent-level gate an agent with no GitHub lists nothing,
349
+ * reports `not_installed` from `available()`, and refuses `add()`. Read
350
+ * {@link AgentInfo.codeProjectsEnabled} to decide whether to show the surface.
350
351
  */
351
352
  this.code = {
352
353
  projects: {
@@ -644,9 +645,10 @@ var AstralformClient = class {
644
645
  /**
645
646
  * A page of conversations, newest-updated first.
646
647
  *
647
- * `options.repository` narrows to one project's tasks (`owner/repo`) on a
648
- * code-mode agent — the same paging applies within the filter, so a client
649
- * showing tasks per project pages each project separately.
648
+ * `options.repository` narrows to one project's tasks (`owner/repo`) the same
649
+ * paging applies within the filter, so a client showing tasks per project pages
650
+ * each project separately. Tasks that named no repository fall outside every
651
+ * such filter; list them with no filter at all.
650
652
  */
651
653
  async getConversations(limit = 50, offset = 0, options) {
652
654
  const safeLimit = Math.max(1, Math.min(200, Math.floor(Number(limit))));
@@ -1747,7 +1749,7 @@ var ChatSession = class {
1747
1749
  image_mode: options?.imageMode,
1748
1750
  video_mode: options?.videoMode,
1749
1751
  goal: options?.goal,
1750
- // The project this task belongs to, on a code-mode agent. Write-once
1752
+ // The project this task belongs to, when it has one. Write-once
1751
1753
  // server-side: sent on every turn, honoured on the first.
1752
1754
  repository: options?.repository,
1753
1755
  // Per-request model choice (client-side model selection).
@@ -2602,23 +2604,8 @@ var StreamManager = class {
2602
2604
  this.setState("streaming");
2603
2605
  try {
2604
2606
  await this.session.send(content, {
2605
- // Address the send explicitly. `ChatSession.send` otherwise falls back
2606
- // to `session.conversationId`, which LAGS this pointer: a restore
2607
- // assigns it synchronously but only reaches the next switch's own
2608
- // `loadConversation` an await later, so between the two the session
2609
- // still names the conversation the user left. The manager's pointer
2610
- // moved the moment the user clicked; it is the authority.
2611
- conversationId: target ?? void 0,
2612
- agentName: options?.agentName,
2613
- uploadIds: options?.uploadIds,
2614
- planMode: options?.planMode,
2615
- imageMode: options?.imageMode,
2616
- videoMode: options?.videoMode,
2617
- goal: options?.goal,
2618
- provider: options?.provider,
2619
- model: options?.model,
2620
- reasoningEffort: options?.reasoningEffort,
2621
- temperature: options?.temperature
2607
+ ...options,
2608
+ conversationId: target ?? void 0
2622
2609
  });
2623
2610
  } catch {
2624
2611
  }