Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
efe37fd
update schema to 0.2.44
jjuliano Aug 26, 2025
6a9ac74
migrate to schema 0.2.44 using pkl-go 0.11.1 and pkl 0.29.0
jjuliano Aug 26, 2025
25a3000
cleanup and remove workaround code
jjuliano Aug 26, 2025
4bb7152
use pkl assets imports on dockermode and test; upgrade to schema 0.2.50
jjuliano Aug 27, 2025
03b9b77
use pkl 0.29.0 on Dockerfile
jjuliano Aug 27, 2025
1ea9e4e
add default Nat HostIP configurations
jjuliano Aug 27, 2025
fa0a52f
pkl-go 0.11.1 fixes for kdeps cfg
jjuliano Aug 27, 2025
5ad1178
pkl-go 0.11.1 fixes for kdeps action types
jjuliano Aug 27, 2025
4f04941
add ipv6 loopback to default NAT config
jjuliano Aug 27, 2025
d060038
add progress bar when downloading cache
jjuliano Aug 27, 2025
d94b5e4
revert resources.go changes for pkl-go 0.11.1
jjuliano Aug 29, 2025
37106ec
upgrade to schema v0.3.0
jjuliano Aug 30, 2025
fde3e04
update packages
jjuliano Aug 30, 2025
6b10e47
upgrade to schema v0.3.1-dev
jjuliano Aug 31, 2025
c801e42
add version suffix support
jjuliano Aug 31, 2025
695248d
migrate to pkl-go 0.11.1
jjuliano Aug 31, 2025
7969d2b
fix ollama binary check
jjuliano Aug 31, 2025
02731da
fix 404 error test
jjuliano Aug 31, 2025
9ab317d
schema 0.3.1-dev and pkl-go 0.11.1 migration
jjuliano Aug 31, 2025
ab1f13e
golangci fixes 1
jjuliano Sep 1, 2025
d5e2004
golangci fixes 2
jjuliano Sep 1, 2025
b067c76
golangci fixes 3
jjuliano Sep 1, 2025
5aaf13e
golangci fixes 4
jjuliano Sep 3, 2025
3667ecd
download ollama model when not found
jjuliano Sep 4, 2025
61fd4df
feat: Enhanced Ollama model management and stability improvements
jjuliano Sep 4, 2025
1a25dcc
sync ollama models to persistent storage, and websocket fixes
jjuliano Sep 4, 2025
18dc6c6
update go modules
jjuliano Sep 4, 2025
ffe13dd
update schema to 0.3.1-dev
jjuliano Sep 4, 2025
e7ab14c
upgrade GHA to pkl version 0.29.0
jjuliano Sep 4, 2025
801f233
fix issue when no models are defined to pull
jjuliano Sep 4, 2025
490f6ee
fix test to properly handle binary availabbilty errors
jjuliano Sep 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
mkdir -p ~/.local/bin
ARCH=$(uname -m)
if [ "$ARCH" = "aarch64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-aarch64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-aarch64'
elif [ "$ARCH" = "x86_64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-amd64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64'
else
echo "Unsupported architecture: $ARCH" && exit 1
fi
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Install pkl on Windows
if: matrix.platform == 'windows-latest'
run: |
Invoke-WebRequest 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-windows-amd64.exe' -OutFile pkl.exe
Invoke-WebRequest 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-windows-amd64.exe' -OutFile pkl.exe
echo "PATH=$env:GITHUB_WORKSPACE;$env:PATH" >> $env:GITHUB_ENV
.\pkl.exe --version
shell: pwsh
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
# uses: Cyberboss/install-winget@v1
# - name: Install pkl
# run: |
# curl -L -o /c/Users/runneradmin/.local/bin/pkl.exe 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-windows-amd64.exe'
# curl -L -o /c/Users/runneradmin/.local/bin/pkl.exe 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-windows-amd64.exe'
# chmod +x /c/Users/runneradmin/.local/bin/pkl.exe
# /c/Users/runneradmin/.local/bin/pkl.exe --version
# shell: bash
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
if [ "$ARCH" = "arm64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-aarch64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-aarch64'
elif [ "$ARCH" = "x86_64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-amd64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64'
else
echo "Unsupported architecture: $ARCH" && exit 1
fi
Expand All @@ -56,9 +56,9 @@ jobs:
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
if [ "$ARCH" = "arm64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-macos-aarch64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-macos-aarch64'
elif [ "$ARCH" = "x86_64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-macos-amd64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-macos-amd64'
else
echo "Unsupported architecture: $ARCH" && exit 1
fi
Expand All @@ -71,7 +71,7 @@ jobs:
if: matrix.platform == 'windows-latest'
run: |
Write-Host "Downloading PKL..."
Invoke-WebRequest 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-windows-amd64.exe' -OutFile pkl.exe
Invoke-WebRequest 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-windows-amd64.exe' -OutFile pkl.exe
if (!(Test-Path .\pkl.exe)) {
Write-Host "pkl.exe not found!"
exit 1
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
run: curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/refs/heads/main/install.sh | sh -s -- -d ${GITHUB_REF##*/}
- name: Install pkl
run: |
curl -L -o /c/Users/runneradmin/.local/bin/pkl.exe 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-windows-amd64.exe'
curl -L -o /c/Users/runneradmin/.local/bin/pkl.exe 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-windows-amd64.exe'
chmod +x /c/Users/runneradmin/.local/bin/pkl.exe
/c/Users/runneradmin/.local/bin/pkl.exe --version
shell: bash
Expand Down Expand Up @@ -306,9 +306,9 @@ jobs:
run: |
ARCH=$(uname -m)
if [ "$ARCH" = "aarch64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-aarch64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-aarch64'
elif [ "$ARCH" = "x86_64" ]; then
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.2/pkl-linux-amd64'
curl -L -o ~/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64'
else
echo "Unsupported architecture: $ARCH" && exit 1
fi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,4 @@ kdeps
local/
*.kdeps
*.pkl
*.html
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/refs/heads/main/ins
# Determine architecture and install pkl accordingly
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then \
curl -L -o /home/kdeps/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.1/pkl-linux-aarch64'; \
curl -L -o /home/kdeps/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-aarch64'; \
elif [ "$ARCH" = "x86_64" ]; then \
curl -L -o /home/kdeps/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.28.1/pkl-linux-amd64'; \
curl -L -o /home/kdeps/.local/bin/pkl 'https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64'; \
else \
echo "Unsupported architecture: $ARCH" && exit 1; \
fi && \
Expand Down
5 changes: 2 additions & 3 deletions cleanup_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"testing"

"github.com/kdeps/kdeps/pkg/environment"
Expand All @@ -21,10 +20,10 @@ func TestCleanup_RemovesFlagFile(t *testing.T) {
env, _ := environment.NewEnvironment(fs, nil) // DockerMode defaults to "0" – docker.Cleanup becomes no-op.

logger := logging.NewTestLogger()
ctx := context.Background()
ctx := t.Context()

// Call the helper under test. apiServerMode=true avoids the os.Exit path.
cleanup(fs, ctx, env, true, logger)
cleanup(ctx, fs, env, true, logger)

if exists, _ := afero.Exists(fs, "/.dockercleanup"); exists {
t.Fatalf("expected flag file to be removed by cleanup")
Expand Down
6 changes: 3 additions & 3 deletions cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ import (
)

// NewAddCommand creates the 'add' command and passes the necessary dependencies.
func NewAddCommand(fs afero.Fs, ctx context.Context, kdepsDir string, logger *logging.Logger) *cobra.Command {
func NewAddCommand(ctx context.Context, fs afero.Fs, kdepsDir string, logger *logging.Logger) *cobra.Command {
return &cobra.Command{
Use: "install [package]",
Aliases: []string{"i"},
Example: "$ kdeps install ./myAgent.kdeps",
Short: "Install an AI agent locally",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
pkgFile := args[0]
// Use the passed dependencies
_, err := archiver.ExtractPackage(fs, ctx, kdepsDir, pkgFile, logger)
if err != nil {
return err
}
fmt.Println("AI agent installed locally:", pkgFile)
fmt.Println("AI agent installed locally:", pkgFile) //nolint:forbidigo // CLI user feedback
return nil
},
}
Expand Down
45 changes: 23 additions & 22 deletions cmd/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"github.com/kdeps/kdeps/pkg/logging"
"github.com/spf13/afero"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestNewAddCommandFlags(t *testing.T) {
fs := afero.NewMemMapFs()
ctx := context.Background()
ctx := t.Context()
kdepsDir := "/tmp/kdeps"
logger := logging.NewTestLogger()

cmd := NewAddCommand(fs, ctx, kdepsDir, logger)
cmd := NewAddCommand(ctx, fs, kdepsDir, logger)
assert.Equal(t, "install [package]", cmd.Use)
assert.Equal(t, []string{"i"}, cmd.Aliases)
assert.Equal(t, "Install an AI agent locally", cmd.Short)
Expand All @@ -25,36 +26,36 @@ func TestNewAddCommandFlags(t *testing.T) {

func TestNewAddCommandExecution(t *testing.T) {
fs := afero.NewMemMapFs()
ctx := context.Background()
ctx := t.Context()
kdepsDir := "/tmp/kdeps"
logger := logging.NewTestLogger()

// Create test directory
testDir := filepath.Join("/test")
err := fs.MkdirAll(testDir, 0o755)
assert.NoError(t, err)
require.NoError(t, err)

// Create test package file
agentKdepsPath := filepath.Join(testDir, "agent.kdeps")
err = afero.WriteFile(fs, agentKdepsPath, []byte("test package"), 0o644)
assert.NoError(t, err)
require.NoError(t, err)

// Test error case - no arguments
cmd := NewAddCommand(fs, ctx, kdepsDir, logger)
cmd := NewAddCommand(ctx, fs, kdepsDir, logger)
err = cmd.Execute()
assert.Error(t, err)
require.Error(t, err)

// Test error case - invalid package file
cmd = NewAddCommand(fs, ctx, kdepsDir, logger)
cmd = NewAddCommand(ctx, fs, kdepsDir, logger)
cmd.SetArgs([]string{filepath.Join(testDir, "nonexistent.kdeps")})
err = cmd.Execute()
assert.Error(t, err)
require.Error(t, err)

// Test error case - invalid package content
cmd = NewAddCommand(fs, ctx, kdepsDir, logger)
cmd = NewAddCommand(ctx, fs, kdepsDir, logger)
cmd.SetArgs([]string{agentKdepsPath})
err = cmd.Execute()
assert.Error(t, err)
require.Error(t, err)
}

func TestNewAddCommandValidPackage(t *testing.T) {
Expand All @@ -67,34 +68,34 @@ func TestNewAddCommandValidPackage(t *testing.T) {
testDir := filepath.Join("/test")
validAgentDir := filepath.Join(testDir, "valid-agent")
err := fs.MkdirAll(validAgentDir, 0o755)
assert.NoError(t, err)
require.NoError(t, err)

// Create test package file with valid structure
workflowPath := filepath.Join(validAgentDir, "workflow.pkl")
err = afero.WriteFile(fs, workflowPath, []byte("name: test\nversion: 1.0.0"), 0o644)
assert.NoError(t, err)
require.NoError(t, err)

// Create resources directory and add required resources
resourcesDir := filepath.Join(validAgentDir, "resources")
err = fs.MkdirAll(resourcesDir, 0o755)
assert.NoError(t, err)
require.NoError(t, err)

// Create all required resource files
requiredResources := []string{"client.pkl", "exec.pkl", "llm.pkl", "python.pkl", "response.pkl"}
for _, resource := range requiredResources {
resourcePath := filepath.Join(resourcesDir, resource)
err = afero.WriteFile(fs, resourcePath, []byte("resource content"), 0o644)
assert.NoError(t, err)
require.NoError(t, err)
}

validKdepsPath := filepath.Join(testDir, "valid-agent.kdeps")
err = afero.WriteFile(fs, validKdepsPath, []byte("valid package"), 0o644)
assert.NoError(t, err)
require.NoError(t, err)

cmd := NewAddCommand(fs, ctx, kdepsDir, logger)
cmd := NewAddCommand(ctx, fs, kdepsDir, logger)
cmd.SetArgs([]string{validKdepsPath})
err = cmd.Execute()
assert.Error(t, err) // Should fail due to invalid package format, but in a different way
require.Error(t, err) // Should fail due to invalid package format, but in a different way
}

// TestNewAddCommand_RunE ensures the command is wired correctly – we expect an
Expand All @@ -105,7 +106,7 @@ func TestNewAddCommand_RunE(t *testing.T) {
ctx := context.Background()
logger := logging.NewTestLogger()

cmd := NewAddCommand(fs, ctx, "/kdeps", logger)
cmd := NewAddCommand(ctx, fs, "/kdeps", logger)

// Supply non-existent path so that ExtractPackage fails and RunE returns
// an error. Success isn't required – only execution.
Expand All @@ -119,7 +120,7 @@ func TestNewAddCommand_ErrorPath(t *testing.T) {
fs := afero.NewMemMapFs()
ctx := context.Background()

cmd := NewAddCommand(fs, ctx, "/tmp/kdeps", logging.NewTestLogger())
cmd := NewAddCommand(ctx, fs, "/tmp/kdeps", logging.NewTestLogger())
cmd.SetArgs([]string{"nonexistent.kdeps"})

err := cmd.Execute()
Expand All @@ -129,7 +130,7 @@ func TestNewAddCommand_ErrorPath(t *testing.T) {
func TestNewAddCommand_MetadataAndArgs(t *testing.T) {
fs := afero.NewMemMapFs()
ctx := context.Background()
cmd := NewAddCommand(fs, ctx, "/tmp/kdeps", logging.NewTestLogger())
cmd := NewAddCommand(ctx, fs, "/tmp/kdeps", logging.NewTestLogger())

assert.Equal(t, "install [package]", cmd.Use)
assert.Contains(t, cmd.Short, "Install")
Expand All @@ -147,7 +148,7 @@ func TestNewAddCommand_MetadataAndArgs(t *testing.T) {
// wiring rather than validate its behaviour.
func TestNewAddCommandRunE(t *testing.T) {
fs := afero.NewMemMapFs()
cmd := NewAddCommand(fs, context.Background(), "/kdeps", logging.NewTestLogger())
cmd := NewAddCommand(context.Background(), fs, "/kdeps", logging.NewTestLogger())

if err := cmd.RunE(cmd, []string{"dummy.kdeps"}); err == nil {
t.Fatalf("expected error due to missing package file, got nil")
Expand Down
6 changes: 3 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
)

// NewBuildCommand creates the 'build' command and passes the necessary dependencies.
func NewBuildCommand(fs afero.Fs, ctx context.Context, kdepsDir string, systemCfg *kdeps.Kdeps, logger *logging.Logger) *cobra.Command {
func NewBuildCommand(ctx context.Context, fs afero.Fs, kdepsDir string, systemCfg *kdeps.Kdeps, logger *logging.Logger) *cobra.Command {
return &cobra.Command{
Use: "build [package]",
Aliases: []string{"b"},
Example: "$ kdeps build ./myAgent.kdeps",
Short: "Build a dockerized AI agent",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
pkgFile := args[0]
// Use the passed dependencies
pkgProject, err := archiver.ExtractPackage(fs, ctx, kdepsDir, pkgFile, logger)
Expand All @@ -44,7 +44,7 @@ func NewBuildCommand(fs afero.Fs, ctx context.Context, kdepsDir string, systemCf
if err := docker.CleanupDockerBuildImages(fs, ctx, agentContainerName, dockerClient); err != nil {
return err
}
fmt.Println("Kdeps AI Agent docker image created:", agentContainerNameAndVersion)
fmt.Println("Kdeps AI Agent docker image created:", agentContainerNameAndVersion) //nolint:forbidigo // CLI user feedback
return nil
},
}
Expand Down
Loading
Loading