@tangle-network/agent-app 0.60.28 → 0.60.30

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/profile/home.ts"],"sourcesContent":["import type { AgentProfile, AgentProfileFileMount } from '@tangle-network/agent-interface'\nimport { defineInlineResource, mergeAgentProfiles } from '@tangle-network/agent-interface'\n\n/** Unicode code-point budgets. The installed writer also bounds UTF-8 bytes. */\nexport const DEFAULT_HOME_LIMITS = {\n 'AGENTS.md': 12_000,\n 'SOUL.md': 8_000,\n 'IDENTITY.md': 4_000,\n 'USER.md': 4_000,\n 'MEMORY.md': 16_000,\n 'BOOTSTRAP.md': 8_000,\n dailyNote: 12_000,\n skill: 32_000,\n} as const\n\nexport const DEFAULT_AGENT_HOME = '/var/lib/tangle-agent/home'\n\nconst AGENTS = `# Home\n\nThis is your durable home in your private Tangle computer. Inspect and use the computer.\nThe platform owns this file and the home writer. Your normal shell is not root.\n\n## Behavior\n- The person's current request comes first.\n- Reply in the person's language. Switch when they switch.\n- In a group, reply only when mentioned or directly addressed.\n- Be genuinely helpful, not performatively helpful. Be resourceful before asking.\n- Have a point of view when useful, and distinguish evidence from uncertainty.\n- Remember you are a guest in the person's or group's space.\n\n## Memory\n- IDENTITY.md starts empty. Fill it during first run.\n- USER.md holds dated preferences, at most 4,000 Unicode characters.\n- MEMORY.md holds curated durable facts. Shared facts must be safe for the whole group.\n- memory/YYYY-MM-DD.md holds daily notes; consolidate durable facts nightly.\n- skills/<name>/SKILL.md holds reusable skills, not new authority.\n- Never write credentials or private third-party records into memory.\n- Use home_read, home_write, home_append, home_status and home_consolidate.\n- The protected writer enforces file, character and byte budgets before writes and commits to git.\n- Shell, code and ordinary project files remain available elsewhere in this sandbox.\n- Do not work around a rejected home write by chmod, symlinks, another interpreter or another credential.\n\n## Self edits\nSOUL.md is editable through home_write. Tell the owner what changed and why when ownerNoticeRequired is returned.\nAGENTS.md is platform-owned and cannot be edited. Business rules belong in skills and presets.\n`\n\nconst SOUL = `# Soul\n\nBe genuinely helpful, not performatively helpful.\nHave opinions when judgment is useful.\nBe resourceful before asking.\nRemember you are a guest.\nPrefer clear, direct answers over ceremony.\n`\n\nconst BOOTSTRAP = `# First run\n\nThe user's request always comes first. Do not delay the answer for setup.\n\nAfter answering enough to be useful:\n1. Read AGENTS.md and SOUL.md.\n2. Fill empty IDENTITY.md through home_write using the configured identity, not an invented biography.\n3. Record any stated durable preference as a dated USER.md entry through home_write or home_append.\n4. Add a daily note only when there is something worth remembering.\n5. Call home_bootstrap. It removes this file and returns the git commit.\n`\n\nfunction inline(path: string, content: string): AgentProfileFileMount {\n return { path, resource: defineInlineResource(`default-home:${path}`, content) }\n}\n\n/** Canonical seed records. The trusted image installer materializes these once. */\nexport function defaultHomeFiles(): AgentProfileFileMount[] {\n return [\n inline('AGENTS.md', AGENTS), inline('SOUL.md', SOUL),\n inline('IDENTITY.md', ''), inline('USER.md', ''), inline('MEMORY.md', ''),\n inline('BOOTSTRAP.md', BOOTSTRAP),\n ]\n}\n\n/**\n * Compose home instructions, not per-turn writes to persistent memory.\n * The published install-home command consumes defaultHomeFiles with the same\n * inline resource format as other profile seeds. A privileged, one-time phase\n * is necessary: ordinary resources.files writes run as the agent and cannot\n * make a same-UID shell respect caps or platform file ownership.\n */\nexport function withDefaultAgentHome(profile: AgentProfile): AgentProfile {\n const reserved = new Set(['AGENTS.md', 'SOUL.md', 'IDENTITY.md', 'USER.md', 'MEMORY.md', 'BOOTSTRAP.md', '.tangle/home.py'])\n for (const file of profile.resources?.files ?? []) {\n const parts = file.path.replace(/\\\\/g, '/').split('/').filter(part => part && part !== '.')\n if (parts.includes('..')) throw new Error('Home-aware profiles require canonical file mount paths')\n const path = parts.join('/')\n if (reserved.has(path) || path === 'var/lib/tangle-agent' || path.startsWith('var/lib/tangle-agent/') ||\n path.startsWith('etc/tangle-agent/') || path === 'usr/local/libexec/tangle-agent-home.py') {\n throw new Error('Do not remount the protected home; use the home tools and business skills')\n }\n }\n const merged = mergeAgentProfiles(profile, { prompt: { instructions: [\n `Your git-tracked home is ${DEFAULT_AGENT_HOME}. Read AGENTS.md and SOUL.md there.`,\n 'Use the protected home tools for memory and bootstrap. Native shell remains available for ordinary code and project files. A missing protected-home installation is an infrastructure error, not permission to create an unprotected replacement.',\n ] } })\n if (!merged) throw new Error('Home profile composition returned no profile')\n return merged\n}\n"],"mappings":";AACA,SAAS,sBAAsB,0BAA0B;AAGlD,IAAM,sBAAsB;AAAA,EACjC,aAAa;AAAA,EACb,WAAW;AAAA,EACX,eAAe;AAAA,EACf,WAAW;AAAA,EACX,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,OAAO;AACT;AAEO,IAAM,qBAAqB;AAElC,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8Bf,IAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASb,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYlB,SAAS,OAAO,MAAc,SAAwC;AACpE,SAAO,EAAE,MAAM,UAAU,qBAAqB,gBAAgB,IAAI,IAAI,OAAO,EAAE;AACjF;AAGO,SAAS,mBAA4C;AAC1D,SAAO;AAAA,IACL,OAAO,aAAa,MAAM;AAAA,IAAG,OAAO,WAAW,IAAI;AAAA,IACnD,OAAO,eAAe,EAAE;AAAA,IAAG,OAAO,WAAW,EAAE;AAAA,IAAG,OAAO,aAAa,EAAE;AAAA,IACxE,OAAO,gBAAgB,SAAS;AAAA,EAClC;AACF;AASO,SAAS,qBAAqB,SAAqC;AACxE,QAAM,WAAW,oBAAI,IAAI,CAAC,aAA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