struere 0.3.10 → 0.3.11

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.
@@ -18294,12 +18294,30 @@ async function interactiveSetup(cwd) {
18294
18294
  console.log();
18295
18295
  }
18296
18296
  spinner.start("Fetching agents");
18297
- const { agents: existingAgents, error: listError } = await listAgents();
18297
+ let { agents: existingAgents, error: listError } = await listAgents();
18298
18298
  if (listError) {
18299
- spinner.fail("Failed to fetch agents");
18300
- console.log();
18301
- console.log(source_default.gray("Run"), source_default.cyan("struere login"), source_default.gray("to re-authenticate"));
18302
- return null;
18299
+ const isAuthError = listError.includes("Unauthenticated") || listError.includes("OIDC") || listError.includes("token") || listError.includes("expired");
18300
+ if (isAuthError) {
18301
+ spinner.fail("Session expired");
18302
+ console.log();
18303
+ console.log(source_default.gray("Re-authenticating..."));
18304
+ clearCredentials();
18305
+ credentials = await performLogin();
18306
+ if (!credentials) {
18307
+ console.log(source_default.red("Authentication failed"));
18308
+ return null;
18309
+ }
18310
+ spinner.start("Fetching agents");
18311
+ const retryResult = await listAgents();
18312
+ existingAgents = retryResult.agents;
18313
+ listError = retryResult.error;
18314
+ }
18315
+ if (listError) {
18316
+ spinner.fail("Failed to fetch agents");
18317
+ console.log();
18318
+ console.log(source_default.red("Error:"), listError);
18319
+ return null;
18320
+ }
18303
18321
  }
18304
18322
  const agents = existingAgents.map((a) => ({ id: a._id, name: a.name, slug: a.slug }));
18305
18323
  spinner.succeed(`Found ${agents.length} existing agent(s)`);
@@ -18332,11 +18350,33 @@ async function interactiveSetup(cwd) {
18332
18350
  const name = await promptText2("Agent name:", projectName);
18333
18351
  const displayName = name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
18334
18352
  spinner.start("Creating agent");
18335
- const { agentId, error: createError } = await createAgent({
18353
+ let { agentId, error: createError } = await createAgent({
18336
18354
  name: displayName,
18337
18355
  slug: name,
18338
18356
  description: `${displayName} Agent`
18339
18357
  });
18358
+ if (createError) {
18359
+ const isAuthError = createError.includes("Unauthenticated") || createError.includes("OIDC") || createError.includes("token") || createError.includes("expired");
18360
+ if (isAuthError) {
18361
+ spinner.fail("Session expired");
18362
+ console.log();
18363
+ console.log(source_default.gray("Re-authenticating..."));
18364
+ clearCredentials();
18365
+ credentials = await performLogin();
18366
+ if (!credentials) {
18367
+ console.log(source_default.red("Authentication failed"));
18368
+ return null;
18369
+ }
18370
+ spinner.start("Creating agent");
18371
+ const retryResult = await createAgent({
18372
+ name: displayName,
18373
+ slug: name,
18374
+ description: `${displayName} Agent`
18375
+ });
18376
+ agentId = retryResult.agentId;
18377
+ createError = retryResult.error;
18378
+ }
18379
+ }
18340
18380
  if (createError || !agentId) {
18341
18381
  spinner.fail("Failed to create agent");
18342
18382
  console.log();
@@ -19107,7 +19147,7 @@ var whoamiCommand = new Command("whoami").description("Show current logged in us
19107
19147
  // package.json
19108
19148
  var package_default = {
19109
19149
  name: "struere",
19110
- version: "0.3.10",
19150
+ version: "0.3.11",
19111
19151
  description: "Build, test, and deploy AI agents",
19112
19152
  keywords: [
19113
19153
  "ai",
package/dist/cli/index.js CHANGED
@@ -1636,12 +1636,30 @@ async function interactiveSetup(cwd) {
1636
1636
  console.log();
1637
1637
  }
1638
1638
  spinner.start("Fetching agents");
1639
- const { agents: existingAgents, error: listError } = await listAgents();
1639
+ let { agents: existingAgents, error: listError } = await listAgents();
1640
1640
  if (listError) {
1641
- spinner.fail("Failed to fetch agents");
1642
- console.log();
1643
- console.log(chalk3.gray("Run"), chalk3.cyan("struere login"), chalk3.gray("to re-authenticate"));
1644
- return null;
1641
+ const isAuthError = listError.includes("Unauthenticated") || listError.includes("OIDC") || listError.includes("token") || listError.includes("expired");
1642
+ if (isAuthError) {
1643
+ spinner.fail("Session expired");
1644
+ console.log();
1645
+ console.log(chalk3.gray("Re-authenticating..."));
1646
+ clearCredentials();
1647
+ credentials = await performLogin();
1648
+ if (!credentials) {
1649
+ console.log(chalk3.red("Authentication failed"));
1650
+ return null;
1651
+ }
1652
+ spinner.start("Fetching agents");
1653
+ const retryResult = await listAgents();
1654
+ existingAgents = retryResult.agents;
1655
+ listError = retryResult.error;
1656
+ }
1657
+ if (listError) {
1658
+ spinner.fail("Failed to fetch agents");
1659
+ console.log();
1660
+ console.log(chalk3.red("Error:"), listError);
1661
+ return null;
1662
+ }
1645
1663
  }
1646
1664
  const agents = existingAgents.map((a) => ({ id: a._id, name: a.name, slug: a.slug }));
1647
1665
  spinner.succeed(`Found ${agents.length} existing agent(s)`);
@@ -1674,11 +1692,33 @@ async function interactiveSetup(cwd) {
1674
1692
  const name = await promptText2("Agent name:", projectName);
1675
1693
  const displayName = name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
1676
1694
  spinner.start("Creating agent");
1677
- const { agentId, error: createError } = await createAgent({
1695
+ let { agentId, error: createError } = await createAgent({
1678
1696
  name: displayName,
1679
1697
  slug: name,
1680
1698
  description: `${displayName} Agent`
1681
1699
  });
1700
+ if (createError) {
1701
+ const isAuthError = createError.includes("Unauthenticated") || createError.includes("OIDC") || createError.includes("token") || createError.includes("expired");
1702
+ if (isAuthError) {
1703
+ spinner.fail("Session expired");
1704
+ console.log();
1705
+ console.log(chalk3.gray("Re-authenticating..."));
1706
+ clearCredentials();
1707
+ credentials = await performLogin();
1708
+ if (!credentials) {
1709
+ console.log(chalk3.red("Authentication failed"));
1710
+ return null;
1711
+ }
1712
+ spinner.start("Creating agent");
1713
+ const retryResult = await createAgent({
1714
+ name: displayName,
1715
+ slug: name,
1716
+ description: `${displayName} Agent`
1717
+ });
1718
+ agentId = retryResult.agentId;
1719
+ createError = retryResult.error;
1720
+ }
1721
+ }
1682
1722
  if (createError || !agentId) {
1683
1723
  spinner.fail("Failed to create agent");
1684
1724
  console.log();
@@ -2472,7 +2512,7 @@ var whoamiCommand = new Command11("whoami").description("Show current logged in
2472
2512
  // package.json
2473
2513
  var package_default = {
2474
2514
  name: "struere",
2475
- version: "0.3.10",
2515
+ version: "0.3.11",
2476
2516
  description: "Build, test, and deploy AI agents",
2477
2517
  keywords: [
2478
2518
  "ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "struere",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Build, test, and deploy AI agents",
5
5
  "keywords": [
6
6
  "ai",