Class: Insika::Pack
- Inherits:
-
Data
- Object
- Data
- Insika::Pack
- Defined in:
- lib/insika/pack.rb
Overview
Provisioning pack: the PORTABLE form of an agent — a
manifest + the prompt files + the skills + the data-tool defs. It's what
docs/prompt-base/06 describes as a workspace, here in a value object
consumable by the PackImporter (which emits the authoring Commands). GENERIC
per project: the engine doesn't know any consumer — the pack is the contract.
config: Hash — manifest (AgentProfile.build attrs: id/model/provider/
limits/metadata/tools_deferred/…). `id`/`model` required there.
files: { "IDENTITY.md" => "<content>", ... } — prompt files (become
prompt_files via write_agent_file). File name = key.
skills: { "escalation-to-human" => "<SKILL.md>", ... } — 1 per skill.
tools: [ { ToolDefinition hash }, ... ] — the pack's data-tool defs.
Two sources: from_h (GatewayClient JSON — provisioning API) and
from_dir (a folder on disk per docs/prompt-base/06 — authoring/CLI).
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Class Method Summary collapse
-
.from_dir(path) ⇒ Object
Folder on disk (docs/prompt-base/06):
agent.config.json+*.mdat the root +skills/<name>/SKILL.md+tools/*.json(1 ToolDefinition per file). -
.from_h(hash) ⇒ Object
Raw Hash (string|symbol keys) -> Pack.
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config
21 22 23 |
# File 'lib/insika/pack.rb', line 21 def config @config end |
#files ⇒ Object (readonly)
Returns the value of attribute files
21 22 23 |
# File 'lib/insika/pack.rb', line 21 def files @files end |
#skills ⇒ Object (readonly)
Returns the value of attribute skills
21 22 23 |
# File 'lib/insika/pack.rb', line 21 def skills @skills end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools
21 22 23 |
# File 'lib/insika/pack.rb', line 21 def tools @tools end |
Class Method Details
.from_dir(path) ⇒ Object
Folder on disk (docs/prompt-base/06): agent.config.json + *.md at the
root + skills/<name>/SKILL.md + tools/*.json (1 ToolDefinition per file).
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/insika/pack.rb', line 52 def self.from_dir(path) root = path.to_s config_file = File.join(root, "agent.config.json") raise Insika::ValidationError, "pack missing agent.config.json in #{root}" unless File.exist?(config_file) new( config: symbolize(JSON.parse(File.read(config_file, encoding: "UTF-8"))), files: read_md_files(root), skills: read_skills(File.join(root, "skills")), tools: read_tools(File.join(root, "tools")) ) end |
.from_h(hash) ⇒ Object
Raw Hash (string|symbol keys) -> Pack. Tolerates both key conventions (the JSON wire may arrive symbolized or not).
24 25 26 27 28 29 30 31 32 |
# File 'lib/insika/pack.rb', line 24 def self.from_h(hash) h = hash || {} new( config: symbolize(dig(h, :config) || {}), files: text_values!(stringify_keys(dig(h, :files) || {}), "files"), skills: text_values!(stringify_keys(dig(h, :skills) || {}), "skills"), tools: Array(dig(h, :tools)) ) end |