@autohq/cli 0.1.140 → 0.1.141

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.
@@ -26268,7 +26268,7 @@ Object.assign(lookup, {
26268
26268
  // package.json
26269
26269
  var package_default = {
26270
26270
  name: "@autohq/cli",
26271
- version: "0.1.140",
26271
+ version: "0.1.141",
26272
26272
  license: "SEE LICENSE IN README.md",
26273
26273
  publishConfig: {
26274
26274
  access: "public"
package/dist/index.js CHANGED
@@ -21204,7 +21204,7 @@ var init_package = __esm({
21204
21204
  "package.json"() {
21205
21205
  package_default = {
21206
21206
  name: "@autohq/cli",
21207
- version: "0.1.140",
21207
+ version: "0.1.141",
21208
21208
  license: "SEE LICENSE IN README.md",
21209
21209
  publishConfig: {
21210
21210
  access: "public"
@@ -21695,6 +21695,11 @@ function finalizeAgentApplyShape(document, path2) {
21695
21695
  spec.environment = environment.metadata.name;
21696
21696
  resources.push(environment);
21697
21697
  }
21698
+ if (isRecord(spec.identity)) {
21699
+ const identity2 = inlineIdentityResource(spec.identity, next, path2);
21700
+ spec.identity = identity2.metadata.name;
21701
+ resources.push(identity2);
21702
+ }
21698
21703
  if (Array.isArray(spec.triggers)) {
21699
21704
  spec.triggers = spec.triggers.map((trigger) => {
21700
21705
  if (!isRecord(trigger) || !("name" in trigger)) {
@@ -21732,6 +21737,34 @@ function inlineEnvironmentResource(document, path2) {
21732
21737
  spec: parsed.data.spec
21733
21738
  };
21734
21739
  }
21740
+ function inlineIdentityResource(document, agentDocument, path2) {
21741
+ const metadata = {};
21742
+ const spec = {};
21743
+ for (const [key, value] of Object.entries(document)) {
21744
+ if (value === void 0) {
21745
+ continue;
21746
+ }
21747
+ if (AGENT_METADATA_FIELDS.has(key)) {
21748
+ metadata[key] = value;
21749
+ continue;
21750
+ }
21751
+ spec[key] = value;
21752
+ }
21753
+ if (metadata.name === void 0 && isRecord(agentDocument.metadata) && typeof agentDocument.metadata.name === "string") {
21754
+ metadata.name = agentDocument.metadata.name;
21755
+ }
21756
+ const parsed = IdentityApplyRequestSchema.safeParse({ metadata, spec });
21757
+ if (!parsed.success) {
21758
+ throw new Error(
21759
+ `Invalid inline identity in ${path2}: ${parsed.error.message}`
21760
+ );
21761
+ }
21762
+ return {
21763
+ kind: RESOURCE_KIND_IDENTITY,
21764
+ metadata: parsed.data.metadata,
21765
+ spec: parsed.data.spec
21766
+ };
21767
+ }
21735
21768
  function assertNoDuplicateFacadeField(input) {
21736
21769
  if (input.targetValue !== void 0) {
21737
21770
  throw new Error(
@@ -22019,7 +22052,7 @@ function isAllowedDirectoryResourceKind(directoryKind, resource, generatedFromAg
22019
22052
  if (resource.kind === directoryKind) {
22020
22053
  return true;
22021
22054
  }
22022
- return directoryKind === RESOURCE_KIND_SESSION && resource.kind === RESOURCE_KIND_ENVIRONMENT && generatedFromAgent;
22055
+ return directoryKind === RESOURCE_KIND_SESSION && (resource.kind === RESOURCE_KIND_ENVIRONMENT || resource.kind === RESOURCE_KIND_IDENTITY) && generatedFromAgent;
22023
22056
  }
22024
22057
  function dedupeGeneratedResources(records) {
22025
22058
  const recordsByKey = /* @__PURE__ */ new Map();
@@ -22039,7 +22072,7 @@ function dedupeGeneratedResources(records) {
22039
22072
  }
22040
22073
  if (stableResource(resource) !== stableResource(existing.resource)) {
22041
22074
  throw new Error(
22042
- `Conflicting generated resource "${key}" from agent authoring. Inline environment definitions must be identical when they share a name.`
22075
+ `Conflicting generated resource "${key}" from agent authoring. Inline generated resources must be identical when they share a name.`
22043
22076
  );
22044
22077
  }
22045
22078
  }
@@ -22273,6 +22306,10 @@ function readApplyAssets(resources, projectRoot) {
22273
22306
  return assets;
22274
22307
  }
22275
22308
  function avatarAssetTarget(resource) {
22309
+ if (resource.kind === RESOURCE_KIND_IDENTITY) {
22310
+ const asset = resource.spec.avatar?.asset;
22311
+ return asset ? { asset, resourceName: resource.metadata.name } : void 0;
22312
+ }
22276
22313
  if (resource.kind === RESOURCE_KIND_SESSION && typeof resource.spec.identity === "object" && resource.spec.identity !== null && !Array.isArray(resource.spec.identity)) {
22277
22314
  const asset = resource.spec.identity.avatar?.asset;
22278
22315
  return asset ? { asset, resourceName: resource.metadata.name } : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.140",
3
+ "version": "0.1.141",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"