GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — harness/skills.go at main · majorcontext/harness Expand file tree/ Copy pathskills.goMore file actions 57 lines (50 loc) · 1.77 KB / Copy pathskills.goFile metadata and controls57 lines (50 loc) · 1.77 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 package harness import ( "context" "github.com/majorcontext/harness/internal/prompt" "github.com/majorcontext/harness/internal/selftool" "github.com/majorcontext/harness/internal/turn" ) // SkillSource supplies the embedded skills of a session, for example from a database. // The runtime calls List and Read concurrently, also for one session. type SkillSource interface { // List returns the skills of a session. List(ctx context.Context, session string) ([]SkillInfo, error) // Read returns one file of a skill: "SKILL.md" or a slash-separated path relative to the skill root. Read(ctx context.Context, session, name, file string) ([]byte, error) } // SkillInfo names an embedded skill. type SkillInfo struct { Name string Description string } // embedded returns the embedded skills of session id. func (r *Runtime) embedded(ctx context.Context, id string) ([]prompt.Embedded, error) { infos, err := r.skills.List(ctx, id) if err != nil { return nil, err } out := make([]prompt.Embedded, len(infos)) for i, s := range infos { out[i] = prompt.Embedded{Name: s.Name, Description: s.Description} } return out, nil } // listSkills returns the embedded skills of session id for its system prompt. A failed List gives none. func (r *Runtime) listSkills(ctx context.Context, id string) []prompt.Embedded { if r.skills == nil { return nil } out, err := r.embedded(ctx, id) if err != nil { r.log.Warn("harness: embedded skills not listed", "session", id, "err", err) return nil } return out } // skillSource returns load_skill of session id, with the notice that follows the skill list of the session. func (r *Runtime) skillSource(id string, sp *selftool.Prompt) turn.Source { sk := selftool.NewSkills(id, r.embedded, r.skills.Read, r.log) sp.Track(sk) return sk } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |